[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65051: internal_equal manipulates symbols with position without chec
From: |
Alan Mackenzie |
Subject: |
bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled. |
Date: |
Fri, 4 Aug 2023 14:00:29 +0000 |
Hello, Emacs.
The code in question is in internal_equal (src/fns.c) ~37 lines from its
start. We have:
if (SYMBOL_WITH_POS_P (o1))
o1 = SYMBOL_WITH_POS_SYM (o1);
if (SYMBOL_WITH_POS_P (o2))
o2 = SYMBOL_WITH_POS_SYM (o2);
at the top level of the function. Thus
(equal 'foo #<symbol foo at 42>)
will return non-nil, regardless of the setting of
symbols-with-pos-enabled. It should return non-nil only when that flag
variable is non-nil. This is a bug.
#########################################################################
A simple fix is:
diff --git a/src/fns.c b/src/fns.c
index bfd19e8c8f2..b1f0c4ecdd6 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -2773,10 +2773,13 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, enum
equal_kind equal_kind,
/* A symbol with position compares the contained symbol, and is
`equal' to the corresponding ordinary symbol. */
- if (SYMBOL_WITH_POS_P (o1))
- o1 = SYMBOL_WITH_POS_SYM (o1);
- if (SYMBOL_WITH_POS_P (o2))
- o2 = SYMBOL_WITH_POS_SYM (o2);
+ if (symbols_with_pos_enabled)
+ {
+ if (SYMBOL_WITH_POS_P (o1))
+ o1 = SYMBOL_WITH_POS_SYM (o1);
+ if (SYMBOL_WITH_POS_P (o2))
+ o2 = SYMBOL_WITH_POS_SYM (o2);
+ }
if (BASE_EQ (o1, o2))
return true;
--
Alan Mackenzie (Nuremberg, Germany).
- bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled.,
Alan Mackenzie <=
- bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled., Eli Zaretskii, 2023/08/04
- bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled., Alan Mackenzie, 2023/08/04
- bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled., Eli Zaretskii, 2023/08/04
- bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled., Alan Mackenzie, 2023/08/04
- bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled., Eli Zaretskii, 2023/08/04
- bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled., Alan Mackenzie, 2023/08/05
- bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled., Eli Zaretskii, 2023/08/05
- bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled., Alan Mackenzie, 2023/08/05
- bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled., Eli Zaretskii, 2023/08/05
- bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled., Alan Mackenzie, 2023/08/05