GNU bug report logs - #33414
27.0.50; inhibit-changing-match-data can be t in syntax-propertize functions, breaking backtrace and looking-at

Previous Next

Package: emacs;

Reported by: Pip Cet <pipcet <at> gmail.com>

Date: Sat, 17 Nov 2018 13:31:02 UTC

Severity: normal

Found in version 27.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


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 33414 <at> debbugs.gnu.org, Pip Cet <pipcet <at> gmail.com>
Subject: bug#33414: 27.0.50; inhibit-changing-match-data can be t in syntax-propertize functions, breaking backtrace and looking-at
Date: Thu, 12 Aug 2021 15:11:25 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> If I'm testing correctly,
>> 
>> (let ((inhibit-changing-match-data t)) (debug))
>> 
>> fails on both branches
>
> You are right, not sure what I did wrong when trying it a few moments
> ago.

It seems to fail reliably the first time executed, but after that it
only sometimes fails.  Below is the backtrace for the reliable breakage.

But...  I'm not sure this is supposed to work?  I mean, this is an
internal variable only supposed to be used in very limited
circumstances, and aren't ... particularly well defined.

But I see this was added in 2016:

7fb75680b38 (Noam Postavsky        2016-08-05  338)   /* If we are debugging an error while `inhibit-changing-match-data'
7fb75680b38 (Noam Postavsky        2016-08-05  339)      is bound to non-nil (e.g., within a call to `string-match-p'),
7fb75680b38 (Noam Postavsky        2016-08-05  340)      then make sure debugger code can still use match data.  */
7fb75680b38 (Noam Postavsky        2016-08-05  341)   specbind (Qinhibit_changing_match_data, Qnil);

To work around the problem.

`inhibit-changing-match-data' just seems like a bad interface to me.
Wouldn't it be better to change `looking-at' and `string-match' to allow
taking a parameter to not change the match data?  (And then just use
that in `looking-at-p'/`string-match-p'.)  That would avoid all these
weirdnesses...

Any opinions?

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  regexp-quote(nil)
  find-auto-coding("/home/larsi/src/emacs/trunk/lisp/emacs-lisp/cl-loa..." 48494)
  set-auto-coding("/home/larsi/src/emacs/trunk/lisp/emacs-lisp/cl-loa..." 48494)
  insert-file-contents("/home/larsi/src/emacs/trunk/lisp/emacs-lisp/cl-loa...")
  load-with-code-conversion("/home/larsi/src/emacs/trunk/lisp/emacs-lisp/cl-loa..." "/home/larsi/src/emacs/trunk/lisp/emacs-lisp/cl-loa..." t t)
  load("cl-loaddefs" noerror quiet)
  byte-code(... [provide cl-lib load "cl-loaddefs" noerror quiet require cl-macs cl-seq] 4)
  require(cl-lib)
  (debug)
  (let ((inhibit-changing-match-data t)) (debug))


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




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

Previous Next


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