From: Eli Zaretskii <eliz@gnu.org>
To: Pip Cet <pipcet@protonmail.com>
Cc: 72802@debbugs.gnu.org
Subject: bug#72802: 31.0.50; Crash in (equal sub-char-table-a sub-char-table-b)
Date: Sun, 25 Aug 2024 18:39:57 +0300 [thread overview]
Message-ID: <868qwkligi.fsf@gnu.org> (raw)
In-Reply-To: <87le0k3a81.fsf@protonmail.com> (message from Pip Cet on Sun, 25 Aug 2024 15:15:14 +0000)
> Date: Sun, 25 Aug 2024 15:15:14 +0000
> From: Pip Cet <pipcet@protonmail.com>
> Cc: 72802@debbugs.gnu.org
>
> > Not even on master, I think, unless we see a bug related to it that is not
> > caused by a specially-concocted Lisp program or GDB command.
>
> It's a clear bug, whether or not the Lisp programs that cause it are
> "specially-concocted" (what's that supposed to mean, anyway? We can't
> just delay fixing what are clearly bugs until they pop up on random
> users' machines!)
We certainly can, and do.
Is there any code out there that compares char-tables and is affected
by this?
> So I think it's important to fix this soon (not "now") on the master
> branch.
I disagree, at least for now, sorry. char-tables have been stable for
decades, so any change there should ideally be part of some
significant enhancement that justifies the potential destabilization.
Elimination of pure space or some similar change fits the bill.
> > If this is required for the no-pure-space branch, I think you should
> > install this on that branch. Then it will be merged together with the
> > branch.
>
> It's not, it just popped up during work on that branch.
Popped up how?
In any case, there's nothing wrong with fixing that as part of a much
larger changeset, which gives us significant gains.
> > I'm not sure we want to pay this cost. What bothers me is mainly the
> > run-time cost of extracting integers from Lisp objects.
>
> That might be noticeable on 32-bit machines with EMACS_WIDE_INT, I
> suppose, or on very old machines where memory isn't so much slower than
> register manipulation.
>
> > char-table is
> > supposed to be very efficient, both memory-wise and CPU-wise, and I
> > think the performance here trumps simplicity.
>
> How about using an "ordinary" pseudovector with its non-Lisp elements at
> the end?
Not even that, I think. Some of the char-table are accessed in the
inner-most loops of the display code, and were at the time optimized
especially for that purpose. I'm not interested in making changes
there for minor simplifications.
> >> BTW, I'm surprised this code returns nil; I think that should be
> >> documented.
> >>
> >> (setq a (make-char-table nil))
> >> (setq b (make-char-table nil))
> >> (aset a 1 nil)
> >> (dotimes (i (max-char))
> >> (unless (equal (aref a i) (aref b i))
> >> (error "i = %S" i)))
> >> (equal a b)
> >
> > Why are you surprised? Setting a single cell of a char-table changes
> > its structure, usually in quite a radical way. 'aref' does some very
> > special things for char-tables; the semantics of accessing an element
> > of a vector is only correct superficially, not in the details.
>
> Indeed, and I expected (and still expect) 'equal' to ignore such
> details.
No, 'equal' compares components literally.
> > The internals of a char-table are not really documented in the ELisp
> > manual; the description there is mostly phenomenological, without any
> > details.
>
> I don't think 'equal' behavior is part of those "internals"
Indeed, it isn't. But if the internals are described in enough
detail, people will be able to understand why 'equal' returns nil in
your case.
> > If you want to document the internals, I think the proper
>
> Not the internals, just how 'equal' works.
Why is it important? The doc string of 'equal' already says
Return t if two Lisp objects have similar structure and contents.
The two char-tables you are comparing have different structure, so
'equal' returns nil. What else would you like to document there?
next prev parent reply other threads:[~2024-08-25 15:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-25 13:13 bug#72802: 31.0.50; Crash in (equal sub-char-table-a sub-char-table-b) Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-25 14:11 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-25 14:50 ` Eli Zaretskii
2024-08-25 15:15 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-08-25 15:39 ` Eli Zaretskii [this message]
2024-08-25 16:01 ` Pip Cet 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=868qwkligi.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=72802@debbugs.gnu.org \
--cc=pipcet@protonmail.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 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).