Subject: Re: bug#65051: internal_equal manipulates symbols with position without checking symbols-with-pos-enabled.

From: Eli Zaretskii <[email-masked]>
Date: Fri, 04 Aug 2023 17:32:35 +0300

> Date: Fri, 4 Aug 2023 14:00:29 +0000
> From: Alan Mackenzie <[email-masked]>
> 
> 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:

What will happen to the comparison in internal_equal when
symbols_with_pos_enabled is zero and the two objects have different
positions, or one has a position, the other doesn't?

And which branch are you proposing this change for?