From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Jayden Navarro 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 14:27:00 -0700 Message-ID: References: <20190622132549.84518.qmail@mail.muc.de> <20190622205033.GA9167@ACM> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000000380de058bf03e64" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="206081"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 36328@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 22 23:28:12 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 1henYR-000rSs-Tw for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Jun 2019 23:28:12 +0200 Original-Received: from localhost ([::1]:42448 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1henYQ-00087V-CN for geb-bug-gnu-emacs@m.gmane.org; Sat, 22 Jun 2019 17:28:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49883) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1henYK-000861-Nz for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2019 17:28:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1henYJ-0001pY-2M for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2019 17:28:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39056) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1henYI-0001nt-JM for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2019 17:28:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1henYI-0005ab-D9 for bug-gnu-emacs@gnu.org; Sat, 22 Jun 2019 17:28:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jayden Navarro Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Jun 2019 21:28: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.156123884421436 (code B ref 36328); Sat, 22 Jun 2019 21:28:02 +0000 Original-Received: (at 36328) by debbugs.gnu.org; 22 Jun 2019 21:27:24 +0000 Original-Received: from localhost ([127.0.0.1]:52600 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1henXf-0005Zf-Un for submit@debbugs.gnu.org; Sat, 22 Jun 2019 17:27:24 -0400 Original-Received: from mail-lj1-f180.google.com ([209.85.208.180]:44067) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1henXa-0005ZN-I6 for 36328@debbugs.gnu.org; Sat, 22 Jun 2019 17:27:19 -0400 Original-Received: by mail-lj1-f180.google.com with SMTP id k18so9027214ljc.11 for <36328@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) In-Reply-To: <20190622205033.GA9167@ACM> 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:161062 Archived-At: --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 bar (note that it's still 0, 1 not 0, 3!): Debugger entered--Lisp error: (args-out-of-range # 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 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 > > > > > 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). > --0000000000000380de058bf03e64 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Alan,

Yes, you are completely correc= t :-) 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 n= ot 0, 3!):

Debugger entered--Lisp error: (args-out= -of-range #<buffer test.cc> 0 1)
=C2=A0 buffer-substring-no-proper= ties(0 1)
=C2=A0 perform-replace("foo" "bar" t nil n= il nil nil nil nil nil nil)
=C2=A0 query-replace("foo" "b= ar" nil nil nil nil nil)
=C2=A0 funcall-interactively(query-replace= "foo" "bar" nil nil nil nil nil)
=C2=A0 call-intera= ctively(query-replace nil nil)
=C2=A0 command-execute(query-replace)
=

= Thank you for your help!

B= est,
Jayden


On Sat, Jun 22= , 2019 at 1:50 PM Alan Mackenzie <acm@muc.= de> wrote: