GNU bug report logs - #72977
28.2; DOS in Shell-script mode

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: Chris Moore <christopher.ian.moore@HIDDEN>; dated Mon, 2 Sep 2024 16:27:04 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 72977) by debbugs.gnu.org; 4 Sep 2024 12:55:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 04 08:55:15 2024
Received: from localhost ([127.0.0.1]:33828 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1slpXW-0000PY-Nr
	for submit <at> debbugs.gnu.org; Wed, 04 Sep 2024 08:55:15 -0400
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:54261)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1slpXU-0000PK-BJ
 for 72977 <at> debbugs.gnu.org; Wed, 04 Sep 2024 08:55:12 -0400
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E89C8100045;
 Wed,  4 Sep 2024 08:54:00 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1725454439;
 bh=0KpblTbbwZvb4uzO1LCulnTKKcjrD2qaJFQ7oyHw8j4=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=o1yhmHgqN8+sK/U2I7H4ny8CAmuogxYvyPtnAltoKLro4R916f+Qu56MApkOLXNNK
 XRaQSQS9y7GwDg0BohykVlvFCslTzW2ab9IlVTFEIg5vxbu2MLmoFFxODKK/xYEYqp
 gBA3H/eFcGoDqEikS4Hh4o4vtY0Xke/9QcwUm+HhP8b6EfMlEqPtZYF0qzxUIGD6/F
 gIe/bbZFTsEyNpMAH8ita9alpTi3nBU6/+/VdsKoQ6gocTEbL+J1hYIv5slWQ3KrfK
 pzg800tNnLvaUk/tkrNwVwDu7PvHHPDyeU/v2mD023PsaguoTjVh6VRF9ubJHJqxZS
 JyYiM8k1OIjyw==
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 968A7100035;
 Wed,  4 Sep 2024 08:53:59 -0400 (EDT)
Received: from asado (169.183.173.62.cust.ip.kpnqwest.it [62.173.183.169])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BE72812031C;
 Wed,  4 Sep 2024 08:53:58 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#72977: 28.2; DOS in Shell-script mode
In-Reply-To: <861q227yl3.fsf@HIDDEN> (Eli Zaretskii's message of "Mon, 02 Sep
 2024 20:30:16 +0300")
Message-ID: <jwv4j6vy4m3.fsf-monnier+emacs@HIDDEN>
References: <CAMN9hAV3tzuvAh9ZvZWFB4jDZxjbRAyZ8no8u_0tVknSBWLKMA@HIDDEN>
 <861q227yl3.fsf@HIDDEN>
Date: Wed, 04 Sep 2024 08:53:55 -0400
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
 DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from
 domain T_SCC_BODY_TEXT_LINE    -0.01 -
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72977
Cc: 72977 <at> debbugs.gnu.org, Chris Moore <christopher.ian.moore@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 (---)

>> echo in in in in in in in in in in in in in in in in in in in in in in i=
n in in in in in in in
>>=20
>> After about 20 'in's, things slow down noticeably, and I can't get to 30=
 without it hanging.
>
> The profile is below.  Maybe Stefan (CC'ed) has some comments or
> suggestions.
>
>        36361  58% - timer-event-handler
>        36361  58%  - apply
>        36361  58%   - show-paren-function
>        36361  58%    - #<advice 1DA>
>        36361  58%     - apply
>        36361  58%      - smie--matching-block-data
>        36359  58%       - smie--opener/closer-at-point
>        36068  57%        - sh-smie-sh-forward-token
>        23841  38%         - sh-smie--sh-keyword-p
>        23841  38%          - sh-smie--sh-keyword-in/do-p
>        23841  38%           - sh-smie-sh-backward-token
>        23837  38%            - sh-smie--sh-keyword-p
>        23837  38%             - sh-smie--sh-keyword-in/do-p
>        23837  38%              - sh-smie-sh-backward-token
>        23805  38%               - sh-smie--sh-keyword-p
>        23801  38%                - sh-smie--sh-keyword-in/do-p
>        23793  38%                 - sh-smie-sh-backward-token
>        23685  38%                  - sh-smie--sh-keyword-p
[...]

Hmm... indeed, in order to decide whether a given `in` is a keyword
rather than just some command's argument, we need to look back, so we
probably have an O(N=B2) situation here, where we walk backward over all
the `in`s in order to decide whether the last one is a keyword.  Then we
do the same starting from the "last but one" (because the check for
keyword-p was only made to decide how to skip that last token), etc...

In theory we could do it more efficiently by integrating better the
keyword-p check and the navigation to the beginning of a command, but it
requires a different structure than the one we're using.

Another solution is to use a cache (which could simply memoize the
output of `sh-smie--sh-keyword-p`) which we could flush from
`after-change-functions`.

Yet another (more ad-hoc) approach might be to try and keep track of the
nesting, and let `sh-smie--sh-keyword-p` return nil when we reach
a nesting of say 2 (at least for `in` I can't think of a piece of code
where the 3rd (or subsequent) `in` can be a keyword).


        Stefan





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

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


Received: (at 72977) by debbugs.gnu.org; 2 Sep 2024 17:33:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 02 13:33:41 2024
Received: from localhost ([127.0.0.1]:50255 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1slAvs-0006hY-RB
	for submit <at> debbugs.gnu.org; Mon, 02 Sep 2024 13:33:41 -0400
Received: from eggs.gnu.org ([209.51.188.92]:45978)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1slAvp-0006hD-SR
 for 72977 <at> debbugs.gnu.org; Mon, 02 Sep 2024 13:33:39 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1slAsf-0007zb-M2; Mon, 02 Sep 2024 13:30:21 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=CZfH5RCXMZgl5LZ51L9En7k7p2+bpVTjUcvPF8GEwYw=; b=h8F2bsng4PIO
 Tj44j8hsWDsVvsvgEqem6Tbk4facjBHQkRUFme3j6i+z1IiV4ZlgLg8DqQPTxShVTNLYyKe9uPJ/u
 YgHCj6cQ+NNuU3u7p+o85+vcSd7OAUTLUX7p9TpRLMkLu92O/Ezqgzs/xcCXw/RSbzi5oJg36UIp7
 1FrIHzRsN98ORLn1aCexDezfoY8YMtYxeUg9UEsQGJ/aoAzSIGcn4sTe50sdR8xCqnS563a8Ub9uR
 6r9opk+b6O39Tkt8KmF3MGt2ysP2Hk4Hp9GX8aD5yKtgmkFbKW12Uq9hLRQLHIijW1bIP9YXhATbX
 E6uk8PHFJVC1zuxQdFf/xg==;
Date: Mon, 02 Sep 2024 20:30:16 +0300
Message-Id: <861q227yl3.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Chris Moore <christopher.ian.moore@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
In-Reply-To: <CAMN9hAV3tzuvAh9ZvZWFB4jDZxjbRAyZ8no8u_0tVknSBWLKMA@HIDDEN>
 (message from Chris Moore on Mon, 2 Sep 2024 12:35:18 -0300)
Subject: Re: bug#72977: 28.2; DOS in Shell-script mode
References: <CAMN9hAV3tzuvAh9ZvZWFB4jDZxjbRAyZ8no8u_0tVknSBWLKMA@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72977
Cc: 72977 <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: -3.3 (---)

> From: Chris Moore <christopher.ian.moore@HIDDEN>
> Date: Mon, 2 Sep 2024 12:35:18 -0300
> 
> I've been seeing Emacs hang up repeatedly for no apparent reason recently while editing shell scripts. I spent
> the time to isolate the issue. It turns out that I can reproduce the issue by opening a new shell script file and
> typing the word "in" 20 or 30 times on a single line:
> 
> $ emacs -Q
> C-x C-f /tmp/x.sh
> echo in in in in in in in in in in in in in in in in in in in in in in in in in in in in in in
> 
> After about 20 'in's, things slow down noticeably, and I can't get to 30 without it hanging.

The profile is below.  Maybe Stefan (CC'ed) has some comments or
suggestions.

       36361  58% - timer-event-handler
       36361  58%  - apply
       36361  58%   - show-paren-function
       36361  58%    - #<advice 1DA>
       36361  58%     - apply
       36361  58%      - smie--matching-block-data
       36359  58%       - smie--opener/closer-at-point
       36068  57%        - sh-smie-sh-forward-token
       23841  38%         - sh-smie--sh-keyword-p
       23841  38%          - sh-smie--sh-keyword-in/do-p
       23841  38%           - sh-smie-sh-backward-token
       23837  38%            - sh-smie--sh-keyword-p
       23837  38%             - sh-smie--sh-keyword-in/do-p
       23837  38%              - sh-smie-sh-backward-token
       23805  38%               - sh-smie--sh-keyword-p
       23801  38%                - sh-smie--sh-keyword-in/do-p
       23793  38%                 - sh-smie-sh-backward-token
       23685  38%                  - sh-smie--sh-keyword-p
       23681  38%                   - sh-smie--sh-keyword-in/do-p
       23665  37%                    - sh-smie-sh-backward-token
       23425  37%                     - sh-smie--sh-keyword-p
       23409  37%                      - sh-smie--sh-keyword-in/do-p
       23349  37%                       - sh-smie-sh-backward-token
       13623  21%                          looking-back
        6152   9%                          sh-smie--default-backward-token
        3368   5%                        - sh-smie--sh-keyword-p
        1655   2%                           sh-smie--sh-keyword-in/do-p
          28   0%                         assoc
         136   0%                       looking-back
          44   0%                       sh-smie--default-backward-token
           8   0%                      assoc
          64   0%                    looking-back
          20   0%                    sh-smie--default-backward-token
           4   0%                   assoc
          16   0%                 sh-smie--default-backward-token
           8   0%                 looking-back
           4   0%              sh-smie--default-backward-token
       12227  19%         - sh-smie--newline-semi-p
       12227  19%          - sh-smie-sh-backward-token
       12227  19%           - sh-smie--sh-keyword-p
       12227  19%            - sh-smie--sh-keyword-in/do-p
       12227  19%             - sh-smie-sh-backward-token
       12227  19%              - sh-smie--sh-keyword-p
       12227  19%               - sh-smie--sh-keyword-in/do-p
       12227  19%                - sh-smie-sh-backward-token
       12223  19%                 - sh-smie--sh-keyword-p
       12223  19%                  - sh-smie--sh-keyword-in/do-p
       12223  19%                   - sh-smie-sh-backward-token
       12203  19%                    - sh-smie--sh-keyword-p
       12203  19%                     - sh-smie--sh-keyword-in/do-p
       12199  19%                      - sh-smie-sh-backward-token
       12143  19%                       - sh-smie--sh-keyword-p
       12143  19%                        - sh-smie--sh-keyword-in/do-p
       10012  16%                           sh-smie-sh-backward-token
        2119   3%                           assoc
          36   0%                         looking-back
 [...]
       25633  41%   Automatic GC




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

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


Received: (at submit) by debbugs.gnu.org; 2 Sep 2024 16:26:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 02 12:26:19 2024
Received: from localhost ([127.0.0.1]:49999 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sl9sh-0004Dr-1N
	for submit <at> debbugs.gnu.org; Mon, 02 Sep 2024 12:26:19 -0400
Received: from lists.gnu.org ([209.51.188.17]:52824)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <christopher.ian.moore@HIDDEN>) id 1sl971-0002Lw-1k
 for submit <at> debbugs.gnu.org; Mon, 02 Sep 2024 11:37:03 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <christopher.ian.moore@HIDDEN>)
 id 1sl960-0003WS-Gj
 for bug-gnu-emacs@HIDDEN; Mon, 02 Sep 2024 11:36:01 -0400
Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <christopher.ian.moore@HIDDEN>)
 id 1sl95y-0004Dg-9L
 for bug-gnu-emacs@HIDDEN; Mon, 02 Sep 2024 11:36:00 -0400
Received: by mail-wm1-x336.google.com with SMTP id
 5b1f17b1804b1-42bb6d3e260so37631875e9.1
 for <bug-gnu-emacs@HIDDEN>; Mon, 02 Sep 2024 08:35:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1725291355; x=1725896155; darn=gnu.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=QUZQgcmKSF0FJzKZa4x6JYTU4bmA0HJURDU2lhsMrrQ=;
 b=ZQa43tdg8eXCk6+g/3q+ip1IP7kQKZbM2XFxiFhdhlqBslF2dHIzP16VhNlRXrFCix
 K9EUIBgxpsusurMxmS7mghK/LnM1Tkv4Ru8ueHrgDBr/k10zknNqH74Qr+KnxmoocD1G
 0HUOkGvJICRFfIqjb9N4rFBeN5zqtGMJbHgJNO44Mt1W2zVj7P6tKMOlqz3X9i6t1EPA
 IoYOkj3X1w3IEdnvBgDeLa5CDE6yd5NKB/xUIuwNWgPaGxZK8Ec/INwBnljmSJgOq/9T
 Evl5uM+YjYPKmuAUZomjkMCY6m1IIsJX+R8dex3SjyHQ5CRoqjpNxgOux9dBVzuXHFfy
 Sg8Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1725291355; x=1725896155;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=QUZQgcmKSF0FJzKZa4x6JYTU4bmA0HJURDU2lhsMrrQ=;
 b=njhzIJ7CG7t2PIc8AiMHbNPG9fHmOZQir9xwAIZbhBZzoXi9dXGnkcidnQTApGgB+z
 1jeuyS8kUe0fMcWEYVNm53C8Wwz5V9VCPfYf4hQYMOycvfhel126XnGZGjWpfJwgGcAw
 WSpmq9MCSLJxIbIAlUH/fziqWaRU1ujVmjl5dZSJx2BdhtAQttPip2X02SggDh69nvHn
 q+ZHCZYo3quQr1pKyajvzOTEs2GqzwshTQFPBadK//gIL8Aumw5s1Iwshp3hTOEKW74w
 bYcQpAWs4G36+H1aijvtc9HxxVXZDJ7n8OrUz609aBML0ykfBgxFj4JdMt9jn8kxGcxX
 F5uw==
X-Gm-Message-State: AOJu0YxaRO+2FCjcXrWwsaB/4QRXyqbwvtTrr5UusMNBf+WuhNDjB5iQ
 GVdI4gY2a1FWnrt6fBrwlDFIAuWACtqP36nh4r68wZjyc4tP5kAkmliQrUb91uaMsLPEn/PVRLE
 Zs1Kwe66nNxMdCk77qSzVpf/X6/O02a1W
X-Google-Smtp-Source: AGHT+IFgdbMSYPLWE2tOWJ4h3zL2dJazZt7knRq0uPG1nNHLqo75Y68zQMpMbK3Frmsy4QBjheoipnwVQ4ZySWCHSc4=
X-Received: by 2002:a05:600c:34c6:b0:426:6921:e3e5 with SMTP id
 5b1f17b1804b1-42bdc64e47fmr48603905e9.24.1725291354372; Mon, 02 Sep 2024
 08:35:54 -0700 (PDT)
MIME-Version: 1.0
From: Chris Moore <christopher.ian.moore@HIDDEN>
Date: Mon, 2 Sep 2024 12:35:18 -0300
Message-ID: <CAMN9hAV3tzuvAh9ZvZWFB4jDZxjbRAyZ8no8u_0tVknSBWLKMA@HIDDEN>
Subject: 28.2; DOS in Shell-script mode
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary="0000000000004fc489062124b2d7"
Received-SPF: pass client-ip=2a00:1450:4864:20::336;
 envelope-from=christopher.ian.moore@HIDDEN; helo=mail-wm1-x336.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 02 Sep 2024 12:26:14 -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: -2.3 (--)

--0000000000004fc489062124b2d7
Content-Type: text/plain; charset="UTF-8"

I've been seeing Emacs hang up repeatedly for no apparent reason recently
while editing shell scripts. I spent the time to isolate the issue. It
turns out that I can reproduce the issue by opening a new shell script file
and typing the word "in" 20 or 30 times on a single line:

$ emacs -Q
C-x C-f /tmp/x.sh
echo in in in in in in in in in in in in in in in in in in in in in in in
in in in in in in in

After about 20 'in's, things slow down noticeably, and I can't get to 30
without it hanging.

I fixed the issue by replacing "in" with "'in'" in my script.


In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
cairo version 1.16.0)
 of 2024-06-25, modified by Debian built on x86-conova-01
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --with-cairo --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/reproducible-path/emacs-28.2+1=.
-fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

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

Major mode: Shell-script

Minor modes in effect:
  sh-electric-here-document-mode: t
  display-time-mode: t
  global-so-long-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-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
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny rfc822 mml mml-sec epa
derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs time-date
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail comp comp-cstr warnings cl-extra help-mode rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils sh-script smie
executable dired-aux term/screen term/xterm xterm cus-edit pp cus-start
wid-edit ido time cus-load wdired dired dired-loaddefs so-long shell
pcomplete rust-utils thingatpt rust-mode rx rust-rustfmt rust-playpen
rust-compile compile text-property-search comint ansi-color ring
rust-cargo finder-inf package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib iso-transl
tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer 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 emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 199366 8596)
 (symbols 48 13308 1)
 (strings 32 65460 2058)
 (string-bytes 1 1538163)
 (vectors 16 22561)
 (vector-slots 8 424286 17680)
 (floats 8 62 347)
 (intervals 56 1790 178)
 (buffers 992 17))

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

<div dir=3D"ltr"><div>I&#39;ve been seeing Emacs hang up repeatedly for no =
apparent reason recently while editing shell scripts. I spent the time to i=
solate the issue. It turns out that I can reproduce the issue by opening a =
new shell script file and typing the word &quot;in&quot; 20 or 30 times on =
a single line:</div><div><br></div><div style=3D"margin-left:40px"><span st=
yle=3D"font-family:monospace">$ emacs -Q<br>C-x C-f /tmp/x.sh<br>echo in in=
 in in in in in in in in in in in in in in in in in in in in in in in in in=
 in in in</span></div><div><br></div><div>After about 20 &#39;in&#39;s, thi=
ngs slow down noticeably, and I can&#39;t get to 30 without it hanging.</di=
v><div><br></div><div>I fixed the issue by replacing &quot;in&quot; with &q=
uot;&#39;in&#39;&quot; in my script.</div><div><br></div><div><br></div><di=
v>In GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, ca=
iro version 1.16.0)</div>=C2=A0of 2024-06-25, modified by Debian built on x=
86-conova-01<br>System Description: Debian GNU/Linux 12 (bookworm)<br><br>C=
onfigured using:<br>=C2=A0&#39;configure --build x86_64-linux-gnu --prefix=
=3D/usr<br>=C2=A0--sharedstatedir=3D/var/lib --libexecdir=3D/usr/libexec<br=
>=C2=A0--localstatedir=3D/var/lib --infodir=3D/usr/share/info<br>=C2=A0--ma=
ndir=3D/usr/share/man --with-libsystemd --with-pop=3Dyes<br>=C2=A0--enable-=
locallisppath=3D/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local=
/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/sit=
e-lisp<br>=C2=A0--with-sound=3Dalsa --without-gconf --with-mailutils<br>=C2=
=A0--with-native-compilation --build x86_64-linux-gnu --prefix=3D/usr<br>=
=C2=A0--sharedstatedir=3D/var/lib --libexecdir=3D/usr/libexec<br>=C2=A0--lo=
calstatedir=3D/var/lib --infodir=3D/usr/share/info<br>=C2=A0--mandir=3D/usr=
/share/man --with-libsystemd --with-pop=3Dyes<br>=C2=A0--enable-locallisppa=
th=3D/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emac=
s/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp<br>=
=C2=A0--with-sound=3Dalsa --without-gconf --with-mailutils<br>=C2=A0--with-=
native-compilation --with-cairo --with-x=3Dyes<br>=C2=A0--with-x-toolkit=3D=
gtk3 --with-toolkit-scroll-bars &#39;CFLAGS=3D-g -O2<br>=C2=A0-ffile-prefix=
-map=3D/build/reproducible-path/emacs-28.2+1=3D. -fstack-protector-strong<b=
r>=C2=A0-Wformat -Werror=3Dformat-security -Wall&#39; &#39;CPPFLAGS=3D-Wdat=
e-time<br>=C2=A0-D_FORTIFY_SOURCE=3D2&#39; LDFLAGS=3D-Wl,-z,relro&#39;<br><=
br>Configured features:<br>ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM =
GSETTINGS HARFBUZZ JPEG<br>JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 =
M17N_FLT MODULES<br>NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOU=
ND THREADS TIFF<br>TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB<br><br>Im=
portant settings:<br>=C2=A0 value of $LANG: en_CA.UTF-8<br>=C2=A0 locale-co=
ding-system: utf-8-unix<br><br>Major mode: Shell-script<br><br>Minor modes =
in effect:<br>=C2=A0 sh-electric-here-document-mode: t<br>=C2=A0 display-ti=
me-mode: t<br>=C2=A0 global-so-long-mode: t<br>=C2=A0 shell-dirtrack-mode: =
t<br>=C2=A0 tooltip-mode: t<br>=C2=A0 global-eldoc-mode: t<br>=C2=A0 show-p=
aren-mode: t<br>=C2=A0 mouse-wheel-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=
 auto-composition-mode: t<br>=C2=A0 auto-encryption-mode: t<br>=C2=A0 auto-=
compression-mode: t<br>=C2=A0 column-number-mode: t<br>=C2=A0 line-number-m=
ode: t<br>=C2=A0 transient-mark-mode: t<br><br>Load-path shadows:<br>None f=
ound.<br><br>Features:<br>(shadow sort mail-extr emacsbug message rmc puny =
rfc822 mml mml-sec epa<br>derived epg rfc6068 epg-config gnus-util rmail rm=
ail-loaddefs time-date<br>mm-decode mm-bodies mm-encode mail-parse rfc2231 =
mailabbrev gmm-utils<br>mailheader sendmail comp comp-cstr warnings cl-extr=
a help-mode rfc2047<br>rfc2045 ietf-drums mm-util mail-prsvr mail-utils sh-=
script smie<br>executable dired-aux term/screen term/xterm xterm cus-edit p=
p cus-start<br>wid-edit ido time cus-load wdired dired dired-loaddefs so-lo=
ng shell<br>pcomplete rust-utils thingatpt rust-mode rx rust-rustfmt rust-p=
laypen<br>rust-compile compile text-property-search comint ansi-color ring<=
br>rust-cargo finder-inf package browse-url url url-proxy url-privacy<br>ur=
l-expand url-methods url-history url-cookie url-domsuf url-util<br>mailcap =
url-handlers url-parse auth-source cl-seq eieio eieio-core<br>cl-macs eieio=
-loaddefs password-cache json subr-x map url-vars seq<br>byte-opt gv byteco=
mp byte-compile cconv cl-loaddefs cl-lib iso-transl<br>tooltip eldoc paren =
electric uniquify ediff-hook vc-hooks<br>lisp-float-type elisp-mode mwheel =
term/x-win x-win term/common-win x-dnd<br>tool-bar dnd fontset image regexp=
-opt fringe tabulated-list replace<br>newcomment text-mode lisp-mode prog-m=
ode register page tab-bar menu-bar<br>rfn-eshadow isearch easymenu timer se=
lect scroll-bar mouse jit-lock<br>font-lock syntax font-core term/tty-color=
s frame minibuffer cl-generic<br>cham georgian utf-8-lang misc-lang vietnam=
ese tibetan thai tai-viet lao<br>korean japanese eucjp-ms cp51932 hebrew gr=
eek romanian slovak czech<br>european ethiopic indian cyrillic chinese comp=
osite emoji-zwj charscript<br>charprop case-table epa-hook jka-cmpr-hook he=
lp simple abbrev obarray<br>cl-preloaded nadvice button loaddefs faces cus-=
face macroexp files<br>window text-properties overlay sha1 md5 base64 forma=
t env code-pages<br>mule custom widget hashtable-print-readable backquote t=
hreads dbusbind<br>inotify lcms2 dynamic-setting system-font-setting font-r=
ender-setting<br>cairo move-toolbar gtk x-toolkit x multi-tty make-network-=
process<br>native-compile emacs)<br><br>Memory information:<br>((conses 16 =
199366 8596)<br>=C2=A0(symbols 48 13308 1)<br>=C2=A0(strings 32 65460 2058)=
<br>=C2=A0(string-bytes 1 1538163)<br>=C2=A0(vectors 16 22561)<br>=C2=A0(ve=
ctor-slots 8 424286 17680)<br>=C2=A0(floats 8 62 347)<br>=C2=A0(intervals 5=
6 1790 178)<br>=C2=A0(buffers 992 17))<br></div>

--0000000000004fc489062124b2d7--




Acknowledgement sent to Chris Moore <christopher.ian.moore@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#72977; 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: Sun, 12 Jan 2025 05:45:02 UTC

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