GNU bug report logs -
#65051
internal_equal manipulates symbols with position without checking symbols-with-pos-enabled.
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Fri, 4 Aug 2023 14:01:02 UTC
Severity: normal
Done: Alan Mackenzie <acm <at> muc.de>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Mon, 4 Sep 2023 12:57:15 +0000
with message-id <ZPXUK62b3CbFfNHH <at> ACM>
and subject line Re: bug#65051: Acknowledgement (internal_equal manipulates symbols with position without checking symbols-with-pos-enabled.)
has caused the debbugs.gnu.org bug report #65051,
regarding internal_equal manipulates symbols with position without checking symbols-with-pos-enabled.
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
65051: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65051
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
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).
[Message part 3 (message/rfc822, inline)]
Bug fixed in the master branch, 2023-09-04.
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 1 year and 315 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.