unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: dick <dick.r.chiang@gmail.com>
Cc: contovob@tcd.ie, Glenn Morris <rgm@gnu.org>,
	Lars Ingebrigtsen <larsi@gnus.org>,
	Stefan Kangas <stefan@marxist.se>,
	46722@debbugs.gnu.org
Subject: bug#46722: test-map-into fails
Date: Wed, 05 Jan 2022 11:31:59 -0500	[thread overview]
Message-ID: <jwvv8yyrzni.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87a6gawabq.fsf@dick> (dick's message of "Wed, 05 Jan 2022 09:01:29 -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






  reply	other threads:[~2022-01-05 16:31 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23 16:22 bug#46722: test-map-into fails Glenn Morris
2021-02-23 16:33 ` Basil L. Contovounesios
2021-02-23 17:06   ` Glenn Morris
2021-02-23 17:30   ` Stefan Monnier
2021-02-23 20:58     ` Basil L. Contovounesios
2021-02-23 22:50       ` Basil L. Contovounesios
2021-04-04 16:05 ` Glenn Morris
2021-11-17  8:47 ` Stefan Kangas
2021-11-29 18:20   ` Glenn Morris
2021-11-29 18:26     ` Lars Ingebrigtsen
2021-11-29 18:40       ` Glenn Morris
2022-01-04 21:56         ` dick
2022-01-05 14:01           ` dick
2022-01-05 16:31             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-01-05 17:51               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-05 18:07                 ` Eli Zaretskii
2022-01-05 18:24                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-13 19:23                     ` Philipp Stephani
2022-01-13 20:40                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-13 20:45                         ` Philipp Stephani
2022-01-14  7:40                           ` Lars Ingebrigtsen
2022-01-14 12:02                             ` Philipp Stephani
2022-01-15  8:01                               ` Lars Ingebrigtsen
2022-01-15 11:47                                 ` Philipp Stephani
2022-01-15 15:16                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-15 15:55                                     ` Eli Zaretskii
2022-01-20 12:49                                       ` Lars Ingebrigtsen
2022-01-05 15:17           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-05 16:04             ` dick
2022-01-05 16:38               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-05 18:35           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-05 18:59             ` dick
2022-01-05 19:17               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvv8yyrzni.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=46722@debbugs.gnu.org \
    --cc=contovob@tcd.ie \
    --cc=dick.r.chiang@gmail.com \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=rgm@gnu.org \
    --cc=stefan@marxist.se \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).