From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#36328: 26.2; Args out of range on search-and-replace of *.cc file Date: Sat, 22 Jun 2019 20:50:33 +0000 Message-ID: <20190622205033.GA9167@ACM> References: <20190622132549.84518.qmail@mail.muc.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="51766"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: 36328@debbugs.gnu.org To: Jayden Navarro Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 22 22:51:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hemyd-000DLH-Ks for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Jun 2019 22:51:11 +0200 Original-Received: from localhost ([::1]:42358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hemyc-00084t-IL for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Jun 2019 16:51:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43482) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hemyV-000846-PE for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2019 16:51:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hemyU-0005eJ-M1 for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2019 16:51:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39033) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hemyU-0005eC-HL for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2019 16:51:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hemyU-0004hm-EI for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2019 16:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Jun 2019 20:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36328 X-GNU-PR-Package: emacs Original-Received: via spool by 36328-submit@debbugs.gnu.org id=B36328.156123664218059 (code B ref 36328); Sat, 22 Jun 2019 20:51:02 +0000 Original-Received: (at 36328) by debbugs.gnu.org; 22 Jun 2019 20:50:42 +0000 Original-Received: from localhost ([127.0.0.1]:52577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hemy9-0004hC-1T for submit@debbugs.gnu.org; Sat, 22 Jun 2019 16:50:41 -0400 Original-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 ) id 1hemy6-0004h0-MT for 36328@debbugs.gnu.org; Sat, 22 Jun 2019 16:50:39 -0400 Original-Received: (qmail 5392 invoked by uid 3782); 22 Jun 2019 20:50:35 -0000 Original-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 Original-Received: (qmail 9205 invoked by uid 1000); 22 Jun 2019 20:50:33 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:161057 Archived-At: 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 > > 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 > foo bar Are you _sure_ that's what you typed? ;-) > 7. You should hit: Args out of range: #, 0, 1 > Here's the backtrace when using debug-on-error: > Debugger entered--Lisp error: (args-out-of-range # 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 # 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).