GNU bug report logs -
#61091
30.0.50; y-or-n-p clobbers match data
Previous Next
Reported by: rms <at> gnu.org
Date: Fri, 27 Jan 2023 04:06:02 UTC
Severity: normal
Found in version 30.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 61091 <at> debbugs.gnu.org (full text, mbox):
> From: Richard Stallman <rms <at> gnu.org>
> Date: Thu, 26 Jan 2023 23:05:10 -0500
>
> I find in some of my personal code that calls to y-or-n-p
> clobber the match data. That code worked ok when I first wrote it,
> and for several years after that. Putting (save-match-data...)
> around the call to y-or-n-p seems to fix it.
>
> Did some recent change cause y-or-n-p to do searches
> and not save the match data?
y-or-n-p originally was implemented in C and was relatively simple.
Since then it was moved to Lisp and became a monster, see subr.el. It
is anyone's guess where in that code we clobber the match data. Given
a test case, we could debug and find what does this, but is it really
worth our while? In general, Lisp programs should not rely on any
function not to clobber match data, unless that function is documented
to preserve match data.
This bug report was last modified 2 years and 135 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.