bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35264: "Match data clobbered by buffer modification hooks" when hook


From: Lars Ingebrigtsen
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]