all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Pip Cet <pipcet@gmail.com>
Cc: 39529@debbugs.gnu.org, federicotedin@gmail.com
Subject: bug#39529: 28.0.50; Metahelp does not contain help text
Date: Sun, 16 Feb 2020 11:43:50 -0800	[thread overview]
Message-ID: <59be714f-1b52-a068-70c8-3204cf016ca2@cs.ucla.edu> (raw)
In-Reply-To: <CAOqdjBdXN9_+fFC7ehLwCZdDcTvYRVCquBNLhPjt4i7vVkwUmQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2257 bytes --]

On 2/16/20 8:51 AM, Pip Cet wrote:

> it relies on different objects having different hashes, and they might,
> by pure chance, have the same hash.

That could happen only if two Lisp vector addresses disagree only in the 
high-order bit during dumping while on a USE_LSB_TAG platform, something that I 
didn't think possible on practical Emacs targets. However, the potential problem 
is easy enough to work around; I installed the attached.

> We need to fix the underlying issue, or at least go for the correct
> "quick fix", which is to make equal = eq for bytecode objects (this is
> almost indistinguishable from the previous behavior, before
> sxhash-equal was "fixed").

Give the attached patch I hope no such quick fix is needed.

For what it's worth, the patched code is similar to what Fautoload does; so if 
there's something wrong here, a similar wrongness has likely been present in 
Fautoload for some time.

> The pure-cons hash, and many other places, assume "equal" means
> "equivalent" in some way. That's not true for bytecode objects, where
> a function always returning `nil' can be equal to one always returning
> `t'.

Could you give an example of this? When I byte-compiled this:

(defun always-t () t)
(defun always-nil () nil)

the .elc file had different bytecode objects #[nil "\300\207" [t] 1] and #[nil 
"\300\207" [nil] 1]. (The strings are the same, but that's not the issue here.)

> the right fix is not to make equal look at
> more state than sxhash-equal used to, particularly for Emacs 27.

That would indeed make 'equal' and 'sxhash-equal' consistent. But wouldn't it 
potentially break a different set of user programs, that (say) rely on 'equal' 
returning nil when markers point to different locations? So I'd be leery about 
messing with Emacs 27 in this area.

For the master branch, it's more of a question of what 'equal' should mean. 
Obviously 'sxhash-equal' must be consistent with 'equal'. If we decide that 
'equal' should not inspect marker contents etc., then we should change 
'sxhash-equal' accordingly.

(To my mind a better fix would be to introduce the notion of immutability, and 
for sxhash-equal to inspect only the immutable parts of key contents. But now 
it's time for me to duck and run....)

[-- Attachment #2: 0001-Improve-C-h-C-h-bug-fix.patch --]
[-- Type: text/x-patch, Size: 1482 bytes --]

From 556cc727e5076d590f8286406e4f46cff3cee41e Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 16 Feb 2020 11:36:19 -0800
Subject: [PATCH] Improve C-h C-h bug fix

* src/lread.c (read1): Guard against two 'struct Lisp_Vector *'
pointers differing only in their most significant bit.  Problem
reported by Pip Cet (Bug#39529#22).
---
 src/lread.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/lread.c b/src/lread.c
index 1613719eb1..70984d37e1 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2982,10 +2982,13 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
 		 as 0.  This placeholder 0 would lead to accidental sharing in
 		 purecopy's hash-consing, so replace it with a (hopefully)
 		 unique integer placeholder, which is negative so that it is
-		 not confused with a DOC file offset.  Eventually
-		 Snarf-documentation should replace the placeholder with the
-		 actual docstring.  */
-	      EMACS_UINT hash = XHASH (tmp) | (INTMASK - INTMASK / 2);
+		 not confused with a DOC file offset (the USE_LSB_TAG shift
+		 relies on the fact that VALMASK is one bit narrower than
+		 INTMASK).  Eventually Snarf-documentation should replace the
+		 placeholder with the actual docstring.  */
+	      verify (INTMASK & ~VALMASK);
+	      EMACS_UINT hash = ((XHASH (tmp) >> USE_LSB_TAG)
+				 | (INTMASK - INTMASK / 2));
 	      ASET (tmp, COMPILED_DOC_STRING, make_ufixnum (hash));
 	    }
 
-- 
2.17.1


  reply	other threads:[~2020-02-16 19:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-09 19:06 bug#39529: 28.0.50; Metahelp does not contain help text Federico Tedin
2020-02-09 19:22 ` Eli Zaretskii
2020-02-09 19:34   ` Eli Zaretskii
2020-02-15 23:25     ` Paul Eggert
2020-02-16 15:35       ` Eli Zaretskii
2020-02-16 16:51       ` Pip Cet
2020-02-16 19:43         ` Paul Eggert [this message]
2020-02-18 19:56           ` Pip Cet
2020-02-19  1:21             ` Paul Eggert
2020-02-19  2:34               ` Pip Cet
2020-02-19  9:00                 ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59be714f-1b52-a068-70c8-3204cf016ca2@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=39529@debbugs.gnu.org \
    --cc=federicotedin@gmail.com \
    --cc=pipcet@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.