unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Noam Postavsky <npostavs@gmail.com>
Cc: stefan monnier <monnier@iro.umontreal.ca>, 35264@debbugs.gnu.org
Subject: bug#35264: "Match data clobbered by buffer modification hooks" when hooks only shifted match-data's markers
Date: Fri, 02 Oct 2020 06:47:55 +0200	[thread overview]
Message-ID: <87a6x5z11g.fsf@gnus.org> (raw)
In-Reply-To: <871s0f7det.fsf@gmail.com> (Noam Postavsky's message of "Thu, 30 May 2019 19:03:54 -0400")

Noam Postavsky <npostavs@gmail.com> writes:

>> I think this is a variant of Bug#23917, there was some talk there about
>> removing the check, perhaps that is the right solution.
>
> So, this, I guess.

[...]

> * src/search.c (Freplace_match): Don't test for change in search_regs
> start and end, this is unreliable if change hooks modify text earlier
> in the buffer.

[...]

> -  if (search_regs.start[sub] != sub_start
> -      || search_regs.end[sub] != sub_end
> -      || search_regs.num_regs != num_regs)
> +  if (search_regs.num_regs != num_regs)
>      error ("Match data clobbered by buffer modification hooks");
>  
>    /* Put point back where it was in the text.  */

There were unfortunately no comments on this patch at the time.  Noam said:

> But the modification hook in question did call save-match-data.  As far
> as I can tell, the problem is that the match-data consists of markers,
> whose position gets shifted by deletion of characters.  The check for
> this error uses simple integers, so there's no way it can account for
> this.

That does make sense, but removing this (somewhat buggy) sanity check is
perhaps a bit scary.  Any comments on this?

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





  reply	other threads:[~2020-10-02  4:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-14  4:40 bug#35264: "Match data clobbered by buffer modification hooks" when hooks only shifted match-data's markers Noam Postavsky
2019-05-30 23:03 ` Noam Postavsky
2020-10-02  4:47   ` Lars Ingebrigtsen [this message]
2021-05-12 14:35     ` Lars Ingebrigtsen
2021-05-12 14:55       ` Eli Zaretskii
2021-05-12 15:43         ` Lars Ingebrigtsen
2021-05-12 15:48           ` Eli Zaretskii
2021-05-12 15:57             ` Lars Ingebrigtsen
2021-05-12 16:03               ` Eli Zaretskii
2021-05-13  9:11                 ` Lars Ingebrigtsen
2021-05-13 10:14                   ` Eli Zaretskii
2021-05-13 16:03                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-13 17:09                       ` Eli Zaretskii
2021-05-16 13:20                 ` Lars Ingebrigtsen

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=87a6x5z11g.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=35264@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=npostavs@gmail.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).