emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65051: closed (internal_equal manipulates symbols with position with


From: GNU bug Tracking System
Subject: bug#65051: closed (internal_equal manipulates symbols with position without checking symbols-with-pos-enabled.)
Date: Mon, 04 Sep 2023 12:58:01 +0000

Your message dated Mon, 4 Sep 2023 12:57:15 +0000
with message-id <ZPXUK62b3CbFfNHH@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@gnu.org.)


-- 
65051: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65051
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: 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).



--- End Message ---
--- Begin Message --- Subject: Re: bug#65051: Acknowledgement (internal_equal manipulates symbols with position without checking symbols-with-pos-enabled.) Date: Mon, 4 Sep 2023 12:57:15 +0000
Bug fixed in the master branch, 2023-09-04.

-- 
Alan Mackenzie (Nuremberg, Germany).


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]