GNU bug report logs - #36328
26.2; Args out of range on search-and-replace of *.cc file

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Jayden Navarro <jayden@HIDDEN>; Keywords: patch; dated Fri, 21 Jun 2019 23:11:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
bug Marked as fixed in versions 27.0.50. Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) patch. Request was from Juri Linkov <juri@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 5 Jul 2019 19:13:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 05 15:13:39 2019
Received: from localhost ([127.0.0.1]:53775 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hjTeN-00047i-Jm
	for submit <at> debbugs.gnu.org; Fri, 05 Jul 2019 15:13:39 -0400
Received: from egyptian.birch.relay.mailchannels.net ([23.83.209.56]:35356)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>)
 id 1hjTeM-00047X-LF; Fri, 05 Jul 2019 15:13:39 -0400
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 7D77421848;
 Fri,  5 Jul 2019 19:13:37 +0000 (UTC)
Received: from pdx1-sub0-mail-a47.g.dreamhost.com
 (100-96-14-11.trex.outbound.svc.cluster.local [100.96.14.11])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id F194421C6F;
 Fri,  5 Jul 2019 19:13:36 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a47.g.dreamhost.com ([TEMPUNAVAIL].
 [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384)
 by 0.0.0.0:2500 (trex/5.17.3); Fri, 05 Jul 2019 19:13:37 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Harmony-Coil: 5bcb147118cbe2ca_1562354017293_2436981310
X-MC-Loop-Signature: 1562354017293:1603166336
X-MC-Ingress-Time: 1562354017292
Received: from pdx1-sub0-mail-a47.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a47.g.dreamhost.com (Postfix) with ESMTP id 416EE83221;
 Fri,  5 Jul 2019 12:13:36 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=linkov.net; bh=yy1guu+aIFn2ZyOyOttpIEEHwb4=; b=
 HMjdleeIqLAambfhyPZJruqIs1HMWw8fyItk+JukYPchtDoArHsthFugVjKyPART
 V9ExMQpYFi6u4ZxzBHlP8jzjrIqjjKdJn/iMiPu/pWMqpFKE6oACPxCZRyuqTYDG
 Z8bOd3WPow+F5rQwJaRUbTtmCWDmeuFgg2qVnb5lsG8=
Received: from mail.jurta.org (m91-129-109-127.cust.tele2.ee [91.129.109.127])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
 bits)) (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a47.g.dreamhost.com (Postfix) with ESMTPSA id 0C61783224;
 Fri,  5 Jul 2019 12:13:30 -0700 (PDT)
X-DH-BACKEND: pdx1-sub0-mail-a47
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
Organization: LINKOV.NET
References: <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
 <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
 <20190623193258.GB4736@ACM> <87k1dc2e5h.fsf@HIDDEN>
 <20190624075218.GA4781@ACM> <87d0j27wiu.fsf@HIDDEN>
 <20190625094708.GB5471@ACM> <87lfxpzbb3.fsf@HIDDEN>
 <87ef35wlpg.fsf@HIDDEN> <831rz5au3q.fsf@HIDDEN>
Date: Fri, 05 Jul 2019 22:12:16 +0300
In-Reply-To: <831rz5au3q.fsf@HIDDEN> (Eli Zaretskii's message of "Fri, 05 Jul
 2019 09:11:37 +0300")
Message-ID: <87bly8pa7j.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrfeeggddufeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdelrdduvdejnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtledruddvjedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegvlhhiiiesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpeef
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: acm@HIDDEN, 36328 <at> debbugs.gnu.org, jayden@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

tags 36328 + patch
fixed 36328 27.0.50
thanks

>> Eli, do you think this fix should be pushed to emacs-26?
>
> I'd like to avoid any code changes on the branch that aren't 110%
> necessary.  We should release 26.3 ASAP, otherwise Emacs 27 will wait
> for too long.

OK, pushed to master in dde0320020.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 5 Jul 2019 06:11:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jul 05 02:11:55 2019
Received: from localhost ([127.0.0.1]:52249 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hjHRq-00015W-Li
	for submit <at> debbugs.gnu.org; Fri, 05 Jul 2019 02:11:54 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48169)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1hjHRn-00015I-Il
 for 36328 <at> debbugs.gnu.org; Fri, 05 Jul 2019 02:11:53 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:43595)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1hjHRh-0008Pw-Lp; Fri, 05 Jul 2019 02:11:45 -0400
Received: from [176.228.60.248] (port=1123 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1hjHRg-00031i-Tl; Fri, 05 Jul 2019 02:11:45 -0400
Date: Fri, 05 Jul 2019 09:11:37 +0300
Message-Id: <831rz5au3q.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
In-reply-to: <87ef35wlpg.fsf@HIDDEN> (message from Juri Linkov on
 Fri, 05 Jul 2019 00:09:47 +0300)
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
References: <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
 <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
 <20190623193258.GB4736@ACM> <87k1dc2e5h.fsf@HIDDEN>
 <20190624075218.GA4781@ACM> <87d0j27wiu.fsf@HIDDEN>
 <20190625094708.GB5471@ACM> <87lfxpzbb3.fsf@HIDDEN>
 <87ef35wlpg.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 36328
Cc: acm@HIDDEN, 36328 <at> debbugs.gnu.org, jayden@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Juri Linkov <juri@HIDDEN>
> Cc: Alan Mackenzie <acm@HIDDEN>,  Jayden Navarro <jayden@HIDDEN>,  36328 <at> debbugs.gnu.org
> Date: Fri, 05 Jul 2019 00:09:47 +0300
> 
> Eli, do you think this fix should be pushed to emacs-26?

I'd like to avoid any code changes on the branch that aren't 110%
necessary.  We should release 26.3 ASAP, otherwise Emacs 27 will wait
for too long.

Sorry.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 4 Jul 2019 21:11:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 04 17:11:34 2019
Received: from localhost ([127.0.0.1]:52032 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hj90v-0003Yx-Mm
	for submit <at> debbugs.gnu.org; Thu, 04 Jul 2019 17:11:33 -0400
Received: from aye.elm.relay.mailchannels.net ([23.83.212.6]:22802)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1hj90t-0003YK-H0
 for 36328 <at> debbugs.gnu.org; Thu, 04 Jul 2019 17:11:32 -0400
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 7B8F42C2544;
 Thu,  4 Jul 2019 21:11:30 +0000 (UTC)
Received: from pdx1-sub0-mail-a17.g.dreamhost.com
 (100-96-38-45.trex.outbound.svc.cluster.local [100.96.38.45])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id E6E8F2C257B;
 Thu,  4 Jul 2019 21:11:29 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a17.g.dreamhost.com ([TEMPUNAVAIL].
 [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384)
 by 0.0.0.0:2500 (trex/5.17.3); Thu, 04 Jul 2019 21:11:30 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Shade-Fumbling: 1be681c7091d7d42_1562274690303_3565070454
X-MC-Loop-Signature: 1562274690303:1932523968
X-MC-Ingress-Time: 1562274690303
Received: from pdx1-sub0-mail-a17.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a17.g.dreamhost.com (Postfix) with ESMTP id 7F9217F6C4;
 Thu,  4 Jul 2019 14:11:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=linkov.net; bh=KASTuyzy/DMZYPB3nG7SHybqDz0=; b=
 R9PzQ23yRySfYXmSNjLRZo+IFEiEbxxNg3ROai6Ol6NB3RrIcpakmvB3TeQmejBS
 j9E/Da8WSxWBSPYSLuMRSmJXlB3WvXFXQSNh/Zfo04W0iFQLEeeFWdRavGEaRYzo
 uVGZiTMUz2MUd7t7YsBexyPpAHrm0JdqzEocJjCCSuE=
Received: from mail.jurta.org (m91-129-109-127.cust.tele2.ee [91.129.109.127])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
 bits)) (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a17.g.dreamhost.com (Postfix) with ESMTPSA id DCF447F633;
 Thu,  4 Jul 2019 14:11:26 -0700 (PDT)
X-DH-BACKEND: pdx1-sub0-mail-a17
From: Juri Linkov <juri@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
Organization: LINKOV.NET
References: <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
 <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
 <20190623193258.GB4736@ACM> <87k1dc2e5h.fsf@HIDDEN>
 <20190624075218.GA4781@ACM> <87d0j27wiu.fsf@HIDDEN>
 <20190625094708.GB5471@ACM> <87lfxpzbb3.fsf@HIDDEN>
Date: Fri, 05 Jul 2019 00:09:47 +0300
In-Reply-To: <87lfxpzbb3.fsf@HIDDEN> (Juri Linkov's message of "Tue, 
 25 Jun 2019 22:58:56 +0300")
Message-ID: <87ef35wlpg.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrfedvgdduiedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdelrdduvdejnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtledruddvjedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegvlhhiiiesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: Alan Mackenzie <acm@HIDDEN>, 36328 <at> debbugs.gnu.org,
 Jayden Navarro <jayden@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli, do you think this fix should be pushed to emacs-26?

>> My feeling is that perform-replace (or, possibly, replace-highlight) is
>> the best place to put a save-match-data.
>
> Doing this in perform-replace means adding save-match-data in all places
> where replace-highlight is called, so maybe better to add it only once
> in replace-highlight like Jayden proposed initially.
>
> But then it's important to add an explanatory comment since
> the need of using of save-match-data is not self-evident here.
>
> Do you think this comment is clear enough?
>
> diff --git a/lisp/replace.el b/lisp/replace.el
> index 9d1b7bf747..50c74be8f6 100644
> --- a/lisp/replace.el
> +++ b/lisp/replace.el
> @@ -2316,7 +2316,11 @@ replace-highlight
>  	    (isearch-forward (not backward))
>  	    (isearch-other-end match-beg)
>  	    (isearch-error nil))
> -	(isearch-lazy-highlight-new-loop range-beg range-end))))
> +	(save-match-data
> +	  ;; Preserve match-data for perform-replace since
> +	  ;; isearch-lazy-highlight-new-loop calls `sit-for' that
> +	  ;; does redisplay that might clobber match data (bug#36328).
> +	  (isearch-lazy-highlight-new-loop range-beg range-end)))))
>  
>  (defun replace-dehighlight ()
>    (when replace-overlay
> diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
> index 307586f221..5af8170203 100644
> --- a/lisp/term/tty-colors.el
> +++ b/lisp/term/tty-colors.el
> @@ -820,7 +820,7 @@ tty-color-canonicalize
>    "Return COLOR in canonical form.
>  A canonicalized color name is all-lower case, with any blanks removed."
>    (let ((case-fold-search nil))
> -    (if (string-match "[A-Z ]" color)
> +    (if (string-match-p "[A-Z ]" color)
>  	(replace-regexp-in-string " +" "" (downcase color))
>        color)))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 25 Jun 2019 20:11:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 25 16:11:03 2019
Received: from localhost ([127.0.0.1]:33588 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfrmQ-0001ff-HI
	for submit <at> debbugs.gnu.org; Tue, 25 Jun 2019 16:11:02 -0400
Received: from brown.elm.relay.mailchannels.net ([23.83.212.23]:8976)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1hfrmM-0001fE-H6
 for 36328 <at> debbugs.gnu.org; Tue, 25 Jun 2019 16:10:59 -0400
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 6990B5E30D8;
 Tue, 25 Jun 2019 20:10:57 +0000 (UTC)
Received: from pdx1-sub0-mail-a33.g.dreamhost.com
 (100-96-91-148.trex.outbound.svc.cluster.local [100.96.91.148])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id D14E75E2DE3;
 Tue, 25 Jun 2019 20:10:56 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a33.g.dreamhost.com ([TEMPUNAVAIL].
 [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384)
 by 0.0.0.0:2500 (trex/5.17.2); Tue, 25 Jun 2019 20:10:57 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Trail-Snatch: 1ec1907d747b935f_1561493457219_1327411982
X-MC-Loop-Signature: 1561493457218:3712464975
X-MC-Ingress-Time: 1561493457218
Received: from pdx1-sub0-mail-a33.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a33.g.dreamhost.com (Postfix) with ESMTP id E611380AAA;
 Tue, 25 Jun 2019 13:10:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=linkov.net; bh=QFvYsHzA0HJ5Ik8Fnc/8JoCLzIE=; b=
 cQliaUPfkMUThleb/90ClBgaWpP9c9JlbdsiY2u/ulW3hh7LcZTsCLFeD8LD3+i2
 yhPDdACWjhmsgzTWpqsg1VzZOC+fPb0p38jWTb2PxMEcfN+JwwuCcGGMwbHR2CmI
 VSU7/XPRMMYniwWg1hdWCJJKWRmdjNA/VglH9qHSKJg=
Received: from mail.jurta.org (m91-129-109-209.cust.tele2.ee [91.129.109.209])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
 bits)) (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a33.g.dreamhost.com (Postfix) with ESMTPSA id 625E580A5B;
 Tue, 25 Jun 2019 13:10:49 -0700 (PDT)
X-DH-BACKEND: pdx1-sub0-mail-a33
From: Juri Linkov <juri@HIDDEN>
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
Organization: LINKOV.NET
References: <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
 <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
 <20190623193258.GB4736@ACM> <87k1dc2e5h.fsf@HIDDEN>
 <20190624075218.GA4781@ACM> <87d0j27wiu.fsf@HIDDEN>
 <20190625094708.GB5471@ACM>
Date: Tue, 25 Jun 2019 22:58:56 +0300
In-Reply-To: <20190625094708.GB5471@ACM> (Alan Mackenzie's message of "Tue, 25
 Jun 2019 09:47:08 +0000")
Message-ID: <87lfxpzbb3.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddrudeggddugeeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesmhdtreertdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdelrddvtdelnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtledrvddtledprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegrtghmsehmuhgtrdguvgenucevlhhushhtvghrufhiiigvpedu
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: Jayden Navarro <jayden@HIDDEN>, 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

Hello, Alan.

> My feeling is that perform-replace (or, possibly, replace-highlight) is
> the best place to put a save-match-data.

Doing this in perform-replace means adding save-match-data in all places
where replace-highlight is called, so maybe better to add it only once
in replace-highlight like Jayden proposed initially.

But then it's important to add an explanatory comment since
the need of using of save-match-data is not self-evident here.

Do you think this comment is clear enough?


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=replace-save-match-data.patch

diff --git a/lisp/replace.el b/lisp/replace.el
index 9d1b7bf747..50c74be8f6 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -2316,7 +2316,11 @@ replace-highlight
 	    (isearch-forward (not backward))
 	    (isearch-other-end match-beg)
 	    (isearch-error nil))
-	(isearch-lazy-highlight-new-loop range-beg range-end))))
+	(save-match-data
+	  ;; Preserve match-data for perform-replace since
+	  ;; isearch-lazy-highlight-new-loop calls `sit-for' that
+	  ;; does redisplay that might clobber match data (bug#36328).
+	  (isearch-lazy-highlight-new-loop range-beg range-end)))))
 
 (defun replace-dehighlight ()
   (when replace-overlay
diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
index 307586f221..5af8170203 100644
--- a/lisp/term/tty-colors.el
+++ b/lisp/term/tty-colors.el
@@ -820,7 +820,7 @@ tty-color-canonicalize
   "Return COLOR in canonical form.
 A canonicalized color name is all-lower case, with any blanks removed."
   (let ((case-fold-search nil))
-    (if (string-match "[A-Z ]" color)
+    (if (string-match-p "[A-Z ]" color)
 	(replace-regexp-in-string " +" "" (downcase color))
       color)))
 

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 25 Jun 2019 09:47:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 25 05:47:21 2019
Received: from localhost ([127.0.0.1]:58652 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfi2r-00059g-3k
	for submit <at> debbugs.gnu.org; Tue, 25 Jun 2019 05:47:21 -0400
Received: from colin.muc.de ([193.149.48.1]:61492 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1hfi2o-00059W-LZ
 for 36328 <at> debbugs.gnu.org; Tue, 25 Jun 2019 05:47:19 -0400
Received: (qmail 26932 invoked by uid 3782); 25 Jun 2019 09:47:10 -0000
Received: from acm.muc.de (p4FE15DD6.dip0.t-ipconnect.de [79.225.93.214]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Tue, 25 Jun 2019 11:47:08 +0200
Received: (qmail 5501 invoked by uid 1000); 25 Jun 2019 09:47:08 -0000
Date: Tue, 25 Jun 2019 09:47:08 +0000
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#36328: 26.2; Args out of range on search-and-replace of *.cc
 file
Message-ID: <20190625094708.GB5471@ACM>
References: <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
 <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
 <20190623193258.GB4736@ACM> <87k1dc2e5h.fsf@HIDDEN>
 <20190624075218.GA4781@ACM> <87d0j27wiu.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87d0j27wiu.fsf@HIDDEN>
User-Agent: Mutt/1.10.1 (2018-07-13)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: Jayden Navarro <jayden@HIDDEN>, 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Juri.

On Mon, Jun 24, 2019 at 22:18:53 +0300, Juri Linkov wrote:
> Hello, Alan.

> >> I think first we should try to narrow down the source of this match
> >> data leak.

> > Is there really such a thing as a match data leak?  I don't think
> > there's any convention that the match data are preserved over large
> > bits of code, particularly when different libraries are involved.
> > There is nothing documented in the Elisp manual that I can see.

> Yes, it seems such match-data leak is considered at least undesirable.
> I remember efforts to replace string-match with string-match-p in
> potentially unsafe places and to wrap more code in save-match-data.
> But I guess such efforts are futile since this task is endless.

I think so, too.  I remembered being puzzled in my early Emacs days,
wondering whether the save-match-data should go in the function which
messes it up, or the function which cares about it.

> Usually it's enough for a function that cares about preserving
> match-data to protect it from mutation.

I now think this is the best place to put save-match-data.

> >> Then we could decide what is the best solution.  Currently I see no
> >> such place in isearch-lazy-highlight-new-loop that calls external
> >> code.

> > isearch-lazy-highlight-new-loop calls (sit-for 0), which calls
> > redisplay, which calls font locking.

> You are right that it's too much to expect that the match-data will be
> preserved after redisplay, and we can't find and fix all places that
> change match-data, so save-match-data needs be added to perform-replace
> somewhere to protect match-data.

Yes, I think so.

> Since (sit-for 0) is unsafe for match-data, the first candidate to be
> wrapped in save-match-data is (sit-for 0) itself in
> isearch-lazy-highlight-new-loop.

> But perhaps more correct would be to use save-match-data in the same
> function that cares about preserving its match-data, so the second
> candidate to use save-match-data is perform-replace.  Then the need
> of using save-match-data will be self-evident for everyone who will
> look at the code in perform-replace: here we use match-data, and here
> we protect it in the same function.

My feeling is that perform-replace (or, possibly, replace-highlight) is
the best place to put a save-match-data.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 24 Jun 2019 20:03:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 24 16:03:51 2019
Received: from localhost ([127.0.0.1]:58072 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfVBv-0000rk-Bc
	for submit <at> debbugs.gnu.org; Mon, 24 Jun 2019 16:03:51 -0400
Received: from mail-lf1-f49.google.com ([209.85.167.49]:32947)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jayden@HIDDEN>) id 1hfVBs-0000rW-Rq
 for 36328 <at> debbugs.gnu.org; Mon, 24 Jun 2019 16:03:49 -0400
Received: by mail-lf1-f49.google.com with SMTP id y17so10975821lfe.0
 for <36328 <at> debbugs.gnu.org>; Mon, 24 Jun 2019 13:03:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=yugabyte-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=dGtgGtFeqpzA9FtuaRmwFcNxvJj4i93hC4zH6FL8gQY=;
 b=rrBn37JKbhnWSt1AI/tmUZXFyL0quKdkRU7VPoNOp2St2qL94pqYUDTDwI1JM4Eh7e
 Wi1pF0tlTESq4HguilgTLxI3464erkYWol0ag9heiltzHkaLhJJhRKoXKP5LhRaZkK8w
 AixpYsEkepQWc5Q36vRNN9GF5q48UGpsgjgYIsDKNUkGo5XGj0ReEJGlhQQ4DVkQ6ev1
 IG4J102McSm+OP5cPxlrjEHcA+tfsQw5gRRwXAy/nX9ZXl0dbz+kdVo8SzRT78Nh/Dmw
 gfIFxT19xRCoFlRN/4iJDqx3okmSJtqXA8D5cm9qMGibY10eQ0izfsvrqLT/1gN77FHW
 3N8Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=dGtgGtFeqpzA9FtuaRmwFcNxvJj4i93hC4zH6FL8gQY=;
 b=Sox8nQCj5Ij6GBFA4nk8ZmuO2QIsZ/DQedwxX3ZsNp1kJTnaw+H6FtUND733yZ+S1g
 qw3wfKoujCDrc35GjYeur3jGsv1Aur4RplfKbqVx9P+FFUSOY4HLpMHGQ8BA2QHF3kPd
 m4OjdqqkreyaZUgOA1CpGJA8jeWdSNvFrjrTtspanN33opeOzORBckKtIZ02rFEnnb7E
 qvpZWNtiQbCgY35iVAZUmEIos6Tb2BgwuInWvj0mN0pPsjCLX4XmywfEgs8CNrpdEI22
 vHOYJwocLZkEmoLWuZNJTiLJYdjOscoAXXdIsqr0DCmFlcdcSDU1Sg4pQAOGOWVFyTti
 ZJCg==
X-Gm-Message-State: APjAAAWmyUF2hnAyWjyPYbPc6FUXgqDhTwQzXZ1MD3BA8wQmNQQ/iQ/L
 /qQg5cIGyG/qV9gC5UXY3fk6j05/Gq/4AA0akYZwIw==
X-Google-Smtp-Source: APXvYqyaXNEBHnm9WjzIndTsDg3MrcE1Tw5w9y5Jei0gIhfhrudZlWhGeanowQ80BLgLqPo4SfSBEZyLYXroGHXV7+A=
X-Received: by 2002:ac2:4152:: with SMTP id c18mr26783850lfi.144.1561406622765; 
 Mon, 24 Jun 2019 13:03:42 -0700 (PDT)
MIME-Version: 1.0
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
 <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
 <20190623193258.GB4736@ACM> <87k1dc2e5h.fsf@HIDDEN>
 <CAEKiUEYnhHgw9gB8wnzWB5P0dv6yB6NCvt7F48ZGJrxxH-HydQ@HIDDEN>
 <87ef3i7wiz.fsf@HIDDEN>
In-Reply-To: <87ef3i7wiz.fsf@HIDDEN>
From: Jayden Navarro <jayden@HIDDEN>
Date: Mon, 24 Jun 2019 13:03:31 -0700
Message-ID: <CAEKiUEaP0JSi_t1Qe-Svap0GOe9zqtQEjH6-eHk+Pqz3Z8U53A@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
To: Juri Linkov <juri@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000019aa3d058c174f41"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: Alan Mackenzie <acm@HIDDEN>, 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--00000000000019aa3d058c174f41
Content-Type: text/plain; charset="UTF-8"

Hi Juri,

Thank you very much for the detailed test case.
> Previously I tried in the MATE terminal emulator,
> but xterm-256color was an essential detail indeed.
> Now I was able to reproduce with TERM="xterm-256color"
> and to track down the source of this problem.
>
> It happens while the color "ForestGreen" is loaded for
> the face font-lock-type-face that has this definition:
>
>   (((class color) (min-colors 16) (background light))
>    :foreground "ForestGreen")
>
> by tty-color-canonicalize.
>
> Could you please try this patch to see if it fixes the problem:
>
> diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
> index 307586f221..5af8170203 100644
> --- a/lisp/term/tty-colors.el
> +++ b/lisp/term/tty-colors.el
> @@ -820,7 +820,7 @@ tty-color-canonicalize
>    "Return COLOR in canonical form.
>  A canonicalized color name is all-lower case, with any blanks removed."
>    (let ((case-fold-search nil))
> -    (if (string-match "[A-Z ]" color)
> +    (if (string-match-p "[A-Z ]" color)
>         (replace-regexp-in-string " +" "" (downcase color))
>        color)))
>

Thank you for root-causing this! The patch you provided does indeed fix the
issue for me.

Best,
Jayden

--00000000000019aa3d058c174f41
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Hi Juri,</div><div dir=3D"ltr"><br></div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">Thank you very much for t=
he detailed test case.<br>Previously I tried in the MATE terminal emulator,=
<br>but xterm-256color was an essential detail indeed.<br>Now I was able to=
 reproduce with TERM=3D&quot;xterm-256color&quot;<br>and to track down the =
source of this problem.<br><br>It happens while the color &quot;ForestGreen=
&quot; is loaded for<br>the face font-lock-type-face that has this definiti=
on:<br><br>=C2=A0 (((class color) (min-colors 16) (background light))<br>=
=C2=A0 =C2=A0:foreground &quot;ForestGreen&quot;)<br><br>by tty-color-canon=
icalize.<br><br>Could you please try this patch to see if it fixes the prob=
lem:<br><br>diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el<=
br>index 307586f221..5af8170203 100644<br>--- a/lisp/term/tty-colors.el<br>=
+++ b/lisp/term/tty-colors.el<br>@@ -820,7 +820,7 @@ tty-color-canonicalize=
<br>=C2=A0 =C2=A0&quot;Return COLOR in canonical form.<br>=C2=A0A canonical=
ized color name is all-lower case, with any blanks removed.&quot;<br>=C2=A0=
 =C2=A0(let ((case-fold-search nil))<br>-=C2=A0 =C2=A0 (if (string-match &q=
uot;[A-Z ]&quot; color)<br>+=C2=A0 =C2=A0 (if (string-match-p &quot;[A-Z ]&=
quot; color)<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 (replace-regexp-in-string &quot=
; +&quot; &quot;&quot; (downcase color))<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0colo=
r)))<br></blockquote><div dir=3D"ltr"><br></div><div dir=3D"ltr">Thank you =
for root-causing this! The patch you provided does indeed fix the issue for=
 me.<div><div dir=3D"ltr" class=3D"gmail_signature" data-smartmail=3D"gmail=
_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><br></div><div dir=3D"lt=
r">Best,<div>Jayden</div></div></div></div></div></div></div></div>

--00000000000019aa3d058c174f41--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 24 Jun 2019 19:21:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 24 15:21:17 2019
Received: from localhost ([127.0.0.1]:58012 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfUWi-0003no-WC
	for submit <at> debbugs.gnu.org; Mon, 24 Jun 2019 15:21:17 -0400
Received: from beige.elm.relay.mailchannels.net ([23.83.212.16]:64092)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1hfUWg-0003nd-R0
 for 36328 <at> debbugs.gnu.org; Mon, 24 Jun 2019 15:21:15 -0400
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id B1EB81A2D58;
 Mon, 24 Jun 2019 19:21:13 +0000 (UTC)
Received: from pdx1-sub0-mail-a62.g.dreamhost.com
 (100-96-28-110.trex.outbound.svc.cluster.local [100.96.28.110])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 058771A28A8;
 Mon, 24 Jun 2019 19:21:13 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a62.g.dreamhost.com ([TEMPUNAVAIL].
 [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384)
 by 0.0.0.0:2500 (trex/5.17.2); Mon, 24 Jun 2019 19:21:13 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Blushing-Harbor: 067f68ae51c9b44d_1561404073385_2401807788
X-MC-Loop-Signature: 1561404073385:603578010
X-MC-Ingress-Time: 1561404073385
Received: from pdx1-sub0-mail-a62.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a62.g.dreamhost.com (Postfix) with ESMTP id 58282818FE;
 Mon, 24 Jun 2019 12:21:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=linkov.net; bh=IslkyALSgMi9jPrvcVwl0/qh6Ns=; b=
 l18I55g4hh1kuxbtiHVteIJ9WSTFpO602gVjo0SdRGQEaLUnPVa14pGYorOlw607
 +H8HP7qbKyS5D+rbHPijnDxYQ7qXei0y/VPJCVpP0j+EAy8QxBU8kuRon4n5ETGh
 zAjyLmqpIvAqLPuEcpm/Qw7cF28N/VYkY97IFN2D+XM=
Received: from mail.jurta.org (m91-129-109-209.cust.tele2.ee [91.129.109.209])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
 bits)) (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a62.g.dreamhost.com (Postfix) with ESMTPSA id BD14481902;
 Mon, 24 Jun 2019 12:21:06 -0700 (PDT)
X-DH-BACKEND: pdx1-sub0-mail-a62
From: Juri Linkov <juri@HIDDEN>
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
Organization: LINKOV.NET
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
 <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
 <20190623193258.GB4736@ACM> <87k1dc2e5h.fsf@HIDDEN>
 <20190624075218.GA4781@ACM>
Date: Mon, 24 Jun 2019 22:18:53 +0300
In-Reply-To: <20190624075218.GA4781@ACM> (Alan Mackenzie's message of "Mon, 24
 Jun 2019 07:52:18 +0000")
Message-ID: <87d0j27wiu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddruddvgddugedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdelrddvtdelnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtledrvddtledprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegrtghmsehmuhgtrdguvgenucevlhhushhtvghrufhiiigvpedu
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: Jayden Navarro <jayden@HIDDEN>, 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Alan.

>> I think first we should try to narrow down the source of this match
>> data leak.
>
> Is there really such a thing as a match data leak?  I don't think there's
> any convention that the match data are preserved over large bits of code,
> particularly when different libraries are involved.  There is nothing
> documented in the Elisp manual that I can see.

Yes, it seems such match-data leak is considered at least undesirable.
I remember efforts to replace string-match with string-match-p in
potentially unsafe places and to wrap more code in save-match-data.
But I guess such efforts are futile since this task is endless.

Usually it's enough for a function that cares about preserving match-data
to protect it from mutation.

>> Then we could decide what is the best solution.  Currently I see no
>> such place in isearch-lazy-highlight-new-loop that calls external code.
>
> isearch-lazy-highlight-new-loop calls (sit-for 0), which calls redisplay,
> which calls font locking.

You are right that it's too much to expect that the match-data will be
preserved after redisplay, and we can't find and fix all places that
change match-data, so save-match-data needs be added to perform-replace
somewhere to protect match-data.

Since (sit-for 0) is unsafe for match-data, the first candidate to be
wrapped in save-match-data is (sit-for 0) itself in isearch-lazy-highlight-new-loop.

But perhaps more correct would be to use save-match-data in the same
function that cares about preserving its match-data, so the second
candidate to use save-match-data is perform-replace.  Then the need
of using save-match-data will be self-evident for everyone who will
look at the code in perform-replace: here we use match-data, and here
we protect it in the same function.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 24 Jun 2019 19:21:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 24 15:21:10 2019
Received: from localhost ([127.0.0.1]:58009 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfUWc-0003nS-MJ
	for submit <at> debbugs.gnu.org; Mon, 24 Jun 2019 15:21:10 -0400
Received: from cadetblue.birch.relay.mailchannels.net ([23.83.209.28]:60247)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1hfUWX-0003nF-K0
 for 36328 <at> debbugs.gnu.org; Mon, 24 Jun 2019 15:21:08 -0400
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 49033503374;
 Mon, 24 Jun 2019 19:21:04 +0000 (UTC)
Received: from pdx1-sub0-mail-a62.g.dreamhost.com
 (100-96-28-110.trex.outbound.svc.cluster.local [100.96.28.110])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 74FF3503045;
 Mon, 24 Jun 2019 19:21:03 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a62.g.dreamhost.com ([TEMPUNAVAIL].
 [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384)
 by 0.0.0.0:2500 (trex/5.17.2); Mon, 24 Jun 2019 19:21:04 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Tank-Shelf: 018b448c7831cd48_1561404064050_1468834572
X-MC-Loop-Signature: 1561404064050:4136405097
X-MC-Ingress-Time: 1561404064050
Received: from pdx1-sub0-mail-a62.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a62.g.dreamhost.com (Postfix) with ESMTP id B0909818FE;
 Mon, 24 Jun 2019 12:21:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=linkov.net; bh=mYopdSsuYHDnJTuPVAmwHXnrsOE=; b=
 YDABjJCp41CAoaC0Cw74Jf+coZHNZ6kN51+BCedv0BN+3tZ6G1zIup4Uq5rwSzIe
 18qHsLvuwP4vkQr2TXmoWnOBGOSwe2uJpw7+fZulh1vBtA9iT3u34t8TeF9CtWAC
 sbrbBqxOOKoz6DBv8UtRUUYEgXtoZP1hqR0tebN4KDg=
Received: from mail.jurta.org (m91-129-109-209.cust.tele2.ee [91.129.109.209])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
 bits)) (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a62.g.dreamhost.com (Postfix) with ESMTPSA id 4706281902;
 Mon, 24 Jun 2019 12:20:59 -0700 (PDT)
X-DH-BACKEND: pdx1-sub0-mail-a62
From: Juri Linkov <juri@HIDDEN>
To: Jayden Navarro <jayden@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
Organization: LINKOV.NET
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
 <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
 <20190623193258.GB4736@ACM> <87k1dc2e5h.fsf@HIDDEN>
 <CAEKiUEYnhHgw9gB8wnzWB5P0dv6yB6NCvt7F48ZGJrxxH-HydQ@HIDDEN>
Date: Mon, 24 Jun 2019 22:05:48 +0300
In-Reply-To: <CAEKiUEYnhHgw9gB8wnzWB5P0dv6yB6NCvt7F48ZGJrxxH-HydQ@HIDDEN>
 (Jayden Navarro's message of "Sun, 23 Jun 2019 14:42:48 -0700")
Message-ID: <87ef3i7wiz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddruddvgddugedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdelrddvtdelnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddtledrvddtledprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehjrgihuggvnheshihughgrsgihthgvrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: Alan Mackenzie <acm@HIDDEN>, 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Jayden,

Thank you very much for the detailed test case.
Previously I tried in the MATE terminal emulator,
but xterm-256color was an essential detail indeed.
Now I was able to reproduce with TERM="xterm-256color"
and to track down the source of this problem.

It happens while the color "ForestGreen" is loaded for
the face font-lock-type-face that has this definition:

  (((class color) (min-colors 16) (background light))
   :foreground "ForestGreen")

by tty-color-canonicalize.

Could you please try this patch to see if it fixes the problem:

diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
index 307586f221..5af8170203 100644
--- a/lisp/term/tty-colors.el
+++ b/lisp/term/tty-colors.el
@@ -820,7 +820,7 @@ tty-color-canonicalize
   "Return COLOR in canonical form.
 A canonicalized color name is all-lower case, with any blanks removed."
   (let ((case-fold-search nil))
-    (if (string-match "[A-Z ]" color)
+    (if (string-match-p "[A-Z ]" color)
 	(replace-regexp-in-string " +" "" (downcase color))
       color)))
 

> Hi Juri,
>
> Did you open it with TERM="xterm-256color"?
>
> Best,
> Jayden
>
> On Sun, Jun 23, 2019 at 2:41 PM Juri Linkov <juri@HIDDEN> wrote:
>
>> I think first we should try to narrow down the source of this match data
>> leak.
>> Then we could decide what is the best solution.  Currently I see no such
>> place
>> in isearch-lazy-highlight-new-loop that calls external code.  OTOH, while
>> looking at CC-Mode I noticed that it does some matches on before-change
>> hooks.
>> I could debug it but can't reproduce neither in 26.1 nor in 27, even with
>> -Q -nw.
>>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 24 Jun 2019 07:52:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 24 03:52:25 2019
Received: from localhost ([127.0.0.1]:55486 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfJm5-0007BK-6Q
	for submit <at> debbugs.gnu.org; Mon, 24 Jun 2019 03:52:25 -0400
Received: from colin.muc.de ([193.149.48.1]:21960 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1hfJm4-0007BA-5c
 for 36328 <at> debbugs.gnu.org; Mon, 24 Jun 2019 03:52:24 -0400
Received: (qmail 17122 invoked by uid 3782); 24 Jun 2019 07:52:19 -0000
Received: from acm.muc.de (p4FE15E6F.dip0.t-ipconnect.de [79.225.94.111]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Mon, 24 Jun 2019 09:52:18 +0200
Received: (qmail 4791 invoked by uid 1000); 24 Jun 2019 07:52:18 -0000
Date: Mon, 24 Jun 2019 07:52:18 +0000
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#36328: 26.2; Args out of range on search-and-replace of *.cc
 file
Message-ID: <20190624075218.GA4781@ACM>
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
 <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
 <20190623193258.GB4736@ACM> <87k1dc2e5h.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <87k1dc2e5h.fsf@HIDDEN>
User-Agent: Mutt/1.10.1 (2018-07-13)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: Jayden Navarro <jayden@HIDDEN>, 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Juri.

On Mon, Jun 24, 2019 at 00:19:22 +0300, Juri Linkov wrote:
> >> Until this is officially fixed I've come up with the following workaround,
> >> going off of the details you provided:

> >> I created a "replace_fixed.el" file in "~/.emacs.d/lisp/" that is
> >> replace.el taken from
> >> https://raw.githubusercontent.com/emacs-mirror/emacs/emacs-26/lisp/replace.el
> >> with
> >> the following diff:

> >> diff --git a/replace.el b/replace_fixed.el
> >> index 08feb8e..8280fdd 100644
> >> --- a/replace.el
> >> +++ b/replace_fixed.el
> >> @@ -2227,7 +2227,7 @@ It is called with three arguments, as if it were
> >>             (isearch-forward (not backward))
> >>             (isearch-other-end match-beg)
> >>             (isearch-error nil))
> >> -       (isearch-lazy-highlight-new-loop range-beg range-end))))
> >> +       (save-match-data (isearch-lazy-highlight-new-loop range-beg
> >> range-end)))))

> >>  (defun replace-dehighlight ()
> >>    (when replace-overlay

> >> Then I added the following to my "~/.emacs", restarted my emacs server, and
> >> the issue was gone!:

> >> (load-library "~/.emacs.d/lisp/replace_fixed.el")

> >> This probably isn't the proper fix, but just thought I'd share in case
> >> anyone else is experiencing this and wanted a temporary workaround.

> > Excellent!  To be honest, I was thinking of sending just that workaround
> > to you as a temporary patch, but it seems I didn't need to.  :-)

> > That might well be the fix we end up putting into Emacs, but it might
> > not be.  Sorry we're so slow, here.

> I think first we should try to narrow down the source of this match
> data leak.

Is there really such a thing as a match data leak?  I don't think there's
any convention that the match data are preserved over large bits of code,
particularly when different libraries are involved.  There is nothing
documented in the Elisp manual that I can see.

> Then we could decide what is the best solution.  Currently I see no
> such place in isearch-lazy-highlight-new-loop that calls external code.

isearch-lazy-highlight-new-loop calls (sit-for 0), which calls redisplay,
which calls font locking.

> OTOH, while looking at CC-Mode I noticed that it does some matches on
> before-change hooks.

The bulk of c-before-change is inside a save-match-data, as is the bulk
of c-after-change.  Other entry points (such as
c-font-lock-fontify-region) aren't enclosed in save-match-data.

> I could debug it but can't reproduce neither in 26.1 nor in 27, even
> with -Q -nw.

For what it's worth, I only saw the bug in X Windows, immediately after
starting emacs with emacs -Q -nw.  A second try with M-% (after the first
one has failed) just works.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 23 Jun 2019 21:43:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 23 17:43:09 2019
Received: from localhost ([127.0.0.1]:55117 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfAGT-00014N-37
	for submit <at> debbugs.gnu.org; Sun, 23 Jun 2019 17:43:09 -0400
Received: from mail-lf1-f54.google.com ([209.85.167.54]:35954)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jayden@HIDDEN>) id 1hfAGQ-00013r-Iq
 for 36328 <at> debbugs.gnu.org; Sun, 23 Jun 2019 17:43:07 -0400
Received: by mail-lf1-f54.google.com with SMTP id q26so8565380lfc.3
 for <36328 <at> debbugs.gnu.org>; Sun, 23 Jun 2019 14:43:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=yugabyte-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=DFmRXBFARJKN8+9hS/s3f+5/YeyGXVqOqrJSn/IAZA0=;
 b=eCVIzWBSTMfAS+fN8/YjLXtkhSftuoFPlXFsEGFD433ezOv66HGyrG/VrsEjgWgWAE
 xuzJrJT/SkGAOITOaJVuMi1x1j7hTF/Rzv3NIALmXS7UEk7FVIDn0o5I/ENtazQ8YMii
 YkR40GWhrR83NVkBEYcbM+fjUREXwHlvHPC00A6IoyXk4A3fMaJMFj81kds+gMGxd4Yx
 vPhP+bBGkcYsAepeh4Z1EDipifiWfGUEV6Z4Gd14YabPWW2ApLm8f22Icz8VRYEHfDTG
 lvJVW+0OuhAAl7u0SqSn2o+6T7rBfSWhlTqFRglxLGrSET+/HSzg0ZJNQv8zIAUloaLn
 3azw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=DFmRXBFARJKN8+9hS/s3f+5/YeyGXVqOqrJSn/IAZA0=;
 b=qJGzAanhMNABQCeuBGMZX2JF7r38vI8vOiQaoIIpGcFk7DITFdGQL0vSJI2gYup3q1
 ucix6tDtN9jeJ1tiPhZ8/klsls8B79jC/HzQgEAkihRaRnAv0/SPa/6Af8193F0xNtrb
 J7B/TDAFwx1GdDzIpQSP7lijjkEvWPNDYaHHXZGfO/59HgGAmUaYYqr/pQD/5g+29/Gl
 aKgleXE0FHXRAfDQSQuudR8QPILtl2pclFLx/9g2OglUdEYYRoTooadPA8BMiVl26w1J
 CNQeV1heylNbuMcuVvObkKJ+BC+fXigwCmKEjIIFLSy7RdYmWxwD7WWYx5hdqpjfJaTy
 UwKA==
X-Gm-Message-State: APjAAAWH3/pWgDy6RzS9V5KbonVUrWwj6Q8FXEXEuhEtB0k0KNh2y4u6
 E7WbRyZILHHHUVHCRSlfKPtn7hkCDdmrjWxZX6L92A==
X-Google-Smtp-Source: APXvYqyvs/IVcqK6EviWczhug1U4EdrVTGN78CoufSFR8KybQdaZsjfJvSPGxcwg8qnRWl/h4gm5LD9vp6jjJzo9CKw=
X-Received: by 2002:a19:8c06:: with SMTP id o6mr9764315lfd.176.1561326180372; 
 Sun, 23 Jun 2019 14:43:00 -0700 (PDT)
MIME-Version: 1.0
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
 <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
 <20190623193258.GB4736@ACM> <87k1dc2e5h.fsf@HIDDEN>
In-Reply-To: <87k1dc2e5h.fsf@HIDDEN>
From: Jayden Navarro <jayden@HIDDEN>
Date: Sun, 23 Jun 2019 14:42:48 -0700
Message-ID: <CAEKiUEYnhHgw9gB8wnzWB5P0dv6yB6NCvt7F48ZGJrxxH-HydQ@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
To: Juri Linkov <juri@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000005c22b5058c0494b2"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: Alan Mackenzie <acm@HIDDEN>, 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--0000000000005c22b5058c0494b2
Content-Type: text/plain; charset="UTF-8"

Hi Juri,

Did you open it with TERM="xterm-256color"?

Best,
Jayden


On Sun, Jun 23, 2019 at 2:41 PM Juri Linkov <juri@HIDDEN> wrote:

> >> Until this is officially fixed I've come up with the following
> workaround,
> >> going off of the details you provided:
> >
> >> I created a "replace_fixed.el" file in "~/.emacs.d/lisp/" that is
> >> replace.el taken from
> >>
> https://raw.githubusercontent.com/emacs-mirror/emacs/emacs-26/lisp/replace.el
> >> with
> >> the following diff:
> >
> >> diff --git a/replace.el b/replace_fixed.el
> >> index 08feb8e..8280fdd 100644
> >> --- a/replace.el
> >> +++ b/replace_fixed.el
> >> @@ -2227,7 +2227,7 @@ It is called with three arguments, as if it were
> >>             (isearch-forward (not backward))
> >>             (isearch-other-end match-beg)
> >>             (isearch-error nil))
> >> -       (isearch-lazy-highlight-new-loop range-beg range-end))))
> >> +       (save-match-data (isearch-lazy-highlight-new-loop range-beg
> >> range-end)))))
> >
> >>  (defun replace-dehighlight ()
> >>    (when replace-overlay
> >
> >> Then I added the following to my "~/.emacs", restarted my emacs server,
> and
> >> the issue was gone!:
> >
> >> (load-library "~/.emacs.d/lisp/replace_fixed.el")
> >
> >> This probably isn't the proper fix, but just thought I'd share in case
> >> anyone else is experiencing this and wanted a temporary workaround.
> >
> > Excellent!  To be honest, I was thinking of sending just that workaround
> > to you as a temporary patch, but it seems I didn't need to.  :-)
> >
> > That might well be the fix we end up putting into Emacs, but it might
> > not be.  Sorry we're so slow, here.
>
> I think first we should try to narrow down the source of this match data
> leak.
> Then we could decide what is the best solution.  Currently I see no such
> place
> in isearch-lazy-highlight-new-loop that calls external code.  OTOH, while
> looking at CC-Mode I noticed that it does some matches on before-change
> hooks.
> I could debug it but can't reproduce neither in 26.1 nor in 27, even with
> -Q -nw.
>

--0000000000005c22b5058c0494b2
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Juri,<div><br></div><div>Did you open it with TERM=3D&q=
uot;xterm-256color&quot;?<br clear=3D"all"><div><div dir=3D"ltr" class=3D"g=
mail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div><d=
iv dir=3D"ltr"><br></div><div dir=3D"ltr">Best,<div>Jayden</div></div></div=
></div></div></div><br></div></div><br><div class=3D"gmail_quote"><div dir=
=3D"ltr" class=3D"gmail_attr">On Sun, Jun 23, 2019 at 2:41 PM Juri Linkov &=
lt;<a href=3D"mailto:juri@HIDDEN">juri@HIDDEN</a>&gt; wrote:<br></d=
iv><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bord=
er-left:1px solid rgb(204,204,204);padding-left:1ex">&gt;&gt; Until this is=
 officially fixed I&#39;ve come up with the following workaround,<br>
&gt;&gt; going off of the details you provided:<br>
&gt;<br>
&gt;&gt; I created a &quot;replace_fixed.el&quot; file in &quot;~/.emacs.d/=
lisp/&quot; that is<br>
&gt;&gt; replace.el taken from<br>
&gt;&gt; <a href=3D"https://raw.githubusercontent.com/emacs-mirror/emacs/em=
acs-26/lisp/replace.el" rel=3D"noreferrer" target=3D"_blank">https://raw.gi=
thubusercontent.com/emacs-mirror/emacs/emacs-26/lisp/replace.el</a><br>
&gt;&gt; with<br>
&gt;&gt; the following diff:<br>
&gt;<br>
&gt;&gt; diff --git a/replace.el b/replace_fixed.el<br>
&gt;&gt; index 08feb8e..8280fdd 100644<br>
&gt;&gt; --- a/replace.el<br>
&gt;&gt; +++ b/replace_fixed.el<br>
&gt;&gt; @@ -2227,7 +2227,7 @@ It is called with three arguments, as if it =
were<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(isearch-forward (n=
ot backward))<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(isearch-other-end =
match-beg)<br>
&gt;&gt;=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(isearch-error nil)=
)<br>
&gt;&gt; -=C2=A0 =C2=A0 =C2=A0 =C2=A0(isearch-lazy-highlight-new-loop range=
-beg range-end))))<br>
&gt;&gt; +=C2=A0 =C2=A0 =C2=A0 =C2=A0(save-match-data (isearch-lazy-highlig=
ht-new-loop range-beg<br>
&gt;&gt; range-end)))))<br>
&gt;<br>
&gt;&gt;=C2=A0 (defun replace-dehighlight ()<br>
&gt;&gt;=C2=A0 =C2=A0 (when replace-overlay<br>
&gt;<br>
&gt;&gt; Then I added the following to my &quot;~/.emacs&quot;, restarted m=
y emacs server, and<br>
&gt;&gt; the issue was gone!:<br>
&gt;<br>
&gt;&gt; (load-library &quot;~/.emacs.d/lisp/replace_fixed.el&quot;)<br>
&gt;<br>
&gt;&gt; This probably isn&#39;t the proper fix, but just thought I&#39;d s=
hare in case<br>
&gt;&gt; anyone else is experiencing this and wanted a temporary workaround=
.<br>
&gt;<br>
&gt; Excellent!=C2=A0 To be honest, I was thinking of sending just that wor=
karound<br>
&gt; to you as a temporary patch, but it seems I didn&#39;t need to.=C2=A0 =
:-)<br>
&gt;<br>
&gt; That might well be the fix we end up putting into Emacs, but it might<=
br>
&gt; not be.=C2=A0 Sorry we&#39;re so slow, here.<br>
<br>
I think first we should try to narrow down the source of this match data le=
ak.<br>
Then we could decide what is the best solution.=C2=A0 Currently I see no su=
ch place<br>
in isearch-lazy-highlight-new-loop that calls external code.=C2=A0 OTOH, wh=
ile<br>
looking at CC-Mode I noticed that it does some matches on before-change hoo=
ks.<br>
I could debug it but can&#39;t reproduce neither in 26.1 nor in 27, even wi=
th -Q -nw.<br>
</blockquote></div>

--0000000000005c22b5058c0494b2--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 23 Jun 2019 21:41:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 23 17:41:30 2019
Received: from localhost ([127.0.0.1]:55088 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hfAEr-0000za-R9
	for submit <at> debbugs.gnu.org; Sun, 23 Jun 2019 17:41:30 -0400
Received: from bonobo.birch.relay.mailchannels.net ([23.83.209.22]:10144)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1hfAEp-0000zM-Ju
 for 36328 <at> debbugs.gnu.org; Sun, 23 Jun 2019 17:41:28 -0400
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 17922141818;
 Sun, 23 Jun 2019 21:41:26 +0000 (UTC)
Received: from pdx1-sub0-mail-a96.g.dreamhost.com
 (100-96-85-75.trex.outbound.svc.cluster.local [100.96.85.75])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 4F6891414BD;
 Sun, 23 Jun 2019 21:41:25 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a96.g.dreamhost.com ([TEMPUNAVAIL].
 [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384)
 by 0.0.0.0:2500 (trex/5.17.2); Sun, 23 Jun 2019 21:41:26 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Zesty-Broad: 37a7f30970641059_1561326085917_1252289177
X-MC-Loop-Signature: 1561326085917:1274837065
X-MC-Ingress-Time: 1561326085917
Received: from pdx1-sub0-mail-a96.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a96.g.dreamhost.com (Postfix) with ESMTP id 0A17B80C87;
 Sun, 23 Jun 2019 14:41:20 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc
 :subject:references:date:in-reply-to:message-id:mime-version
 :content-type; s=linkov.net; bh=+uXwmAz7pvBNXVxkwHBMLgs7I2M=; b=
 l0bTAeagMI2uYDoll6nwgbKXdHSOkSbqMN//IKFl22JcX19ckRcNonGkphlarQRN
 ceLIyo05jxieX5+60RBso62PHOu7mAIj8pjBeZ94Hi5lTAm/wYZwydycNq81H+nZ
 9tNFh0Cpzrev7hPskAy6pQiUIPi+yncRJ/C1xBuQetM=
Received: from mail.jurta.org (m91-129-109-209.cust.tele2.ee [91.129.109.209])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
 bits)) (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a96.g.dreamhost.com (Postfix) with ESMTPSA id B1F9D80C95;
 Sun, 23 Jun 2019 14:41:15 -0700 (PDT)
X-DH-BACKEND: pdx1-sub0-mail-a96
From: Juri Linkov <juri@HIDDEN>
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
Organization: LINKOV.NET
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
 <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
 <20190623193258.GB4736@ACM>
Date: Mon, 24 Jun 2019 00:19:22 +0300
In-Reply-To: <20190623193258.GB4736@ACM> (Alan Mackenzie's message of "Sun, 23
 Jun 2019 19:32:58 +0000")
Message-ID: <87k1dc2e5h.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduvddruddugddtudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuffhomhgrihhnpehgihhthhhusghushgvrhgtohhnthgvnhhtrdgtohhmnecukfhppeeluddruddvledruddtledrvddtleenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrddutdelrddvtdelpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtoheprggtmhesmhhutgdruggvnecuvehluhhsthgvrhfuihiivgeptd
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: Jayden Navarro <jayden@HIDDEN>, 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> Until this is officially fixed I've come up with the following workaround,
>> going off of the details you provided:
>
>> I created a "replace_fixed.el" file in "~/.emacs.d/lisp/" that is
>> replace.el taken from
>> https://raw.githubusercontent.com/emacs-mirror/emacs/emacs-26/lisp/replace.el
>> with
>> the following diff:
>
>> diff --git a/replace.el b/replace_fixed.el
>> index 08feb8e..8280fdd 100644
>> --- a/replace.el
>> +++ b/replace_fixed.el
>> @@ -2227,7 +2227,7 @@ It is called with three arguments, as if it were
>>             (isearch-forward (not backward))
>>             (isearch-other-end match-beg)
>>             (isearch-error nil))
>> -       (isearch-lazy-highlight-new-loop range-beg range-end))))
>> +       (save-match-data (isearch-lazy-highlight-new-loop range-beg
>> range-end)))))
>
>>  (defun replace-dehighlight ()
>>    (when replace-overlay
>
>> Then I added the following to my "~/.emacs", restarted my emacs server, and
>> the issue was gone!:
>
>> (load-library "~/.emacs.d/lisp/replace_fixed.el")
>
>> This probably isn't the proper fix, but just thought I'd share in case
>> anyone else is experiencing this and wanted a temporary workaround.
>
> Excellent!  To be honest, I was thinking of sending just that workaround
> to you as a temporary patch, but it seems I didn't need to.  :-)
>
> That might well be the fix we end up putting into Emacs, but it might
> not be.  Sorry we're so slow, here.

I think first we should try to narrow down the source of this match data leak.
Then we could decide what is the best solution.  Currently I see no such place
in isearch-lazy-highlight-new-loop that calls external code.  OTOH, while
looking at CC-Mode I noticed that it does some matches on before-change hooks.
I could debug it but can't reproduce neither in 26.1 nor in 27, even with -Q -nw.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 23 Jun 2019 20:11:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 23 16:11:00 2019
Received: from localhost ([127.0.0.1]:54697 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hf8pH-0008NN-Jn
	for submit <at> debbugs.gnu.org; Sun, 23 Jun 2019 16:11:00 -0400
Received: from colin.muc.de ([193.149.48.1]:63736 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1hf8pF-0008ND-32
 for 36328 <at> debbugs.gnu.org; Sun, 23 Jun 2019 16:10:58 -0400
Received: (qmail 65650 invoked by uid 3782); 23 Jun 2019 20:10:51 -0000
Received: from acm.muc.de (p2E5D5B98.dip0.t-ipconnect.de [46.93.91.152]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Sun, 23 Jun 2019 22:10:50 +0200
Received: (qmail 23735 invoked by uid 1000); 23 Jun 2019 20:10:48 -0000
Date: Sun, 23 Jun 2019 20:10:48 +0000
To: Juri Linkov <juri@HIDDEN>
Subject: [jayden@HIDDEN: Re: bug#36328: 26.2; Args out of range on
 search-and-replace of *.cc file]
Message-ID: <20190623201048.GC4736@ACM>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.10.1 (2018-07-13)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: Jayden Navarro <jayden@HIDDEN>, 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Juri.

As the replace.el expert here, could you please have a look at bug
#36328, and in particular, comment on Jayden's patch (below), which I
think would be a good fix for the bug.

Is there anything we've missed, such as unforeseen and unwanted effects
somewhere else?

Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).


----- Forwarded message from Jayden Navarro <jayden@HIDDEN> -----

X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on f9b3f715-3f29-11e8-b508-002264fbbacc
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=yugabyte-com.20150623.gappssmtp.com; s=20150623;        h=mime-version:references:in-reply-to:from:date:message-id:subject:to         :cc;
	bh=eZM1FmYPfQWqIxfpYI+vG/ojcQEm248LbjE6PiQr8CE=;        b=2ELl2xbqAuUFiUbRfNinSQfbRbxhWgpTsLbHINR3oKe37wJPYbt4LoKqFc2wo7uEjo         79POKqduJ+PerwW+epBOAGP8zeqwAUNnKG7F/TMvPYixI8qh+oz6qQ7MuJfhtfc7ZVuw
	h1jiPQYSnJXkTMtZJZk3n+2RrKo4rRKbQQ4wrT+fq1ihZB8F3xVdbz3pGmLLmD0wwOzm         Qr+tYUtR9ix6yDSKq+Jr5JS/Rmh3kH8HDq67OpFwWYHSClPjGxzGTJQWEn5JqEoR6bL6         agHOiamb4rXFNvDdxyd70EaOQ5cNNHfRlpODk1suZdZpoCfX8FpYcdcepmixs/qx/PAF
	Fbhw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20161025;        h=x-gm-message-state:mime-version:references:in-reply-to:from:date         :message-id:subject:to:cc;
	bh=eZM1FmYPfQWqIxfpYI+vG/ojcQEm248LbjE6PiQr8CE=;        b=I3nt5jWknsKit8BXYashILtTd3kbV+DPx6pTHDgPZW6ZtzX87SzXiuwGZoczrJXsD3         cNss+BZVBJtZLFTsIC74LkWhtYh2OCdU3o5TG7TQ0SQqyQJ+FwWOfAMyBOVi4GvTJCLA
	Wg9rokIiwKUR6O+DvD0M+gpepHhc0NlW4iAeOrGaIb/jerwNticHF0MRdRSL2DKQ5nrH         fbMnO+5+nHEmIU2tUpd8EYqqHZQByXJfaKu7UKUJ/g1uCwbE5/SX401kslfM5ckl8xAC         5TJi08H4w3MKAGDzHJQrLdau7YoowFGZHvy1b0QiO7KjLDtRJ7HWVEu9TH3UUnILKg1r
	r90g==
X-Gm-Message-State: APjAAAW9vckX+zTLPd5fU5sesgvGsywasM/voob85fK5EyMnJsiEqvlv +R4mtzsBALaEP8quUhVW6AZS2FgQuzeq+SsPVGjXoAsw9sg=
X-Google-Smtp-Source: APXvYqxMxLxnGbgDBDwO7TQTe8IgNSSsQVMZ9S4j4kjCIGq7xdMYxG9J7kbLnxz35VR1RawX6tIm+0sJqHRqhftmU/c=
X-Received: by 2002:a2e:3913:: with SMTP id g19mr15782122lja.212.1561306471058; Sun, 23 Jun 2019 09:14:31 -0700 (PDT)
From: Jayden Navarro <jayden@HIDDEN>
Date: Sun, 23 Jun 2019 09:14:19 -0700
Subject: Re: bug#36328: 26.2; Args out of range on search-and-replace of *.cc file
To: Alan Mackenzie <acm@HIDDEN>
Cc: 36328 <at> debbugs.gnu.org

Hi Alan,

Thank you for looking into this!

Until this is officially fixed I've come up with the following workaround,
going off of the details you provided:

I created a "replace_fixed.el" file in "~/.emacs.d/lisp/" that is
replace.el taken from
https://raw.githubusercontent.com/emacs-mirror/emacs/emacs-26/lisp/replace.el
with
the following diff:

diff --git a/replace.el b/replace_fixed.el
index 08feb8e..8280fdd 100644
--- a/replace.el
+++ b/replace_fixed.el
@@ -2227,7 +2227,7 @@ It is called with three arguments, as if it were
            (isearch-forward (not backward))
            (isearch-other-end match-beg)
            (isearch-error nil))
-       (isearch-lazy-highlight-new-loop range-beg range-end))))
+       (save-match-data (isearch-lazy-highlight-new-loop range-beg
range-end)))))

 (defun replace-dehighlight ()
   (when replace-overlay

Then I added the following to my "~/.emacs", restarted my emacs server, and
the issue was gone!:

(load-library "~/.emacs.d/lisp/replace_fixed.el")

This probably isn't the proper fix, but just thought I'd share in case
anyone else is experiencing this and wanted a temporary workaround.

Best,
Jayden

----- End forwarded message -----




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 23 Jun 2019 19:33:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 23 15:33:08 2019
Received: from localhost ([127.0.0.1]:54669 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hf8Ee-0007Br-AR
	for submit <at> debbugs.gnu.org; Sun, 23 Jun 2019 15:33:08 -0400
Received: from colin.muc.de ([193.149.48.1]:63247 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1hf8Ec-0007Bg-5l
 for 36328 <at> debbugs.gnu.org; Sun, 23 Jun 2019 15:33:07 -0400
Received: (qmail 52112 invoked by uid 3782); 23 Jun 2019 19:33:01 -0000
Received: from acm.muc.de (p2E5D5B98.dip0.t-ipconnect.de [46.93.91.152]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Sun, 23 Jun 2019 21:33:00 +0200
Received: (qmail 23591 invoked by uid 1000); 23 Jun 2019 19:32:58 -0000
Date: Sun, 23 Jun 2019 19:32:58 +0000
To: Jayden Navarro <jayden@HIDDEN>
Subject: Re: bug#36328: 26.2; Args out of range on search-and-replace of *.cc
 file
Message-ID: <20190623193258.GB4736@ACM>
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
 <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
User-Agent: Mutt/1.10.1 (2018-07-13)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Jayden.

On Sun, Jun 23, 2019 at 09:14:19 -0700, Jayden Navarro wrote:
> Hi Alan,

> Thank you for looking into this!

> Until this is officially fixed I've come up with the following workaround,
> going off of the details you provided:

> I created a "replace_fixed.el" file in "~/.emacs.d/lisp/" that is
> replace.el taken from
> https://raw.githubusercontent.com/emacs-mirror/emacs/emacs-26/lisp/replace.el
> with
> the following diff:

> diff --git a/replace.el b/replace_fixed.el
> index 08feb8e..8280fdd 100644
> --- a/replace.el
> +++ b/replace_fixed.el
> @@ -2227,7 +2227,7 @@ It is called with three arguments, as if it were
>             (isearch-forward (not backward))
>             (isearch-other-end match-beg)
>             (isearch-error nil))
> -       (isearch-lazy-highlight-new-loop range-beg range-end))))
> +       (save-match-data (isearch-lazy-highlight-new-loop range-beg
> range-end)))))

>  (defun replace-dehighlight ()
>    (when replace-overlay

> Then I added the following to my "~/.emacs", restarted my emacs server, and
> the issue was gone!:

> (load-library "~/.emacs.d/lisp/replace_fixed.el")

> This probably isn't the proper fix, but just thought I'd share in case
> anyone else is experiencing this and wanted a temporary workaround.

Excellent!  To be honest, I was thinking of sending just that workaround
to you as a temporary patch, but it seems I didn't need to.  :-)

That might well be the fix we end up putting into Emacs, but it might
not be.  Sorry we're so slow, here.

Have a great afternoon!  I'll be off to bed, soon.

Thanks for taking the trouble to report this bug.

> Best,
> Jayden

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 23 Jun 2019 16:14:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 23 12:14:39 2019
Received: from localhost ([127.0.0.1]:54151 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hf58Z-00020R-Jk
	for submit <at> debbugs.gnu.org; Sun, 23 Jun 2019 12:14:39 -0400
Received: from mail-lj1-f182.google.com ([209.85.208.182]:39556)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jayden@HIDDEN>) id 1hf58X-000208-3l
 for 36328 <at> debbugs.gnu.org; Sun, 23 Jun 2019 12:14:37 -0400
Received: by mail-lj1-f182.google.com with SMTP id v18so10237839ljh.6
 for <36328 <at> debbugs.gnu.org>; Sun, 23 Jun 2019 09:14:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=yugabyte-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=eZM1FmYPfQWqIxfpYI+vG/ojcQEm248LbjE6PiQr8CE=;
 b=2ELl2xbqAuUFiUbRfNinSQfbRbxhWgpTsLbHINR3oKe37wJPYbt4LoKqFc2wo7uEjo
 79POKqduJ+PerwW+epBOAGP8zeqwAUNnKG7F/TMvPYixI8qh+oz6qQ7MuJfhtfc7ZVuw
 h1jiPQYSnJXkTMtZJZk3n+2RrKo4rRKbQQ4wrT+fq1ihZB8F3xVdbz3pGmLLmD0wwOzm
 Qr+tYUtR9ix6yDSKq+Jr5JS/Rmh3kH8HDq67OpFwWYHSClPjGxzGTJQWEn5JqEoR6bL6
 agHOiamb4rXFNvDdxyd70EaOQ5cNNHfRlpODk1suZdZpoCfX8FpYcdcepmixs/qx/PAF
 Fbhw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=eZM1FmYPfQWqIxfpYI+vG/ojcQEm248LbjE6PiQr8CE=;
 b=p2+Pl5vVuYursxD41lCfp11nQ5ZTEscjwaaNIZcmBoqxz49w8iwkZdyHJggHoXxwaG
 B0fZ55oOuJBihTEALbytcGrSq5XErrSOnNrSQ+PKxZpKWZ9pHWrhWW6EY+drrCR5V5qU
 aHczszv563kXDO8KxwO2/bB/E64BflXtEEnDKrfHHftvZzu3VrcmCtYf+SsIxoi4m1mh
 NbG12PTi96pv6uKZPciIA6UMm/CxZVIuU95TjYfMTZFn2F6G0wpFCYpWr4sOwXiiADz0
 2lZZY4tTevDi0cB0/keqxtzo/9XtPpLFfiRIuhx7jsy7kLG4SOCsW7vpZU2fiqwwE2Rv
 IrVg==
X-Gm-Message-State: APjAAAW4bdve+1pmQuQx7XkNeLvp1oaG5D0aFmT3tPheQqK6+eZZ/QIT
 nEhDyMQXpzQLv4XspG37lrbDE1urnbxKLL0rC8mBnQ==
X-Google-Smtp-Source: APXvYqxMxLxnGbgDBDwO7TQTe8IgNSSsQVMZ9S4j4kjCIGq7xdMYxG9J7kbLnxz35VR1RawX6tIm+0sJqHRqhftmU/c=
X-Received: by 2002:a2e:3913:: with SMTP id g19mr15782122lja.212.1561306471058; 
 Sun, 23 Jun 2019 09:14:31 -0700 (PDT)
MIME-Version: 1.0
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
 <20190623122207.GA4736@ACM>
In-Reply-To: <20190623122207.GA4736@ACM>
From: Jayden Navarro <jayden@HIDDEN>
Date: Sun, 23 Jun 2019 09:14:19 -0700
Message-ID: <CAEKiUEZy4scEedt=3vcP=2e-9yr6cqW4QYk98DK-ajGwf_hJrA@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
To: Alan Mackenzie <acm@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000097e646058bfffdb0"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--00000000000097e646058bfffdb0
Content-Type: text/plain; charset="UTF-8"

Hi Alan,

Thank you for looking into this!

Until this is officially fixed I've come up with the following workaround,
going off of the details you provided:

I created a "replace_fixed.el" file in "~/.emacs.d/lisp/" that is
replace.el taken from
https://raw.githubusercontent.com/emacs-mirror/emacs/emacs-26/lisp/replace.el
with
the following diff:

diff --git a/replace.el b/replace_fixed.el
index 08feb8e..8280fdd 100644
--- a/replace.el
+++ b/replace_fixed.el
@@ -2227,7 +2227,7 @@ It is called with three arguments, as if it were
            (isearch-forward (not backward))
            (isearch-other-end match-beg)
            (isearch-error nil))
-       (isearch-lazy-highlight-new-loop range-beg range-end))))
+       (save-match-data (isearch-lazy-highlight-new-loop range-beg
range-end)))))

 (defun replace-dehighlight ()
   (when replace-overlay

Then I added the following to my "~/.emacs", restarted my emacs server, and
the issue was gone!:

(load-library "~/.emacs.d/lisp/replace_fixed.el")

This probably isn't the proper fix, but just thought I'd share in case
anyone else is experiencing this and wanted a temporary workaround.

Best,
Jayden

--00000000000097e646058bfffdb0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Hi Alan,</div><div dir=3D"ltr"><br></div>=
<div dir=3D"ltr">Thank you for looking into this!=C2=A0</div><div dir=3D"lt=
r"><br></div><div dir=3D"ltr">Until this is officially fixed I&#39;ve come =
up with the following workaround, going off of the details you provided:</d=
iv><div dir=3D"ltr"><br></div><div dir=3D"ltr">I created a &quot;replace_fi=
xed.el&quot; file in &quot;~/.emacs.d/lisp/&quot; that is replace.el taken =
from=C2=A0<a href=3D"https://raw.githubusercontent.com/emacs-mirror/emacs/e=
macs-26/lisp/replace.el">https://raw.githubusercontent.com/emacs-mirror/ema=
cs/emacs-26/lisp/replace.el</a>=C2=A0with the following diff:</div><div dir=
=3D"ltr"><br></div><div dir=3D"ltr"><font face=3D"courier new, monospace">d=
iff --git a/replace.el b/replace_fixed.el<br>index 08feb8e..8280fdd 100644<=
br>--- a/replace.el<br>+++ b/replace_fixed.el<br>@@ -2227,7 +2227,7 @@ It i=
s called with three arguments, as if it were<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 (isearch-forward (not backward))<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 (isearch-other-end match-beg)<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 (isearch-error nil))<br>- =C2=A0 =C2=A0 =C2=A0 (isearch-l=
azy-highlight-new-loop range-beg range-end))))<br>+ =C2=A0 =C2=A0 =C2=A0 (s=
ave-match-data (isearch-lazy-highlight-new-loop range-beg range-end)))))<br=
><br>=C2=A0(defun replace-dehighlight ()<br>=C2=A0 =C2=A0(when replace-over=
lay</font></div><div dir=3D"ltr"><font face=3D"courier new, monospace"><br>=
</font></div><div dir=3D"ltr"><font face=3D"arial, sans-serif">Then I added=
 the following to my &quot;~/.emacs&quot;, restarted my emacs server, and t=
he issue was gone!:</font></div><div dir=3D"ltr"><font face=3D"arial, sans-=
serif"><br></font></div><div dir=3D"ltr"><font face=3D"courier new, monospa=
ce">(load-library &quot;~/.emacs.d/lisp/replace_fixed.el&quot;)</font><font=
 face=3D"arial, sans-serif"><br clear=3D"all"></font><div><div dir=3D"ltr" =
class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"lt=
r"><div dir=3D"ltr"><br></div><div>This probably isn&#39;t the proper fix, =
but just thought I&#39;d share in case anyone else is experiencing this and=
 wanted a temporary workaround.</div><div dir=3D"ltr"><br></div><div dir=3D=
"ltr">Best,<div>Jayden</div></div></div></div></div></div></div>

--00000000000097e646058bfffdb0--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 23 Jun 2019 12:22:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jun 23 08:22:14 2019
Received: from localhost ([127.0.0.1]:52990 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hf1Ve-0000GC-LQ
	for submit <at> debbugs.gnu.org; Sun, 23 Jun 2019 08:22:14 -0400
Received: from colin.muc.de ([193.149.48.1]:26704 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1hf1VZ-0000Fz-Vi
 for 36328 <at> debbugs.gnu.org; Sun, 23 Jun 2019 08:22:10 -0400
Received: (qmail 37261 invoked by uid 3782); 23 Jun 2019 12:22:08 -0000
Received: from acm.muc.de (p2E5D5B98.dip0.t-ipconnect.de [46.93.91.152]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Sun, 23 Jun 2019 14:22:07 +0200
Received: (qmail 5768 invoked by uid 1000); 23 Jun 2019 12:22:07 -0000
Date: Sun, 23 Jun 2019 12:22:07 +0000
To: Jayden Navarro <jayden@HIDDEN>
Subject: Re: bug#36328: 26.2; Args out of range on search-and-replace of *.cc
 file
Message-ID: <20190623122207.GA4736@ACM>
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
User-Agent: Mutt/1.10.1 (2018-07-13)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Jayden.

On Sat, Jun 22, 2019 at 15:38:25 -0700, Jayden Navarro wrote:
> I've figured out the trigger! I setup a CentOS 7 VM and installed Emacs
> 26.2.90 and couldn't repro on it. So I compared all the environment
> variables between Cygwin and the VM and performed some tests, and
> discovered the issue is triggered by my "TERM" environment variable being
> set to "xterm-256color".

Well done!

> I could reproduce on the clean VM using: TERM="xterm-256color" emacs -Q
> test.cc

In my X-Windows setup, an xterm has the setting of TERM anyway.  So I was
able to reproduce the failure with emacs -Q -nw.  -nw means "no windows",
i.e. run in the terminal, not as a GUI application.  (Normally, I run
Emacs in a linux virtual terminal.)

> Launching Emacs in that way, and following the other steps given above,
> should allow you to reproduce.

Yes.  It didn't take me too long to track down where it's going wrong.
`perform-replace' calls `replace-highlight' to highlight the "foo", and
this calls `isearch-lazy-highlight-new-loop'.  This in its turn performs
a redisplay (which is probably where CC Mode affects things).  It seems
too much to expect that the "match-data" will be preserved over all this
activity, but `perform-replace' does expect this.

To fix this will involve putting a `save-match-data' around some form
somewhere.  Please allow us some time to decide where this would be best.

> On Sat, Jun 22, 2019 at 2:27 PM Jayden Navarro <jayden@HIDDEN> wrote:

> > Hi Alan,

> > Yes, you are completely correct :-) Posted one thing but unintentionally
> > took a "shortcut" when producing the backtrace (not a smart thing to do
> > when trying to get people to repro...).

> > Here's the backtrace when doing doing M-% foo <RET> bar <RET> (note that
> > it's still 0, 1 not 0, 3!):

I still have no specific idea what's generating that 0 and 1.  Will
probably never find out.

> > Debugger entered--Lisp error: (args-out-of-range #<buffer test.cc> 0 1)
> >   buffer-substring-no-properties(0 1)
> >   perform-replace("foo" "bar" t nil nil nil nil nil nil nil nil)
> >   query-replace("foo" "bar" nil nil nil nil nil)
> >   funcall-interactively(query-replace "foo" "bar" nil nil nil nil nil)
> >   call-interactively(query-replace nil nil)
> >   command-execute(query-replace)

> Best,
> Jayden

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 22 Jun 2019 23:03:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 19:03:05 2019
Received: from localhost ([127.0.0.1]:52675 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hep2G-0001dp-UV
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2019 19:03:05 -0400
Received: from mail-lj1-f181.google.com ([209.85.208.181]:40416)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jayden@HIDDEN>) id 1hep2F-0001dH-6l
 for 36328 <at> debbugs.gnu.org; Sat, 22 Jun 2019 19:03:03 -0400
Received: by mail-lj1-f181.google.com with SMTP id a21so9131268ljh.7
 for <36328 <at> debbugs.gnu.org>; Sat, 22 Jun 2019 16:03:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=yugabyte-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=sYQrW0Byee0T7MKao5P1+C29iZdwNDKUQuMjcuC9pu0=;
 b=dhh5cQBCSGkWHSmxE5zxK8Gu4lvgqV+M9OuHy0hcpxUc+SUOso2rPzcZb5syM1IbeU
 aovqzbJ5pkuDiUsz+CwnoaiKrNmPd9nJbkJGg03gt43N04Hpm9PqxiZ7UECEvDnT1JTx
 3w+ACwP7T3MPSqU1Cunw1D7AbsTbCsN3L4iaNRsUNfA4E+UC+n/96B5fvoUxehbkF9db
 Vr3P/wEKjTUCUKO34UDklFwsnmPyAa9BgGrUdmz+Y3ABk7fwY9hJ1TTY5LRpqxHZeuXe
 /is2pT7DpSi4niLhtbmvnYQ3iE8fozk54ZDVQDZ0FV2XhiTjXrCEKhANItr8FqoEvnhe
 C9TQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=sYQrW0Byee0T7MKao5P1+C29iZdwNDKUQuMjcuC9pu0=;
 b=tw0anX8mota1+XiWzxTQzpEsov0ovCYIfyRhFOH8lmRB7QplSY1XolCpWfYLwtdpbM
 QKetvJwV3gplUpr72ecG5FL6UP7K6lt86yfsja9CvOCdh1vir9KP7m5cEaAFv3l+Eu9O
 +H6ZU4P0d4fJvsr0rI71eDWy/v/EI4BegjNWrSEOa/wbGyfHkZkvqhFFuUT2rzs8LS9P
 MtT7rleX+/nLfEP2YOe23/7PLsn4C/PEsRnfCToo3OQ2QQzcGQRL+zhU8JycKhdPJ5YI
 ye1QZXX8Z7u8onqnMmfx0yrLPXd3asi9rTaR0BV/aDgQ2NYJrjacRoUYy0tOoRBdtaGv
 IjMA==
X-Gm-Message-State: APjAAAVpGkESgP5R4lPOnlDlNenLjfpQ02u7yQHMYWhtu/zgBI7LkFxi
 oQ/+h/yet4RB0rDZ63bA0STNse77t/pmJgSTyR3Ihg==
X-Google-Smtp-Source: APXvYqwIW6LcCtuZbykZFib9/juQFf0AuOeNJ25jyqE2voDKMLIyJeHpeu0fhPyDkwHrut+GlgkXom5TGd4Iqxv0RfI=
X-Received: by 2002:a2e:9d07:: with SMTP id t7mr70137658lji.43.1561244577167; 
 Sat, 22 Jun 2019 16:02:57 -0700 (PDT)
MIME-Version: 1.0
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
 <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
In-Reply-To: <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
From: Jayden Navarro <jayden@HIDDEN>
Date: Sat, 22 Jun 2019 16:02:45 -0700
Message-ID: <CAEKiUEZtmbY2Vy+_DPy9LHjzPL_ZuF+N_+mmEPwhUTgmU8U2uA@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
To: Alan Mackenzie <acm@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000006e0cf3058bf1944a"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--0000000000006e0cf3058bf1944a
Content-Type: text/plain; charset="UTF-8"

Just also wanted to add that I tried this with test.java (java-mode) and
reproduced the issue as well (whereas no issue when using test.py), so it
definitely seems CcMode related.

Also, I reproduced with "xterm-16color" and all the other
"xterm-[0-9]+color" terminal types, but no other terminal types I tried
reproduced the problem, including regular "xterm-color".

Best,
Jayden

--0000000000006e0cf3058bf1944a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Just also wanted to add that I tried this=
 with test.java (java-mode) and reproduced the issue as well (whereas no is=
sue when using test.py), so it definitely seems CcMode related.=C2=A0<div><=
br></div><div>Also, I reproduced with &quot;xterm-16color&quot; and all the=
 other &quot;xterm-[0-9]+color&quot; terminal types, but no other terminal =
types I tried reproduced the problem, including regular &quot;xterm-color&q=
uot;.</div><div><br></div><div>Best,</div><div>Jayden</div></div></div>

--0000000000006e0cf3058bf1944a--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 22 Jun 2019 22:38:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 18:38:47 2019
Received: from localhost ([127.0.0.1]:52661 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1heoek-0007KY-FO
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2019 18:38:46 -0400
Received: from mail-lf1-f46.google.com ([209.85.167.46]:39986)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jayden@HIDDEN>) id 1heoeh-0007KK-63
 for 36328 <at> debbugs.gnu.org; Sat, 22 Jun 2019 18:38:45 -0400
Received: by mail-lf1-f46.google.com with SMTP id a9so7422060lff.7
 for <36328 <at> debbugs.gnu.org>; Sat, 22 Jun 2019 15:38:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=yugabyte-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=I3R57NPqAb+LJLLBHXfo0zOY8FkrTOPc95scL6eMN3w=;
 b=DcfB9u1eqXD6eeHU4GZUZWmzZS27Khh4jBOIgY2pxQU0QdgH3VD1v6nTbGu6qJfI7z
 cfNQGrBfxb9zY63ioHvTEoFVgXC2yb3Ljw143SNjfiMmX+cfTg3OFbqBdRRDD7rxscOg
 Hkq4w+dTEjeO865zURHUObLe3flr4CKe/JaNWyvDiJppg5XAb4NW3pmDfbvOgx5XBc/Z
 FGCF22ZsSc5iMgI/h+J62bikjjpAG+VrQE2ajTAHJvr68h9j70qAExSgn8bqyYOXxDix
 VkoMM0coUxCytyShxrBlIMF8vzrHeJd27//jTeIMHvaZzXKcn4PhTOHJ5PEGuga2iBbz
 Mcgw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=I3R57NPqAb+LJLLBHXfo0zOY8FkrTOPc95scL6eMN3w=;
 b=QolVvU43C+KLMGSRxM3loKXo/H6MqttvyJevdo2lwAp8B+DKUxxtl1IgHhxP0KFaUK
 dd+wJZ883d0raeBADhBaut/jeB2SSEfKyzdNyv/KYZ4HEhWX2Fz/ZTImcwljF5gY0trC
 7Tpod0bjriP8dKRwAQO/S/OAR0Rbtawmj3VcGDVj/pRI5Sz1kgYAsf3PYqIsVKdnPWrK
 Zf/aTFBGAvg1LS1FrrI35rp9U2XoPaU5p8UxCfTiKMesWAm+/VVDM7hYvd03zNN0qslT
 7BDVN0zyO48qlXNVf/MDgr1Y0wPDR/VzU1Ql/fjjCSl1Syu0o7/EW3T4XQ+pTLgyLYNN
 81pQ==
X-Gm-Message-State: APjAAAVoS+QTotiyaYdvIUj22KzO6OcqOUrvKCs8GtPICk1aiTfzXwcy
 qluDUOG78K6JlJTVquoOkeKB/jkjTQThOMmbg7k4VQ==
X-Google-Smtp-Source: APXvYqxlSFRsyQDA08b40+5BcBhtP+gNYfOcbMjLmWlfK/X/Y9vgF6Id2kHny1R6MHfRetYpz2mJrD5BKP59z4mu4SA=
X-Received: by 2002:ac2:494f:: with SMTP id o15mr42223663lfi.84.1561243117031; 
 Sat, 22 Jun 2019 15:38:37 -0700 (PDT)
MIME-Version: 1.0
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
 <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
In-Reply-To: <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
From: Jayden Navarro <jayden@HIDDEN>
Date: Sat, 22 Jun 2019 15:38:25 -0700
Message-ID: <CAEKiUEZmeWxAs7=D5NBAP8mRgreu30Xf13e1JDgoW7AssgDDPw@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
To: Alan Mackenzie <acm@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000662939058bf13db9"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000662939058bf13db9
Content-Type: text/plain; charset="UTF-8"

I've figured out the trigger! I setup a CentOS 7 VM and installed Emacs
26.2.90 and couldn't repro on it. So I compared all the environment
variables between Cygwin and the VM and performed some tests, and
discovered the issue is triggered by my "TERM" environment variable being
set to "xterm-256color".

I could reproduce on the clean VM using: TERM="xterm-256color" emacs -Q
test.cc

Launching Emacs in that way, and following the other steps given above,
should allow you to reproduce.

Best,
Jayden


On Sat, Jun 22, 2019 at 2:27 PM Jayden Navarro <jayden@HIDDEN> wrote:

> Hi Alan,
>
> Yes, you are completely correct :-) Posted one thing but unintentionally
> took a "shortcut" when producing the backtrace (not a smart thing to do
> when trying to get people to repro...).
>
> Here's the backtrace when doing doing M-% foo <RET> bar <RET> (note that
> it's still 0, 1 not 0, 3!):
>
> Debugger entered--Lisp error: (args-out-of-range #<buffer test.cc> 0 1)
>   buffer-substring-no-properties(0 1)
>   perform-replace("foo" "bar" t nil nil nil nil nil nil nil nil)
>   query-replace("foo" "bar" nil nil nil nil nil)
>   funcall-interactively(query-replace "foo" "bar" nil nil nil nil nil)
>   call-interactively(query-replace nil nil)
>   command-execute(query-replace)
>
> Thank you for your help!
>
> Best,
> Jayden
>
>
> On Sat, Jun 22, 2019 at 1:50 PM Alan Mackenzie <acm@HIDDEN> wrote:
>
>> Hello again, Jayden.
>>
>> On Sat, Jun 22, 2019 at 07:25:30 -0700, Jayden Navarro wrote:
>> > Hello Alan,
>>
>> > Thank you for your response. Apologies for the ambiguous steps. Please
>> find
>> > more detailed information below:
>>
>> Thanks!
>>
>> > Here are the steps:
>>
>> > 1. Open a file in c++-mode (e.g. emacs -Q test.cc).
>>
>> > 2. Add 100 lines of some string (e.g. the word "bar" on every line for
>> 100
>> > lines, no quotes in the actual file):
>>
>> > bar
>> > bar
>> > bar
>> > bar
>> > ...
>> > bar
>>
>> > 3. Add a unique string to line 101 (e.g. the word "foo", no quotes in
>> the
>> > actual file).
>>
>> > bar
>> > bar
>> > bar
>> > bar
>> > ...
>> > bar
>> > foo
>> > <INCLUDE NEWLINE AT END OF FILE>
>>
>> > 4. Close Emacs
>>
>> > 5. Open up the file again: emacs -Q test.cc
>>
>> > 6. Replace the unique string with some other string: M-x query-replace
>> > <RET> foo <RET> bar <RET>
>>
>> Are you _sure_ that's what you typed?  ;-)
>>
>> > 7. You should hit: Args out of range: #<buffer test.cc>, 0, 1
>>
>> > Here's the backtrace when using debug-on-error:
>>
>> > Debugger entered--Lisp error: (args-out-of-range #<buffer test.cc> 0 1)
>> >   buffer-substring-no-properties(0 1)  <==============================
>> >   perform-replace("foo" "a" t nil nil nil nil nil nil nil nil)
>> >   query-replace("foo" "a" nil nil nil nil nil)
>> >   funcall-interactively(query-replace "foo" "a" nil nil nil nil nil)
>> >   call-interactively(query-replace nil nil)
>> >   command-execute(query-replace)
>>
>> There, it looks like you are trying to replace "foo" by "a".  I'm
>> interested in the (invalid) arguments 0, 1 passed to
>> buffer-substring-no-properties.  I suspect that these are derived from
>> the "match-data" for a string, in particular for the string "a".
>>
>> Could you please repeat the bug scenario, but this time try to replace
>> "foo" by "bar".  I predict you will then get the error message
>>
>>     (args-out-of-range #<buffer test.cc> 0 3)
>>
>> since the replacement string will then be 3 characters long.
>>
>> If that does indeed happen, it would be a very strong clue as to the
>> underlying bug.  Please try it as above, and post the backtrace here.
>> Thanks!
>>
>> [ .... ]
>>
>> > Here's the list of packages I have installed under $HOME/.emacs.d/elpa:
>>
>> > avy-0.3.0
>> > company-20181105.2312
>> > company-lean-20171102.1454
>> > dash-20180910.1856
>> > dash-functional-20180107.1618
>> > epl-20180205.2049
>> > f-20180106.922
>> > flycheck-20181127.1510
>> > gnupg
>> > go-mode-1.3.1
>> > haskell-mode-13.16
>> > lean-mode-20180906.1645
>> > pkg-info-20150517.1143
>> > rust-mode-20181008.1628
>> > s-20180406.808
>>
>> I think, I hope very strongly, that the -Q in emacs -Q will prevent any
>> packages being loaded.  Otherwise we have a problem in the Emacs core.
>>
>> > Best,
>> > Jayden
>>
>> --
>> Alan Mackenzie (Nuremberg, Germany).
>>
>

--000000000000662939058bf13db9
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I&#39;ve figured out the trigger! I setup a CentOS 7 VM an=
d installed Emacs 26.2.90 and couldn&#39;t repro on it. So I compared all t=
he environment variables between Cygwin and the VM and performed some tests=
, and discovered the issue is triggered by my &quot;TERM&quot; environment =
variable being set to &quot;xterm-256color&quot;.<div><div><br></div><div>I=
 could reproduce on the clean VM using:=C2=A0TERM=3D&quot;xterm-256color&qu=
ot; emacs -Q test.cc</div><div><br></div><div>Launching Emacs in that way, =
and following the other steps given above, should allow you to reproduce.<b=
r clear=3D"all"><div><div dir=3D"ltr" class=3D"gmail_signature" data-smartm=
ail=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><br></div><d=
iv dir=3D"ltr">Best,<div>Jayden</div></div></div></div></div></div><br></di=
v></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmai=
l_attr">On Sat, Jun 22, 2019 at 2:27 PM Jayden Navarro &lt;<a href=3D"mailt=
o:jayden@HIDDEN">jayden@HIDDEN</a>&gt; wrote:<br></div><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px=
 solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Hi Alan,<div><br=
></div><div>Yes, you are completely correct :-) Posted one thing but uninte=
ntionally took a &quot;shortcut&quot; when producing the backtrace (not a s=
mart thing to do when trying to get people to repro...).</div><div><br></di=
v><div>Here&#39;s the backtrace when doing doing M-% foo &lt;RET&gt; bar &l=
t;RET&gt; (note that it&#39;s still 0, 1 not 0, 3!):</div><div><br></div><d=
iv>Debugger entered--Lisp error: (args-out-of-range #&lt;buffer test.cc&gt;=
 0 1)<br>=C2=A0 buffer-substring-no-properties(0 1)<br>=C2=A0 perform-repla=
ce(&quot;foo&quot; &quot;bar&quot; t nil nil nil nil nil nil nil nil)<br>=
=C2=A0 query-replace(&quot;foo&quot; &quot;bar&quot; nil nil nil nil nil)<b=
r>=C2=A0 funcall-interactively(query-replace &quot;foo&quot; &quot;bar&quot=
; nil nil nil nil nil)<br>=C2=A0 call-interactively(query-replace nil nil)<=
br>=C2=A0 command-execute(query-replace)<br></div><div><div><div dir=3D"ltr=
" class=3D"gmail-m_5429401151313316779gmail_signature"><div dir=3D"ltr"><di=
v><div dir=3D"ltr"><br></div><div>Thank you for your help!</div><div dir=3D=
"ltr"><br></div><div dir=3D"ltr">Best,<div>Jayden</div></div></div></div></=
div></div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" c=
lass=3D"gmail_attr">On Sat, Jun 22, 2019 at 1:50 PM Alan Mackenzie &lt;<a h=
ref=3D"mailto:acm@HIDDEN" target=3D"_blank">acm@HIDDEN</a>&gt; wrote:<br></=
div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor=
der-left:1px solid rgb(204,204,204);padding-left:1ex">Hello again, Jayden.<=
br>
<br>
On Sat, Jun 22, 2019 at 07:25:30 -0700, Jayden Navarro wrote:<br>
&gt; Hello Alan,<br>
<br>
&gt; Thank you for your response. Apologies for the ambiguous steps. Please=
 find<br>
&gt; more detailed information below:<br>
<br>
Thanks!<br>
<br>
&gt; Here are the steps:<br>
<br>
&gt; 1. Open a file in c++-mode (e.g. emacs -Q test.cc).<br>
<br>
&gt; 2. Add 100 lines of some string (e.g. the word &quot;bar&quot; on ever=
y line for 100<br>
&gt; lines, no quotes in the actual file):<br>
<br>
&gt; bar<br>
&gt; bar<br>
&gt; bar<br>
&gt; bar<br>
&gt; ...<br>
&gt; bar<br>
<br>
&gt; 3. Add a unique string to line 101 (e.g. the word &quot;foo&quot;, no =
quotes in the<br>
&gt; actual file).<br>
<br>
&gt; bar<br>
&gt; bar<br>
&gt; bar<br>
&gt; bar<br>
&gt; ...<br>
&gt; bar<br>
&gt; foo<br>
&gt; &lt;INCLUDE NEWLINE AT END OF FILE&gt;<br>
<br>
&gt; 4. Close Emacs<br>
<br>
&gt; 5. Open up the file again: emacs -Q test.cc<br>
<br>
&gt; 6. Replace the unique string with some other string: M-x query-replace=
<br>
&gt; &lt;RET&gt; foo &lt;RET&gt; bar &lt;RET&gt;<br>
<br>
Are you _sure_ that&#39;s what you typed?=C2=A0 ;-)<br>
<br>
&gt; 7. You should hit: Args out of range: #&lt;buffer test.cc&gt;, 0, 1<br=
>
<br>
&gt; Here&#39;s the backtrace when using debug-on-error:<br>
<br>
&gt; Debugger entered--Lisp error: (args-out-of-range #&lt;buffer test.cc&g=
t; 0 1)<br>
&gt;=C2=A0 =C2=A0buffer-substring-no-properties(0 1)=C2=A0 &lt;=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D<br>
&gt;=C2=A0 =C2=A0perform-replace(&quot;foo&quot; &quot;a&quot; t nil nil ni=
l nil nil nil nil nil)<br>
&gt;=C2=A0 =C2=A0query-replace(&quot;foo&quot; &quot;a&quot; nil nil nil ni=
l nil)<br>
&gt;=C2=A0 =C2=A0funcall-interactively(query-replace &quot;foo&quot; &quot;=
a&quot; nil nil nil nil nil)<br>
&gt;=C2=A0 =C2=A0call-interactively(query-replace nil nil)<br>
&gt;=C2=A0 =C2=A0command-execute(query-replace)<br>
<br>
There, it looks like you are trying to replace &quot;foo&quot; by &quot;a&q=
uot;.=C2=A0 I&#39;m<br>
interested in the (invalid) arguments 0, 1 passed to<br>
buffer-substring-no-properties.=C2=A0 I suspect that these are derived from=
<br>
the &quot;match-data&quot; for a string, in particular for the string &quot=
;a&quot;.<br>
<br>
Could you please repeat the bug scenario, but this time try to replace<br>
&quot;foo&quot; by &quot;bar&quot;.=C2=A0 I predict you will then get the e=
rror message<br>
<br>
=C2=A0 =C2=A0 (args-out-of-range #&lt;buffer test.cc&gt; 0 3)<br>
<br>
since the replacement string will then be 3 characters long.<br>
<br>
If that does indeed happen, it would be a very strong clue as to the<br>
underlying bug.=C2=A0 Please try it as above, and post the backtrace here.<=
br>
Thanks!<br>
<br>
[ .... ]<br>
<br>
&gt; Here&#39;s the list of packages I have installed under $HOME/.emacs.d/=
elpa:<br>
<br>
&gt; avy-0.3.0<br>
&gt; company-20181105.2312<br>
&gt; company-lean-20171102.1454<br>
&gt; dash-20180910.1856<br>
&gt; dash-functional-20180107.1618<br>
&gt; epl-20180205.2049<br>
&gt; f-20180106.922<br>
&gt; flycheck-20181127.1510<br>
&gt; gnupg<br>
&gt; go-mode-1.3.1<br>
&gt; haskell-mode-13.16<br>
&gt; lean-mode-20180906.1645<br>
&gt; pkg-info-20150517.1143<br>
&gt; rust-mode-20181008.1628<br>
&gt; s-20180406.808<br>
<br>
I think, I hope very strongly, that the -Q in emacs -Q will prevent any<br>
packages being loaded.=C2=A0 Otherwise we have a problem in the Emacs core.=
<br>
<br>
&gt; Best,<br>
&gt; Jayden<br>
<br>
-- <br>
Alan Mackenzie (Nuremberg, Germany).<br>
</blockquote></div>
</blockquote></div>

--000000000000662939058bf13db9--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 22 Jun 2019 21:27:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 17:27:24 2019
Received: from localhost ([127.0.0.1]:52600 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1henXf-0005Zf-Un
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2019 17:27:24 -0400
Received: from mail-lj1-f180.google.com ([209.85.208.180]:44067)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jayden@HIDDEN>) id 1henXa-0005ZN-I6
 for 36328 <at> debbugs.gnu.org; Sat, 22 Jun 2019 17:27:19 -0400
Received: by mail-lj1-f180.google.com with SMTP id k18so9027214ljc.11
 for <36328 <at> debbugs.gnu.org>; Sat, 22 Jun 2019 14:27:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=yugabyte-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=g9tOqTqg+HR07ojo4P4ctAnevDb921jnDN6Mpmgf6nw=;
 b=lZRWkU1xj3SxrzN3wis5wzV7WjZtgJVdZw2CnGUFgL5EUNY5vPFw4geXGHjffnCI4Q
 sMxanypfPKL26PkupiZ4T2xFr2WXPxk2gtLgPt8XTzgWUI2wdP90bXDWyHnGwBQ8sHXb
 g2HMV08Lm8OH0ZMGGtTvpoIGytRqcj3Nx1vhddqBw//f9CuniCo8pxzbi/RM9Qelr67x
 81G8MfY+rpeov3tJt0LehwJ7JKjVqp3PBnAvWkQbiVsThNffK8LXBwOKbFtK6kWXrokj
 bHTr9hxZmokkJ+eBKz8b7OhjUbgCqdRuGIlduGLsnWmsk5qNABtYT1vMjlnyW8PnxKqQ
 iKfw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=g9tOqTqg+HR07ojo4P4ctAnevDb921jnDN6Mpmgf6nw=;
 b=ldEw2Yg00k3QWA1ZBN0bXtRr7gJJoR13bYwGnd+cFAxX+808OwUsPsYwcvrN7ghOjN
 uj5T4JmZPXG7S5lH5wPuwkkPE35AX1DhJOg+nncb24ALpLN8awCdIAhFw0U5QRDu11jt
 SXlHcKVJofp2H7INSktAJeL0KhlUMZWCqCdPl1EtTfWBVpDKmska5SyFrzneV7qCdQBR
 bL9D/XduzVzl5FUeWsB8eoQEXT2VlIZ0C1aE8FJZ9NTxAGvGdlXoApti4sGQXKEDogWi
 Dk5WQEeTnjdjZvg5TTTiZ1V9l4gQOPZFFX9vy61tRKrJuzgYTqLfxAJyqr7Hp/UU4v15
 0S1w==
X-Gm-Message-State: APjAAAW2uWKoK0j4GQfDiPc0RExZxkGNWk95TyfBYb5Bqt+hZTUNhePz
 NpKJhzjx73kplegYFt0oqPcy0A+7h7rk2zZpqO2z2A==
X-Google-Smtp-Source: APXvYqw8S08DcLKMYI44Bhn8MXbIH642xhxRWfDRzODB+VYS3QHCN2FHmJ6G7TNoEgGFbKLJjOCpNrCeQQgOUBZ/E/k=
X-Received: by 2002:a2e:50e:: with SMTP id 14mr58348215ljf.5.1561238832376;
 Sat, 22 Jun 2019 14:27:12 -0700 (PDT)
MIME-Version: 1.0
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <20190622205033.GA9167@ACM>
In-Reply-To: <20190622205033.GA9167@ACM>
From: Jayden Navarro <jayden@HIDDEN>
Date: Sat, 22 Jun 2019 14:27:00 -0700
Message-ID: <CAEKiUEYanqsGV-KbSgj6Sgk7mCz+6Nk6wurdTvZpXUOhcX=s0w@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
To: Alan Mackenzie <acm@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000000380de058bf03e64"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--0000000000000380de058bf03e64
Content-Type: text/plain; charset="UTF-8"

Hi Alan,

Yes, you are completely correct :-) Posted one thing but unintentionally
took a "shortcut" when producing the backtrace (not a smart thing to do
when trying to get people to repro...).

Here's the backtrace when doing doing M-% foo <RET> bar <RET> (note that
it's still 0, 1 not 0, 3!):

Debugger entered--Lisp error: (args-out-of-range #<buffer test.cc> 0 1)
  buffer-substring-no-properties(0 1)
  perform-replace("foo" "bar" t nil nil nil nil nil nil nil nil)
  query-replace("foo" "bar" nil nil nil nil nil)
  funcall-interactively(query-replace "foo" "bar" nil nil nil nil nil)
  call-interactively(query-replace nil nil)
  command-execute(query-replace)

Thank you for your help!

Best,
Jayden


On Sat, Jun 22, 2019 at 1:50 PM Alan Mackenzie <acm@HIDDEN> wrote:

> Hello again, Jayden.
>
> On Sat, Jun 22, 2019 at 07:25:30 -0700, Jayden Navarro wrote:
> > Hello Alan,
>
> > Thank you for your response. Apologies for the ambiguous steps. Please
> find
> > more detailed information below:
>
> Thanks!
>
> > Here are the steps:
>
> > 1. Open a file in c++-mode (e.g. emacs -Q test.cc).
>
> > 2. Add 100 lines of some string (e.g. the word "bar" on every line for
> 100
> > lines, no quotes in the actual file):
>
> > bar
> > bar
> > bar
> > bar
> > ...
> > bar
>
> > 3. Add a unique string to line 101 (e.g. the word "foo", no quotes in the
> > actual file).
>
> > bar
> > bar
> > bar
> > bar
> > ...
> > bar
> > foo
> > <INCLUDE NEWLINE AT END OF FILE>
>
> > 4. Close Emacs
>
> > 5. Open up the file again: emacs -Q test.cc
>
> > 6. Replace the unique string with some other string: M-x query-replace
> > <RET> foo <RET> bar <RET>
>
> Are you _sure_ that's what you typed?  ;-)
>
> > 7. You should hit: Args out of range: #<buffer test.cc>, 0, 1
>
> > Here's the backtrace when using debug-on-error:
>
> > Debugger entered--Lisp error: (args-out-of-range #<buffer test.cc> 0 1)
> >   buffer-substring-no-properties(0 1)  <==============================
> >   perform-replace("foo" "a" t nil nil nil nil nil nil nil nil)
> >   query-replace("foo" "a" nil nil nil nil nil)
> >   funcall-interactively(query-replace "foo" "a" nil nil nil nil nil)
> >   call-interactively(query-replace nil nil)
> >   command-execute(query-replace)
>
> There, it looks like you are trying to replace "foo" by "a".  I'm
> interested in the (invalid) arguments 0, 1 passed to
> buffer-substring-no-properties.  I suspect that these are derived from
> the "match-data" for a string, in particular for the string "a".
>
> Could you please repeat the bug scenario, but this time try to replace
> "foo" by "bar".  I predict you will then get the error message
>
>     (args-out-of-range #<buffer test.cc> 0 3)
>
> since the replacement string will then be 3 characters long.
>
> If that does indeed happen, it would be a very strong clue as to the
> underlying bug.  Please try it as above, and post the backtrace here.
> Thanks!
>
> [ .... ]
>
> > Here's the list of packages I have installed under $HOME/.emacs.d/elpa:
>
> > avy-0.3.0
> > company-20181105.2312
> > company-lean-20171102.1454
> > dash-20180910.1856
> > dash-functional-20180107.1618
> > epl-20180205.2049
> > f-20180106.922
> > flycheck-20181127.1510
> > gnupg
> > go-mode-1.3.1
> > haskell-mode-13.16
> > lean-mode-20180906.1645
> > pkg-info-20150517.1143
> > rust-mode-20181008.1628
> > s-20180406.808
>
> I think, I hope very strongly, that the -Q in emacs -Q will prevent any
> packages being loaded.  Otherwise we have a problem in the Emacs core.
>
> > Best,
> > Jayden
>
> --
> Alan Mackenzie (Nuremberg, Germany).
>

--0000000000000380de058bf03e64
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Alan,<div><br></div><div>Yes, you are completely correc=
t :-) Posted one thing but unintentionally took a &quot;shortcut&quot; when=
 producing the backtrace (not a smart thing to do when trying to get people=
 to repro...).</div><div><br></div><div>Here&#39;s the backtrace when doing=
 doing M-% foo &lt;RET&gt; bar &lt;RET&gt; (note that it&#39;s still 0, 1 n=
ot 0, 3!):</div><div><br></div><div>Debugger entered--Lisp error: (args-out=
-of-range #&lt;buffer test.cc&gt; 0 1)<br>=C2=A0 buffer-substring-no-proper=
ties(0 1)<br>=C2=A0 perform-replace(&quot;foo&quot; &quot;bar&quot; t nil n=
il nil nil nil nil nil nil)<br>=C2=A0 query-replace(&quot;foo&quot; &quot;b=
ar&quot; nil nil nil nil nil)<br>=C2=A0 funcall-interactively(query-replace=
 &quot;foo&quot; &quot;bar&quot; nil nil nil nil nil)<br>=C2=A0 call-intera=
ctively(query-replace nil nil)<br>=C2=A0 command-execute(query-replace)<br>=
</div><div><div><div dir=3D"ltr" class=3D"gmail_signature" data-smartmail=
=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><br></div><div>=
Thank you for your help!</div><div dir=3D"ltr"><br></div><div dir=3D"ltr">B=
est,<div>Jayden</div></div></div></div></div></div><br></div></div><br><div=
 class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Jun 22=
, 2019 at 1:50 PM Alan Mackenzie &lt;<a href=3D"mailto:acm@HIDDEN">acm@muc.=
de</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex=
">Hello again, Jayden.<br>
<br>
On Sat, Jun 22, 2019 at 07:25:30 -0700, Jayden Navarro wrote:<br>
&gt; Hello Alan,<br>
<br>
&gt; Thank you for your response. Apologies for the ambiguous steps. Please=
 find<br>
&gt; more detailed information below:<br>
<br>
Thanks!<br>
<br>
&gt; Here are the steps:<br>
<br>
&gt; 1. Open a file in c++-mode (e.g. emacs -Q test.cc).<br>
<br>
&gt; 2. Add 100 lines of some string (e.g. the word &quot;bar&quot; on ever=
y line for 100<br>
&gt; lines, no quotes in the actual file):<br>
<br>
&gt; bar<br>
&gt; bar<br>
&gt; bar<br>
&gt; bar<br>
&gt; ...<br>
&gt; bar<br>
<br>
&gt; 3. Add a unique string to line 101 (e.g. the word &quot;foo&quot;, no =
quotes in the<br>
&gt; actual file).<br>
<br>
&gt; bar<br>
&gt; bar<br>
&gt; bar<br>
&gt; bar<br>
&gt; ...<br>
&gt; bar<br>
&gt; foo<br>
&gt; &lt;INCLUDE NEWLINE AT END OF FILE&gt;<br>
<br>
&gt; 4. Close Emacs<br>
<br>
&gt; 5. Open up the file again: emacs -Q test.cc<br>
<br>
&gt; 6. Replace the unique string with some other string: M-x query-replace=
<br>
&gt; &lt;RET&gt; foo &lt;RET&gt; bar &lt;RET&gt;<br>
<br>
Are you _sure_ that&#39;s what you typed?=C2=A0 ;-)<br>
<br>
&gt; 7. You should hit: Args out of range: #&lt;buffer test.cc&gt;, 0, 1<br=
>
<br>
&gt; Here&#39;s the backtrace when using debug-on-error:<br>
<br>
&gt; Debugger entered--Lisp error: (args-out-of-range #&lt;buffer test.cc&g=
t; 0 1)<br>
&gt;=C2=A0 =C2=A0buffer-substring-no-properties(0 1)=C2=A0 &lt;=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D<br>
&gt;=C2=A0 =C2=A0perform-replace(&quot;foo&quot; &quot;a&quot; t nil nil ni=
l nil nil nil nil nil)<br>
&gt;=C2=A0 =C2=A0query-replace(&quot;foo&quot; &quot;a&quot; nil nil nil ni=
l nil)<br>
&gt;=C2=A0 =C2=A0funcall-interactively(query-replace &quot;foo&quot; &quot;=
a&quot; nil nil nil nil nil)<br>
&gt;=C2=A0 =C2=A0call-interactively(query-replace nil nil)<br>
&gt;=C2=A0 =C2=A0command-execute(query-replace)<br>
<br>
There, it looks like you are trying to replace &quot;foo&quot; by &quot;a&q=
uot;.=C2=A0 I&#39;m<br>
interested in the (invalid) arguments 0, 1 passed to<br>
buffer-substring-no-properties.=C2=A0 I suspect that these are derived from=
<br>
the &quot;match-data&quot; for a string, in particular for the string &quot=
;a&quot;.<br>
<br>
Could you please repeat the bug scenario, but this time try to replace<br>
&quot;foo&quot; by &quot;bar&quot;.=C2=A0 I predict you will then get the e=
rror message<br>
<br>
=C2=A0 =C2=A0 (args-out-of-range #&lt;buffer test.cc&gt; 0 3)<br>
<br>
since the replacement string will then be 3 characters long.<br>
<br>
If that does indeed happen, it would be a very strong clue as to the<br>
underlying bug.=C2=A0 Please try it as above, and post the backtrace here.<=
br>
Thanks!<br>
<br>
[ .... ]<br>
<br>
&gt; Here&#39;s the list of packages I have installed under $HOME/.emacs.d/=
elpa:<br>
<br>
&gt; avy-0.3.0<br>
&gt; company-20181105.2312<br>
&gt; company-lean-20171102.1454<br>
&gt; dash-20180910.1856<br>
&gt; dash-functional-20180107.1618<br>
&gt; epl-20180205.2049<br>
&gt; f-20180106.922<br>
&gt; flycheck-20181127.1510<br>
&gt; gnupg<br>
&gt; go-mode-1.3.1<br>
&gt; haskell-mode-13.16<br>
&gt; lean-mode-20180906.1645<br>
&gt; pkg-info-20150517.1143<br>
&gt; rust-mode-20181008.1628<br>
&gt; s-20180406.808<br>
<br>
I think, I hope very strongly, that the -Q in emacs -Q will prevent any<br>
packages being loaded.=C2=A0 Otherwise we have a problem in the Emacs core.=
<br>
<br>
&gt; Best,<br>
&gt; Jayden<br>
<br>
-- <br>
Alan Mackenzie (Nuremberg, Germany).<br>
</blockquote></div>

--0000000000000380de058bf03e64--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 22 Jun 2019 20:50:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 16:50:42 2019
Received: from localhost ([127.0.0.1]:52577 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hemy9-0004hC-1T
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2019 16:50:41 -0400
Received: from colin.muc.de ([193.149.48.1]:44569 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1hemy6-0004h0-MT
 for 36328 <at> debbugs.gnu.org; Sat, 22 Jun 2019 16:50:39 -0400
Received: (qmail 5392 invoked by uid 3782); 22 Jun 2019 20:50:35 -0000
Received: from acm.muc.de (p4FE15013.dip0.t-ipconnect.de [79.225.80.19]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Sat, 22 Jun 2019 22:50:34 +0200
Received: (qmail 9205 invoked by uid 1000); 22 Jun 2019 20:50:33 -0000
Date: Sat, 22 Jun 2019 20:50:33 +0000
To: Jayden Navarro <jayden@HIDDEN>
Subject: Re: bug#36328: 26.2; Args out of range on search-and-replace of *.cc
 file
Message-ID: <20190622205033.GA9167@ACM>
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
User-Agent: Mutt/1.10.1 (2018-07-13)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello again, Jayden.

On Sat, Jun 22, 2019 at 07:25:30 -0700, Jayden Navarro wrote:
> Hello Alan,

> Thank you for your response. Apologies for the ambiguous steps. Please find
> more detailed information below:

Thanks!

> Here are the steps:

> 1. Open a file in c++-mode (e.g. emacs -Q test.cc).

> 2. Add 100 lines of some string (e.g. the word "bar" on every line for 100
> lines, no quotes in the actual file):

> bar
> bar
> bar
> bar
> ...
> bar

> 3. Add a unique string to line 101 (e.g. the word "foo", no quotes in the
> actual file).

> bar
> bar
> bar
> bar
> ...
> bar
> foo
> <INCLUDE NEWLINE AT END OF FILE>

> 4. Close Emacs

> 5. Open up the file again: emacs -Q test.cc

> 6. Replace the unique string with some other string: M-x query-replace
> <RET> foo <RET> bar <RET>

Are you _sure_ that's what you typed?  ;-)

> 7. You should hit: Args out of range: #<buffer test.cc>, 0, 1

> Here's the backtrace when using debug-on-error:

> Debugger entered--Lisp error: (args-out-of-range #<buffer test.cc> 0 1)
>   buffer-substring-no-properties(0 1)  <==============================
>   perform-replace("foo" "a" t nil nil nil nil nil nil nil nil)
>   query-replace("foo" "a" nil nil nil nil nil)
>   funcall-interactively(query-replace "foo" "a" nil nil nil nil nil)
>   call-interactively(query-replace nil nil)
>   command-execute(query-replace)

There, it looks like you are trying to replace "foo" by "a".  I'm
interested in the (invalid) arguments 0, 1 passed to
buffer-substring-no-properties.  I suspect that these are derived from
the "match-data" for a string, in particular for the string "a".

Could you please repeat the bug scenario, but this time try to replace
"foo" by "bar".  I predict you will then get the error message

    (args-out-of-range #<buffer test.cc> 0 3)

since the replacement string will then be 3 characters long.

If that does indeed happen, it would be a very strong clue as to the
underlying bug.  Please try it as above, and post the backtrace here.
Thanks!

[ .... ]

> Here's the list of packages I have installed under $HOME/.emacs.d/elpa:

> avy-0.3.0
> company-20181105.2312
> company-lean-20171102.1454
> dash-20180910.1856
> dash-functional-20180107.1618
> epl-20180205.2049
> f-20180106.922
> flycheck-20181127.1510
> gnupg
> go-mode-1.3.1
> haskell-mode-13.16
> lean-mode-20180906.1645
> pkg-info-20150517.1143
> rust-mode-20181008.1628
> s-20180406.808

I think, I hope very strongly, that the -Q in emacs -Q will prevent any
packages being loaded.  Otherwise we have a problem in the Emacs core.

> Best,
> Jayden

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 22 Jun 2019 16:10:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 12:10:09 2019
Received: from localhost ([127.0.0.1]:52451 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1heiae-0005HY-Ov
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2019 12:10:09 -0400
Received: from mail-lj1-f195.google.com ([209.85.208.195]:46283)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jayden@HIDDEN>) id 1heiac-0005Gr-BG
 for 36328 <at> debbugs.gnu.org; Sat, 22 Jun 2019 12:10:07 -0400
Received: by mail-lj1-f195.google.com with SMTP id v24so8623428ljg.13
 for <36328 <at> debbugs.gnu.org>; Sat, 22 Jun 2019 09:10:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=yugabyte-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=6Q9ColUCQ9PJErE5PloQZ8mBuxsAptb99m6ic9mBsv0=;
 b=EG0qdo2wyRTPTqekESjFEJuk45OgWBiIYEfH4jovvD5m5Oy7N8GZsB87C/fL4OM765
 BAzDDGiCLAgPqPHNfqiyIUBhxhfqSXWMp3lbyK+t2aRwL3WCa1SIS84nRlZD+VlT8KTO
 idmnX5ShR8NYHGh6JvdN6++cUTnGxGIPthM446f0l82iBLSSxl8xAdzdyyMSI+QGcZpi
 X46STL7B5TtVI0POHcDSFqwv3imI90A2VtDERRS1zdw9xO99iHAG/5uxBMTF6kOwzepE
 pGVZ5Y8fIC//Qj+g6/9deOdmn4fydGs9YencHoTYJI592rCHagHQ+/w3gtGwPinj0CL6
 D7bA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=6Q9ColUCQ9PJErE5PloQZ8mBuxsAptb99m6ic9mBsv0=;
 b=LR5cjahQVPlf0ZEDeLmUD33j4pOmf0XGIBAA/pw44l5PtJmDote4LdorSCIRHDIRWj
 y6R5FmP9AL8eFDwZuY25oVGrLqpd7fAmsrQuI94x6NOmPBsTZMWy+mW9V5fLgdeNklrK
 8XOrACkSin/Wv37CFloPkr1K6NDr2P/LW8lw/Q/ZCoCe4VngyRUyBFH0kInS6nBgo6oP
 7yURj88lSEhj50IwsWzFouXZPnC+NnSVmFCcOYsEEKaA3ZmAL2v++TijsBS/S38R2Vry
 1z0LUi6+RaZ7BEbRjwuv06T7d2miPYL11DOUMk0iZNWfytXYi2QfLLA8q99E2RtPM61O
 HdPA==
X-Gm-Message-State: APjAAAW6gW5i9kDllfFYPFRfh331OytBVMrYabtNwvc3sEAni3f6Rj+O
 3qlC0zuJ1jn+En2VWbRuDFu2V+1HBTw4aUfrMQvGxQ==
X-Google-Smtp-Source: APXvYqxj4vgZwIRvSrr+ukf2HcshTeCSPJn1WXuWg+xCZx+TYz2vN2eFiQReBosEHS2GmFIzm0F3zvY7u/PUooZumCM=
X-Received: by 2002:a2e:3913:: with SMTP id g19mr13426644lja.212.1561219800250; 
 Sat, 22 Jun 2019 09:10:00 -0700 (PDT)
MIME-Version: 1.0
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
 <CAAeL0SSzkZpgDJt+m=DOKr5LW1ZkLi7THBeNt3PAYhkxKTWSrw@HIDDEN>
In-Reply-To: <CAAeL0SSzkZpgDJt+m=DOKr5LW1ZkLi7THBeNt3PAYhkxKTWSrw@HIDDEN>
From: Jayden Navarro <jayden@HIDDEN>
Date: Sat, 22 Jun 2019 09:09:48 -0700
Message-ID: <CAEKiUEa3NkPM5paV=M-gPbTPae0aC-6kyQJkf1qrAcrMrUGkfQ@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
To: Juanma Barranquero <lekktu@HIDDEN>
Content-Type: multipart/alternative; boundary="0000000000009c51b5058bebcfcf"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: Alan Mackenzie <acm@HIDDEN>, 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--0000000000009c51b5058bebcfcf
Content-Type: text/plain; charset="UTF-8"

I've been able to reproduce this on MacOS 10.14 Mojave running Emacs 26.2
and Emacs 27 (forget exact version, installed it yesterday using "brew
install emacs --HEAD").

I've also reproduced it on Windows in Cygwin running Emacs 26.2. On an
Ubuntu server I use running Emacs 24.5.1 I cannot reproduce the issue.

"emacs -Q" should ignore all init files and packages correct? Is there
anything else on my system that could be affecting this?

Note that for the same file contents this issue does not occur if I name
the file test.py, so I believe it's related to c++-mode.

Best,
Jayden


On Sat, Jun 22, 2019 at 7:52 AM Juanma Barranquero <lekktu@HIDDEN> wrote:

> On Sat, Jun 22, 2019 at 4:26 PM Jayden Navarro <jayden@HIDDEN>
> wrote:
>
> > 7. You should hit: Args out of range: #<buffer test.cc>, 0, 1
>
> I cannot reproduce it with 26.2.90 on Windows.
>

--0000000000009c51b5058bebcfcf
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I&#39;ve been able to reproduce this on MacOS 10.14 Mojave=
 running Emacs 26.2 and Emacs 27 (forget exact version, installed it yester=
day using &quot;brew install emacs --HEAD&quot;).=C2=A0<div><br></div><div>=
I&#39;ve also reproduced it on Windows in Cygwin running Emacs 26.2. On an =
Ubuntu server I use running Emacs 24.5.1 I cannot reproduce the issue.</div=
><div><br></div><div>&quot;emacs -Q&quot; should ignore all init files and =
packages correct? Is there anything else on my system that could be affecti=
ng this?</div><div><br></div><div>Note that for the same file contents this=
 issue does not occur if I name the file test.py, so I believe it&#39;s rel=
ated to c++-mode.<br clear=3D"all"><div><div dir=3D"ltr" class=3D"gmail_sig=
nature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=
=3D"ltr"><br></div><div dir=3D"ltr">Best,<div>Jayden</div></div></div></div=
></div></div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr=
" class=3D"gmail_attr">On Sat, Jun 22, 2019 at 7:52 AM Juanma Barranquero &=
lt;<a href=3D"mailto:lekktu@HIDDEN">lekktu@HIDDEN</a>&gt; wrote:<br><=
/div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bo=
rder-left:1px solid rgb(204,204,204);padding-left:1ex">On Sat, Jun 22, 2019=
 at 4:26 PM Jayden Navarro &lt;<a href=3D"mailto:jayden@HIDDEN" targe=
t=3D"_blank">jayden@HIDDEN</a>&gt; wrote:<br>
<br>
&gt; 7. You should hit: Args out of range: #&lt;buffer test.cc&gt;, 0, 1<br=
>
<br>
I cannot reproduce it with 26.2.90 on Windows.<br>
</blockquote></div>

--0000000000009c51b5058bebcfcf--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 22 Jun 2019 14:52:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 10:52:26 2019
Received: from localhost ([127.0.0.1]:52395 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hehNS-00037K-GV
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2019 10:52:26 -0400
Received: from mail-qk1-f175.google.com ([209.85.222.175]:39474)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <lekktu@HIDDEN>) id 1hehNR-000374-7f
 for 36328 <at> debbugs.gnu.org; Sat, 22 Jun 2019 10:52:26 -0400
Received: by mail-qk1-f175.google.com with SMTP id i125so6642769qkd.6
 for <36328 <at> debbugs.gnu.org>; Sat, 22 Jun 2019 07:52:25 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=9wVF5hDk32hzGlRyz2ACXEDu3W5NLEQyxiC2MZFsdO4=;
 b=lDg3ctRvCQp8oJkIhLLfpx0E9S5gWMNx67sYi6/rvc1pSeJIPaqNGvviPZRnuDl4wO
 sRuQV3HyP6GUGHdxDvJ5nB/iVaso+fZfc4lthBg56MwMPccKt+QlrJgAjqkxH5P2Phh1
 rgn00S7e62Ow+ewt0TLdh4UQlbmnIwlHY6EHR+o1ISXSy/uc92mD96XF3jvujgp9We/D
 6IIuXbfsFkFpcYURx2lzBIFVr+i6rmKlpS37o7Oo9ZpMasMHvCLA2wDvoQMmZD/tjJp9
 3i3d4XPG/ulyqpprzG+NSi8GEkKYRiVzDok8BztsI63mVOz/70yrXZPOz868IwLBiMV1
 KQzw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=9wVF5hDk32hzGlRyz2ACXEDu3W5NLEQyxiC2MZFsdO4=;
 b=SI+KW77iASSt7ZH+9FZgsdWNG1DRBUGlWqfvfCWPopxL5YMsCpH94pkNuFF8TtvTC5
 TrMV1T/FgXz9g1dWpI6yiSf/qgyuJg3E8jpDfXb6apRWn2/CSEiv2qhVjmnwLGUTFljv
 isVZcEdJ7bPkztNcbcmWz27eRWBDzaoGXW2iOa4lADQgwUlucc4hUHnghKW7yqZmZaIJ
 QEtpik875yxIelGuyJUFix1lJBSwdoNNVhTJhb7TYSjZ31KxqZ6NVCY59IHZH8ptzmyc
 ia+Otu8eavzCWnQq0oNz4vo0NpIqkOEuqumc5Pp/3fQfMxjhJzACYoDOL7qyW/UTDZng
 hN1A==
X-Gm-Message-State: APjAAAVfic/v3R3Ce7zG2iYtN3Y57Gz7R9pmxwIxVn0REGbHAJpOQZqg
 EtG720p0QSK9QbRcx4t9SKS5GQRdGNvmg0Wo4NY=
X-Google-Smtp-Source: APXvYqy2FQWETZ+UiyKtLtAlntAmYXAVfq9rbfnDuI31RlA4nd4hhAxGdKQ9Z4JDbXD3+4heO4FXTvF4pPWTK09SZKE=
X-Received: by 2002:a37:6ac3:: with SMTP id
 f186mr97105508qkc.281.1561215139482; 
 Sat, 22 Jun 2019 07:52:19 -0700 (PDT)
MIME-Version: 1.0
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
 <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
In-Reply-To: <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Sat, 22 Jun 2019 16:51:41 +0200
Message-ID: <CAAeL0SSzkZpgDJt+m=DOKr5LW1ZkLi7THBeNt3PAYhkxKTWSrw@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
To: Jayden Navarro <jayden@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: Alan Mackenzie <acm@HIDDEN>, 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Sat, Jun 22, 2019 at 4:26 PM Jayden Navarro <jayden@HIDDEN> wrote:

> 7. You should hit: Args out of range: #<buffer test.cc>, 0, 1

I cannot reproduce it with 26.2.90 on Windows.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 22 Jun 2019 14:25:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 10:25:51 2019
Received: from localhost ([127.0.0.1]:52355 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1hegxi-0000E7-H5
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2019 10:25:51 -0400
Received: from mail-lf1-f45.google.com ([209.85.167.45]:36542)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jayden@HIDDEN>) id 1hegxg-0000Dr-6J
 for 36328 <at> debbugs.gnu.org; Sat, 22 Jun 2019 10:25:49 -0400
Received: by mail-lf1-f45.google.com with SMTP id q26so7025533lfc.3
 for <36328 <at> debbugs.gnu.org>; Sat, 22 Jun 2019 07:25:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=yugabyte-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=Y/x6dqQzC7PGYrqAig+gbH47g4Hdqjvk58Y9ufgoJvU=;
 b=WOXX05gc3pUEZfUrt7z0BZQUFHRC518/SSI64eNzbmXhl7HuYxW15EZ89VrN8pnbzE
 4eLgLAc/0jW77/hZ8SdY07yE8uHy1+yzprLICVTjYt23EPZBEjJTJB6ZSCHhK5lATD1B
 WFSlJDmFvuAfNiwasLblW0zU6Bi4WHLqSaIWZqSCbRNzw8+LjYkWAKcODzvRzg2w5gJm
 8EpdvHoPlQlL3ig+QSDTvj1MtDTqYW//iTgMN3nn/V7AZ9wXtVS+sOWeug0u6UR2FE3K
 ktn6umeB311GKaiIxkq+y/oufCVP4/7JQr+LO2fWNtyH4Ob1TFcmHXd+doy2Z8GeggnQ
 QCiw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=Y/x6dqQzC7PGYrqAig+gbH47g4Hdqjvk58Y9ufgoJvU=;
 b=XVWrBkVorPOubs6Matzd/N3H/StkTVksjJHgXs9H3Tl7SGTQhJ/qbf/eOiCqrjFtxf
 lOnexJobzVU9aA+JCb3evoKV84KUMeXt1F4bBT7Da0rjB98uKKRk2moTMgw6U4QIV6We
 HwpbNV24HaVAvMWgp0S78VuqEvHmR+GFk9TdvXr3p561biP6jiMqcs+/W0eJs/ZPn05j
 CgE/RxfvQYh1q2rA3x3c54ok/+NVcRDNhlrCzfpt5iT4ZD/wfES/htjWiYSraEN8SHGn
 ASPppLz/1X1OtmkB7SANwuqZx+UM9zabUx7ZtzOfMuLoPO9NUaAFiAkIVJnxGUEFK/YK
 S5dA==
X-Gm-Message-State: APjAAAWmWGMqnE6BxiVOJZgbjj2toUlzJY8C3nZhvH1OPKhV6qQpeEux
 gMEBudlmGQ2cCOSTIf+eg6o7EVqmjy/UtRDgw13S7A==
X-Google-Smtp-Source: APXvYqycZL/1seiKQikFKJ2MHjMDYEVGanf5nzzKKzEcx3j8SNS1mNpIVBW9+RrJLSq9lzECcdaX2illheFQJcccgfE=
X-Received: by 2002:ac2:47fa:: with SMTP id b26mr12738898lfp.82.1561213541893; 
 Sat, 22 Jun 2019 07:25:41 -0700 (PDT)
MIME-Version: 1.0
References: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
 <20190622132549.84518.qmail@HIDDEN>
In-Reply-To: <20190622132549.84518.qmail@HIDDEN>
From: Jayden Navarro <jayden@HIDDEN>
Date: Sat, 22 Jun 2019 07:25:30 -0700
Message-ID: <CAEKiUEZHeGahYxK0R98v6AuBe1czJv3YQA71Esrnp1a2YPW7UQ@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
To: Alan Mackenzie <acm@HIDDEN>
Content-Type: multipart/alternative; boundary="000000000000955f0e058bea5ae9"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--000000000000955f0e058bea5ae9
Content-Type: text/plain; charset="UTF-8"

Hello Alan,

Thank you for your response. Apologies for the ambiguous steps. Please find
more detailed information below:

Here are the steps:

1. Open a file in c++-mode (e.g. emacs -Q test.cc).

2. Add 100 lines of some string (e.g. the word "bar" on every line for 100
lines, no quotes in the actual file):

bar
bar
bar
bar
...
bar

3. Add a unique string to line 101 (e.g. the word "foo", no quotes in the
actual file).

bar
bar
bar
bar
...
bar
foo
<INCLUDE NEWLINE AT END OF FILE>

4. Close Emacs

5. Open up the file again: emacs -Q test.cc

6. Replace the unique string with some other string: M-x query-replace
<RET> foo <RET> bar <RET>

7. You should hit: Args out of range: #<buffer test.cc>, 0, 1

Here's the backtrace when using debug-on-error:

Debugger entered--Lisp error: (args-out-of-range #<buffer test.cc> 0 1)
  buffer-substring-no-properties(0 1)
  perform-replace("foo" "a" t nil nil nil nil nil nil nil nil)
  query-replace("foo" "a" nil nil nil nil nil)
  funcall-interactively(query-replace "foo" "a" nil nil nil nil nil)
  call-interactively(query-replace nil nil)
  command-execute(query-replace)

I also wanted to add that I tried reproducing with a file that looked like
the following, but did NOT see the issue then,
either with replacing "foo" (with quotes) or just foo (no quotes):

"bar"
"bar"
"bar"
...
"bar"
"foo"

Even though I'm using "emacs -Q", could it still be interacting with some
of the packages I have installed?

Here's the list of packages I have installed under $HOME/.emacs.d/elpa:

avy-0.3.0
company-20181105.2312
company-lean-20171102.1454
dash-20180910.1856
dash-functional-20180107.1618
epl-20180205.2049
f-20180106.922
flycheck-20181127.1510
gnupg
go-mode-1.3.1
haskell-mode-13.16
lean-mode-20180906.1645
pkg-info-20150517.1143
rust-mode-20181008.1628
s-20180406.808

Best,
Jayden


On Sat, Jun 22, 2019 at 6:25 AM Alan Mackenzie <acm@HIDDEN> wrote:

> Hello, Jayden.
>
> In article <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN> you wrote:
> > [-- text/plain, encoding 7bit, charset: UTF-8, 97 lines --]
>
> [ .... ]
>
> > Fill a *.cc file with 100 lines of any string (e.g. "bar"). At line 101
> > write a unique string (e.g. "foo").
>
> Does your file look like:
>
> bar
> bar
> bar
> ...
> ...
> bar
> foo
>
> ?  Or does it look like:
>
> "bar"
> "bar"
> "bar"
> ...
> ...
> "bar"
> "foo"
>
> ?
>
> > Close the file and reopen (emacs -Q).
>
> OK.
>
> > and perform search-and-replace on "foo" (replacing with any other
> string).
>
> What, precisely, did you do to attempt this "search-and-replace"?  With
> emacs-26.2, after emacs -Q, I did
>
>     C-x C-f test.cc
>
> , followed by
>
>     M-% foo <CR> FOO
>
> , in both possibilities for the file (see above), yet could not
> reproduce the error.  The replacement command simply worked for me.
>
> > At this point you should see "Args out of range: #<buffer test.cc>, 0,
> 1".
>
> This is what I don't see.  :-(  At least, not yet.
>
> [ .... ]
>
> --
> Alan Mackenzie (Nuremberg, Germany).
>
>

--000000000000955f0e058bea5ae9
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello Alan,<div><br></div><div>Thank you for your response=
. Apologies for the ambiguous steps. Please find more detailed information =
below:</div><div><br></div>Here are the steps:<br><br> 1. Open a file in c+=
+-mode (e.g. emacs -Q test.cc).<br><br> 2. Add 100 lines of some string (e.=
g. the word &quot;bar&quot; on every line for 100 lines, no quotes in the a=
ctual file):<div><br></div><div>bar</div><div>bar</div><div>bar</div><div>b=
ar</div><div>...</div><div>bar</div><div><br> 3. Add a unique string to lin=
e 101 (e.g. the word &quot;foo&quot;, no quotes in the actual file).</div><=
div><br></div><div><div>bar</div><div>bar</div><div>bar</div><div>bar</div>=
<div>...</div><div>bar</div><div>foo</div><div>&lt;INCLUDE NEWLINE AT END O=
F FILE&gt;</div><br> 4. Close Emacs<br><br> 5. Open up the file again: emac=
s -Q test.cc<br><br> 6. Replace the unique string with some other string: M=
-x query-replace &lt;RET&gt; foo &lt;RET&gt; bar &lt;RET&gt;<br><br> 7. You=
 should hit: Args out of range: #&lt;buffer test.cc&gt;, 0, 1</div><div><br=
></div><div>Here&#39;s the backtrace when using debug-on-error:<br><br>Debu=
gger=C2=A0entered--Lisp=C2=A0error:=C2=A0(args-out-of-range=C2=A0#&lt;buffe=
r=C2=A0test.cc&gt;=C2=A00=C2=A01)<br>=C2=A0=C2=A0buffer-substring-no-proper=
ties(0=C2=A01)<br>=C2=A0=C2=A0perform-replace(&quot;foo&quot;=C2=A0&quot;a&=
quot;=C2=A0t=C2=A0nil=C2=A0nil=C2=A0nil=C2=A0nil=C2=A0nil=C2=A0nil=C2=A0nil=
=C2=A0nil)<br>=C2=A0=C2=A0query-replace(&quot;foo&quot;=C2=A0&quot;a&quot;=
=C2=A0nil=C2=A0nil=C2=A0nil=C2=A0nil=C2=A0nil)<br>=C2=A0=C2=A0funcall-inter=
actively(query-replace=C2=A0&quot;foo&quot;=C2=A0&quot;a&quot;=C2=A0nil=C2=
=A0nil=C2=A0nil=C2=A0nil=C2=A0nil)<br>=C2=A0=C2=A0call-interactively(query-=
replace=C2=A0nil=C2=A0nil)<br>=C2=A0=C2=A0command-execute(query-replace)=C2=
=A0=C2=A0<br></div><div><br></div><div>I also wanted to add that I tried re=
producing with a file that looked like the following, but did NOT see the i=
ssue then,</div><div>either with replacing &quot;foo&quot; (with quotes) or=
 just foo (no quotes):</div><div><br></div><div>&quot;bar&quot;</div><div>&=
quot;bar&quot;</div><div>&quot;bar&quot;</div><div>...</div><div>&quot;bar&=
quot;</div><div>&quot;foo&quot;</div><div><br>Even though I&#39;m using &qu=
ot;emacs -Q&quot;, could it still be interacting with some of the packages =
I have installed?</div><div><br></div><div>Here&#39;s the list of packages =
I have installed under $HOME/.emacs.d/elpa:</div><div><br></div><div>avy-0.=
3.0<br>company-20181105.2312<br>company-lean-20171102.1454<br>dash-20180910=
.1856<br>dash-functional-20180107.1618<br>epl-20180205.2049<br>f-20180106.9=
22<br>flycheck-20181127.1510<br>gnupg<br>go-mode-1.3.1<br>haskell-mode-13.1=
6<br>lean-mode-20180906.1645<br>pkg-info-20150517.1143<br>rust-mode-2018100=
8.1628<br>s-20180406.808<br><div><br clear=3D"all"><div><div dir=3D"ltr" cl=
ass=3D"gmail_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"=
>Best,<div>Jayden</div></div></div></div><br></div></div></div><br><div cla=
ss=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Sat, Jun 22, 20=
19 at 6:25 AM Alan Mackenzie &lt;<a href=3D"mailto:acm@HIDDEN">acm@HIDDEN</=
a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0p=
x 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">He=
llo, Jayden.<br>
<br>
In article &lt;<a href=3D"mailto:mailman.612.1561158667.10840.bug-gnu-emacs=
@gnu.org" target=3D"_blank">mailman.612.1561158667.10840.bug-gnu-emacs@gnu.=
org</a>&gt; you wrote:<br>
&gt; [-- text/plain, encoding 7bit, charset: UTF-8, 97 lines --]<br>
<br>
[ .... ]<br>
<br>
&gt; Fill a *.cc file with 100 lines of any string (e.g. &quot;bar&quot;). =
At line 101<br>
&gt; write a unique string (e.g. &quot;foo&quot;).<br>
<br>
Does your file look like:<br>
<br>
bar<br>
bar<br>
bar<br>
...<br>
...<br>
bar<br>
foo<br>
<br>
?=C2=A0 Or does it look like:<br>
<br>
&quot;bar&quot;<br>
&quot;bar&quot;<br>
&quot;bar&quot;<br>
...<br>
...<br>
&quot;bar&quot;<br>
&quot;foo&quot;<br>
<br>
?<br>
<br>
&gt; Close the file and reopen (emacs -Q).<br>
<br>
OK.<br>
<br>
&gt; and perform search-and-replace on &quot;foo&quot; (replacing with any =
other string).<br>
<br>
What, precisely, did you do to attempt this &quot;search-and-replace&quot;?=
=C2=A0 With<br>
emacs-26.2, after emacs -Q, I did<br>
<br>
=C2=A0 =C2=A0 C-x C-f test.cc<br>
<br>
, followed by<br>
<br>
=C2=A0 =C2=A0 M-% foo &lt;CR&gt; FOO<br>
<br>
, in both possibilities for the file (see above), yet could not<br>
reproduce the error.=C2=A0 The replacement command simply worked for me.<br=
>
<br>
&gt; At this point you should see &quot;Args out of range: #&lt;buffer test=
.cc&gt;, 0, 1&quot;.<br>
<br>
This is what I don&#39;t see.=C2=A0 :-(=C2=A0 At least, not yet.<br>
<br>
[ .... ]<br>
<br>
-- <br>
Alan Mackenzie (Nuremberg, Germany).<br>
<br>
</blockquote></div>

--000000000000955f0e058bea5ae9--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at 36328 <at> debbugs.gnu.org:


Received: (at 36328) by debbugs.gnu.org; 22 Jun 2019 13:25:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 22 09:25:56 2019
Received: from localhost ([127.0.0.1]:51270 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1heg1k-0000Uz-9N
	for submit <at> debbugs.gnu.org; Sat, 22 Jun 2019 09:25:56 -0400
Received: from colin.muc.de ([193.149.48.1]:40249 helo=mail.muc.de)
 by debbugs.gnu.org with smtp (Exim 4.84_2)
 (envelope-from <acm@HIDDEN>) id 1heg1h-0000Up-Sg
 for 36328 <at> debbugs.gnu.org; Sat, 22 Jun 2019 09:25:54 -0400
Received: (qmail 84519 invoked by uid 3782); 22 Jun 2019 13:25:49 -0000
Date: 22 Jun 2019 13:25:49 -0000
Message-ID: <20190622132549.84518.qmail@HIDDEN>
From: Alan Mackenzie <acm@HIDDEN>
To: Jayden Navarro <jayden@HIDDEN>
Subject: Re: bug#36328: 26.2;
 Args out of range on search-and-replace of *.cc file
Organization: muc.de e.V.
In-Reply-To: <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN>
X-Newsgroups: gnu.emacs.bug
User-Agent: tin/2.4.2-20171224 ("Lochhead") (UNIX) (FreeBSD/11.2-RELEASE-p9
 (amd64))
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 36328
Cc: 36328 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello, Jayden.

In article <mailman.612.1561158667.10840.bug-gnu-emacs@HIDDEN> you wrote:
> [-- text/plain, encoding 7bit, charset: UTF-8, 97 lines --]

[ .... ]

> Fill a *.cc file with 100 lines of any string (e.g. "bar"). At line 101
> write a unique string (e.g. "foo").

Does your file look like:

bar
bar
bar
...
...
bar
foo

?  Or does it look like:

"bar"
"bar"
"bar"
...
...
"bar"
"foo"

?

> Close the file and reopen (emacs -Q).

OK.

> and perform search-and-replace on "foo" (replacing with any other string).

What, precisely, did you do to attempt this "search-and-replace"?  With
emacs-26.2, after emacs -Q, I did

    C-x C-f test.cc

, followed by

    M-% foo <CR> FOO

, in both possibilities for the file (see above), yet could not
reproduce the error.  The replacement command simply worked for me.

> At this point you should see "Args out of range: #<buffer test.cc>, 0, 1".

This is what I don't see.  :-(  At least, not yet.

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Jun 2019 23:10:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jun 21 19:10:08 2019
Received: from localhost ([127.0.0.1]:50793 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1heSfX-0005Fs-7k
	for submit <at> debbugs.gnu.org; Fri, 21 Jun 2019 19:10:08 -0400
Received: from lists.gnu.org ([209.51.188.17]:38015)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jayden@HIDDEN>) id 1heSaB-00056F-K1
 for submit <at> debbugs.gnu.org; Fri, 21 Jun 2019 19:04:36 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:34676)
 by lists.gnu.org with esmtp (Exim 4.86_2)
 (envelope-from <jayden@HIDDEN>) id 1heSa3-0000mb-BV
 for bug-gnu-emacs@HIDDEN; Fri, 21 Jun 2019 19:04:31 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,HTML_MESSAGE,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <jayden@HIDDEN>) id 1heSZu-0007aK-OV
 for bug-gnu-emacs@HIDDEN; Fri, 21 Jun 2019 19:04:22 -0400
Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]:45699)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <jayden@HIDDEN>) id 1heSZs-0006pu-VX
 for bug-gnu-emacs@HIDDEN; Fri, 21 Jun 2019 19:04:18 -0400
Received: by mail-lj1-x22a.google.com with SMTP id m23so7292945lje.12
 for <bug-gnu-emacs@HIDDEN>; Fri, 21 Jun 2019 16:03:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=yugabyte-com.20150623.gappssmtp.com; s=20150623;
 h=mime-version:from:date:message-id:subject:to;
 bh=+DzzX/wEvmBECHFrZ8vZUaoXkFDeDbljPvQm6lcAAZY=;
 b=bZBEMjnVBjBRW2AX2xZvhmtIsQcVzOzg9i77rvL+Lzzui0Tqw67AsdJro8VpZXIrtz
 Q3Sgl03YBAWqPTtq66QnPT+oB53CfXPWYZj1Ohdt6jh7iDyV6JvnDxw2hHlNIG3EX635
 Tpyi0nZggvIvsqlR00cuEFAzpeQYFVWEERnKUla6SIzW2KD/N4pYoeOt2qoEXfq3pEnw
 7EmM397G9w96HI3vOWB5cyn1FeEK4e4xPOQ22O0cG8Som8xTU3c9Jm9xNEAQygbZnxcy
 1lYsxDQCyn1vZoI0wGvFZAB2WndjenOaxu/jqeeRCDv6w9RfG8Q46ZO5HJZtr7qPXFI4
 OfUA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=+DzzX/wEvmBECHFrZ8vZUaoXkFDeDbljPvQm6lcAAZY=;
 b=kvV514qac51QOWe8k/Ot89hqGh3U0NXd9tMekJpLBmHswV66li4X1PT3t+o3GH8Ugh
 i5XKCb20SBoUdQmWbqnf5aWNlY0WTdkK8Do0h4K/hLSn3qFIzG/YRsBieUEnJNmy8/xd
 sEHP5XWnDlKplRy9Vb9O3lzBMpUA0rHBjLgrZoCVDRHGKmoN7tH1uAIjUEfL9fL1aiOQ
 g7XYd2JjFIJdpctdbiJPp9ZjNdGv7Kyi2ctROkvYJHqSgHt8OFJiucU81Lq9B7YRf2Xg
 fEWXOUvAaE1cCIYHVpXJeUQ367BLJBwnWZlFr4exF+jWLPP599cXuZMMNHO+qlAJDyCZ
 xuTA==
X-Gm-Message-State: APjAAAVpoV3NBgJBlQXqbJNetKm9+Ln3p6YYgedqcPhJ4R0tR+n9l1Bj
 tPnQ6gdK6as2n+IeJcT6bAfNfD3drLsQLx+tbRKqX0SsaGDyCw==
X-Google-Smtp-Source: APXvYqyVMhmvSi/dmqUnCl6s1vDEl2EL3XmBZog9m7p+PMup7QOVSnpRSPHsjX4osMym6xx1s4qPOeA6XbdgzShnah0=
X-Received: by 2002:a2e:29c4:: with SMTP id p65mr46157311ljp.141.1561158233922; 
 Fri, 21 Jun 2019 16:03:53 -0700 (PDT)
MIME-Version: 1.0
From: Jayden Navarro <jayden@HIDDEN>
Date: Fri, 21 Jun 2019 16:03:43 -0700
Message-ID: <CAEKiUEZRDN7CRuQgcAPg8SxrAD-7jSdp28Rb6+5TEANfK8XPVQ@HIDDEN>
Subject: 26.2; Args out of range on search-and-replace of *.cc file
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary="000000000000f8ad77058bdd79d4"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::22a
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 21 Jun 2019 19:10:05 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--000000000000f8ad77058bdd79d4
Content-Type: text/plain; charset="UTF-8"

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgment at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from 'emacs -Q':

Fill a *.cc file with 100 lines of any string (e.g. "bar"). At line 101
write a unique string (e.g. "foo"). Close the file and reopen (emacs -Q)
and perform search-and-replace on "foo" (replacing with any other string).
At this point you should see "Args out of range: #<buffer test.cc>, 0, 1".

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    'bt full' and 'xbacktrace'.
For information about debugging Emacs, please read the file
/usr/local/Cellar/emacs/26.2/share/emacs/26.2/etc/DEBUG.

In GNU Emacs 26.2 (build 1, x86_64-apple-darwin18.5.0)
 of 2019-04-13 built on Mojave-2.local
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --disable-dependency-tracking --disable-silent-rules
 --enable-locallisppath=/usr/local/share/emacs/site-lisp
 --infodir=/usr/local/Cellar/emacs/26.2/share/info/emacs
 --prefix=/usr/local/Cellar/emacs/26.2 --with-gnutls --without-x
 --with-xml2 --without-dbus --with-modules --without-ns
 --without-imagemagick'

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB MODULES THREADS

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: C++//l

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
mml-sec password-cache epa derived epg epg-config gnus-util rmail
tool-bar rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils cc-mode cc-fonts easymenu cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt
cl-loaddefs cl-lib term/xterm xterm time-date elec-pair mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese composite
charscript charprop case-table epa-hook jka-cmpr-hook help simple abbrev
obarray minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote threads
kqueue multi-tty make-network-process emacs)

Memory information:
((conses 16 114832 6835)
 (symbols 48 21718 1)
 (miscs 40 36 157)
 (strings 32 33556 1381)
 (string-bytes 1 1027563)
 (vectors 16 14526)
 (vector-slots 8 479822 7914)
 (floats 8 49 415)
 (intervals 56 205 0)
 (buffers 992 12))

--000000000000f8ad77058bdd79d4
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><font face=3D"courier new, monospace">This bug report will=
 be sent to the Bug-GNU-Emacs mailing list<br>and the GNU bug tracker at <a=
 href=3D"http://debbugs.gnu.org">debbugs.gnu.org</a>.=C2=A0 Please check th=
at<br>the From: line contains a valid email address.=C2=A0 After a delay of=
 up<br>to one day, you should receive an acknowledgment at that address.<br=
><br>Please write in English if possible, as the Emacs maintainers<br>usual=
ly do not have translators for other languages.<br><br>Please describe exac=
tly what actions triggered the bug, and<br>the precise symptoms of the bug.=
=C2=A0 If you can, give a recipe<br>starting from &#39;emacs -Q&#39;:<br><b=
r>Fill a *.cc file with 100 lines of any string (e.g. &quot;bar&quot;). At =
line 101<br>write a unique string (e.g. &quot;foo&quot;). Close the file an=
d reopen (emacs -Q)<br>and perform search-and-replace on &quot;foo&quot; (r=
eplacing with any other string).</font><div><font face=3D"courier new, mono=
space">At this point you should see=C2=A0</font><span style=3D"font-family:=
&quot;courier new&quot;,monospace">&quot;Args out of range: #&lt;buffer tes=
t.cc&gt;, 0, 1&quot;.</span><div><font face=3D"courier new, monospace"><br>=
If Emacs crashed, and you have the Emacs process in the gdb debugger,<br>pl=
ease include the output from the following gdb commands:<br>=C2=A0 =C2=A0 &=
#39;bt full&#39; and &#39;xbacktrace&#39;.<br>For information about debuggi=
ng Emacs, please read the file<br>/usr/local/Cellar/emacs/26.2/share/emacs/=
26.2/etc/DEBUG.<br><br>In GNU Emacs 26.2 (build 1, x86_64-apple-darwin18.5.=
0)<br>=C2=A0of 2019-04-13 built on Mojave-2.local<br>Recent messages:<br>Fo=
r information about GNU Emacs and the GNU system, type C-h C-a.<br><br>Conf=
igured using:<br>=C2=A0&#39;configure --disable-dependency-tracking --disab=
le-silent-rules<br>=C2=A0--enable-locallisppath=3D/usr/local/share/emacs/si=
te-lisp<br>=C2=A0--infodir=3D/usr/local/Cellar/emacs/26.2/share/info/emacs<=
br>=C2=A0--prefix=3D/usr/local/Cellar/emacs/26.2 --with-gnutls --without-x<=
br>=C2=A0--with-xml2 --without-dbus --with-modules --without-ns<br>=C2=A0--=
without-imagemagick&#39;<br><br>Configured features:<br>NOTIFY ACL GNUTLS L=
IBXML2 ZLIB MODULES THREADS<br></font><div><font face=3D"courier new, monos=
pace"><br></font></div><div><font face=3D"courier new, monospace">Important=
 settings:<br>=C2=A0 value of $LANG: en_US.UTF-8<br>=C2=A0 locale-coding-sy=
stem: utf-8-unix<br><br>Major mode: C++//l<br><br>Minor modes in effect:<br=
>=C2=A0 tooltip-mode: t<br>=C2=A0 global-eldoc-mode: t<br>=C2=A0 electric-i=
ndent-mode: t<br>=C2=A0 menu-bar-mode: t<br>=C2=A0 file-name-shadow-mode: t=
<br>=C2=A0 global-font-lock-mode: t<br>=C2=A0 font-lock-mode: t<br>=C2=A0 a=
uto-composition-mode: t<br>=C2=A0 auto-encryption-mode: t<br>=C2=A0 auto-co=
mpression-mode: t<br>=C2=A0 line-number-mode: t<br>=C2=A0 transient-mark-mo=
de: t<br>=C2=A0 abbrev-mode: t<br><br>Load-path shadows:<br>None found.<br>=
<br>Features:<br>(shadow sort mail-extr emacsbug message rmc puny seq byte-=
opt gv<br>bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc8=
22 mml<br>mml-sec password-cache epa derived epg epg-config gnus-util rmail=
<br>tool-bar rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc223=
1<br>mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums<br=
>mm-util mail-prsvr mail-utils cc-mode cc-fonts easymenu cc-guess<br>cc-men=
us cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt<br>cl-lo=
addefs cl-lib term/xterm xterm time-date elec-pair mule-util<br>tooltip eld=
oc electric uniquify ediff-hook vc-hooks lisp-float-type<br>tabulated-list =
replace newcomment text-mode elisp-mode lisp-mode<br>prog-mode register pag=
e menu-bar rfn-eshadow isearch timer select mouse<br>jit-lock font-lock syn=
tax facemenu font-core term/tty-colors frame<br>cl-generic cham georgian ut=
f-8-lang misc-lang vietnamese tibetan thai<br>tai-viet lao korean japanese =
eucjp-ms cp51932 hebrew greek romanian<br>slovak czech european ethiopic in=
dian cyrillic chinese composite<br>charscript charprop case-table epa-hook =
jka-cmpr-hook help simple abbrev<br>obarray minibuffer cl-preloaded nadvice=
 loaddefs button faces cus-face<br>macroexp files text-properties overlay s=
ha1 md5 base64 format env<br>code-pages mule custom widget hashtable-print-=
readable backquote threads<br>kqueue multi-tty make-network-process emacs)<=
br><br>Memory information:<br>((conses 16 114832 6835)<br>=C2=A0(symbols 48=
 21718 1)<br>=C2=A0(miscs 40 36 157)<br>=C2=A0(strings 32 33556 1381)<br>=
=C2=A0(string-bytes 1 1027563)<br>=C2=A0(vectors 16 14526)<br>=C2=A0(vector=
-slots 8 479822 7914)<br>=C2=A0(floats 8 49 415)<br>=C2=A0(intervals 56 205=
 0)<br>=C2=A0(buffers 992 12))</font><br></div></div></div></div>

--000000000000f8ad77058bdd79d4--




Acknowledgement sent to Jayden Navarro <jayden@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#36328; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 5 Jul 2019 19:15:01 UTC

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