GNU bug report logs - #46722
test-map-into fails

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Tue, 23 Feb 2021 16:23:01 UTC

Severity: normal

Merged with 53365

Found in versions 27.2, 28.0.50, 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #52 received at 46722 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: dick <dick.r.chiang <at> gmail.com>
Cc: contovob <at> tcd.ie, Glenn Morris <rgm <at> gnu.org>,
 Lars Ingebrigtsen <larsi <at> gnus.org>, Stefan Kangas <stefan <at> marxist.se>,
 46722 <at> debbugs.gnu.org
Subject: Re: bug#46722: test-map-into fails
Date: Wed, 05 Jan 2022 11:31:59 -0500
Hi Dick,

dick [2022-01-05 09:01:29] wrote:
> For unclear reasons, the hash-table `cl--generic-dispatchers` keyed off
> raw, unburnished defstructs returns values for non-existent keys.

Hmm... I don't understand what this means concretely.
I'm aware that `cl--generic-dispatchers` can be fiddly (IIRC because
there can be functions in the key), but I still can't figure out what
scenario you're describing nor how it can happen to return values for
non-existent keys.

Could you say a bit more, ideally with something like a trace or
a test case?

[...time passes...]

> I normalized its key to a signature string, and,
>
> for i in {1..300} ; do src/emacs -Q -batch -f batch-byte-compile foo.el
> ; src/emacs -Q -batch -l foo.elc ;  done ;

Oh I think I see what you mean.  I can now reproduce the problem locally
as well, and with the foo.el below I get two different traces:

    (trace-function 'cl--generic-get-dispatcher)
    
    (require 'map)
    (condition-case nil
        (progn
          (map-into nil '(hash-table))
          (with-current-buffer "*trace-output*"
            (write-region nil nil "~/tmp/trace-good.eld")))
      (error
       (with-current-buffer "*trace-output*"
         (write-region nil nil "~/tmp/trace-bad.eld")
         (message "ERROR!!"))))

the two backtraces only differ on the last line.  The good trace
(slightly cleaned up for legibility) ends with:

======================================================================
1 -> (cl--generic-get-dispatcher
      (1 #s(cl--generic-generalizer cl--generic-eql-generalizer 100
            #[385 "<bytecode>" [gethash (cl--generic-eql-used)] 5]
            #[385 "<bytecode>" [eql] 4])
         #s(cl--generic-generalizer cl--generic-t-generalizer 0
            #[385 #2="\300\207" [nil] 3 #1#]
            #[385 #2# [(t)] 3])))
1 <- cl--generic-get-dispatcher:
     #[771 "<bytecode>" [make-hash-table :test eql make-closure
                         #[642 "<bytecode>"
                           [V0 V1 V2 V3 cl--generic-eql-used apply gethash
                            cl--generic-cache-miss 1 append
                            #[385 "<bytecode>" [eql] 4]
                            #[385 "\300\207" [(t)] 3]
                            nil puthash]
                           15]]
                        10]
======================================================================
1 -> (cl--generic-get-dispatcher
      (1 #s(cl--generic-generalizer cl--generic-eql-generalizer 100
            #[385 "<bytecode>" [gethash (cl--generic-eql-used)] 5]
            #[385 "<bytecode>" [eql] 4])
         #s(cl--generic-generalizer cl--generic-head-generalizer 80
            #[385 "<bytecode>" [gethash car-safe (cl--generic-head-used)] 5]
            #[385 "<bytecode>" [head] 4])
         #s(cl--generic-generalizer cl--generic-t-generalizer 0
            #[385 #3="\300\207" [nil] 3]
            #[385 #3# [(t)] 3])))
1 <- cl--generic-get-dispatcher:
     #[771 "<bytecode>" [make-hash-table :test eql make-closure
                         #[642 "<bytecode>"
                           [V0 V1 V2 V3 cl--generic-eql-used
                            cl--generic-head-used apply gethash
                            cl--generic-cache-miss 1 append
                            #[385 "<bytecode>" [eql] 4]
                            #[385 "<bytecode>" [head] 4]
                            #[385 "\300\207" [(t)] 3]
                            nil puthash]
                           16]]
                        10]

whereas in the bad trace, the last returned value is identical to the
previous one (i.e. somehow the `head` dispatcher is absent from the
returned function).

Hmm....


        Stefan





This bug report was last modified 3 years and 123 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.