From unknown Sat Jun 14 03:57:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54384: 29.0.50; shell-resync-dirs failed to work Resent-From: Zhiwei Chen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 14 Mar 2022 13:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54384 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 54384@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16472662297973 (code B ref -1); Mon, 14 Mar 2022 13:58:02 +0000 Received: (at submit) by debbugs.gnu.org; 14 Mar 2022 13:57:09 +0000 Received: from localhost ([127.0.0.1]:45881 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTlC8-00024W-KR for submit@debbugs.gnu.org; Mon, 14 Mar 2022 09:57:08 -0400 Received: from lists.gnu.org ([209.51.188.17]:44212) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nTlC6-00024P-ON for submit@debbugs.gnu.org; Mon, 14 Mar 2022 09:57:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:47954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTlC6-0003og-FG for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2022 09:57:06 -0400 Received: from [2607:f8b0:4864:20::52c] (port=35679 helo=mail-pg1-x52c.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nTlC4-0005CX-2n for bug-gnu-emacs@gnu.org; Mon, 14 Mar 2022 09:57:06 -0400 Received: by mail-pg1-x52c.google.com with SMTP id e6so13904645pgn.2 for ; Mon, 14 Mar 2022 06:57:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=AcNQeokagSFu5EqrQwwOOWlfPGiDLE6SKE+MY/i0dJc=; b=nWJqqlssVM/wCt+Nzw8q4FPzLZ+eEb8x/IhHmNc8Je5Pc92uOrByd1dPwqOjATWcC6 oueIRW/AqbXVQZc2+0SYZshvilJhmUlM9s+FYD9PPsxnOAtMo5w5uDvrtuh+cCcrrx81 igeRpLTmR2VnK0nRpCjuQGfBsr0WjL7oqb8mjmGK87jtB8Ow3C4jgH1tMvhTxuwf6Uqe A1jzzwe6fGGVaY7f4oSg6kKQtCuYm+YssGJnB0qvBYs7u1s7RbWS0LzE3E0Sfk94Mc/O 8h0Avwfabi6lZdpv5ZnAwtUlMe0taUKCl1CtdRJPjpLRgHvWjxlMxcmxGlDgA+3tNyPY zx0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=AcNQeokagSFu5EqrQwwOOWlfPGiDLE6SKE+MY/i0dJc=; b=WdiblsrNMWRiOb67juuDg2e/SPIKzyi4tTfF8dbBlXmMeQGCSmslznk4oImPtlhn2O R6FSkqPSpdAr3L6bIzroycNZdziEqwQWli1nNWcS+UgaBaVakQd7v1uki7bwzKQcLuHD 4wk454QZZ/m4aeq8SXRJBvZTYWQkG13BUB98adGHCfLEEEGa+cCzHSNUG6S1bCw37VzH 8FIGQjXWF4C+xhNlHw3moM6KmL8hd7RLyF8xO/EfmzP113HcISAQhc0qo5dNq4VBiYsB FlPLYVi3FY/aN62H0gN/lIx70CdlwuddB3Epmq7CwyTM1lqH7P5s9BhHnEugaauqyo85 38BA== X-Gm-Message-State: AOAM530ryFxUQSp1LTGWaDOhBOENwJuaXqGZWdVhdlT/OQyN+tAQvo+A 2OAQB1Gv4EiDLqhsWuNJJb2IOOeBT/+UPw== X-Google-Smtp-Source: ABdhPJwZ0H7LHhc/WDAuLDLz6YN0Nd4SPdo/WKswEWmFl0IqNwZEAoI0BwdSwyZi8F/1TFkaWctNXA== X-Received: by 2002:a05:6a00:174f:b0:4f3:fe06:61b5 with SMTP id j15-20020a056a00174f00b004f3fe0661b5mr23966519pfc.50.1647266222130; Mon, 14 Mar 2022 06:57:02 -0700 (PDT) Received: from Youmu (192.69.92.236.16clouds.com. [192.69.92.236]) by smtp.gmail.com with ESMTPSA id lb1-20020a17090b4a4100b001bfb76e56d1sm16994377pjb.36.2022.03.14.06.57.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Mar 2022 06:57:01 -0700 (PDT) From: Zhiwei Chen Date: Mon, 14 Mar 2022 21:56:58 +0800 Message-ID: <875yog63it.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::52c (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=condy0919@gmail.com; helo=mail-pg1-x52c.google.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: How to reproduce: emacs -Q M-x shell RET M-x shell-resync-dirs RET Then Emacs will be unresponsive. Fortunately, C-g can quit the function. Before quitting, it's able to trace Emacs via perf. Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [209.51.188.17 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (condy0919[at]gmail.com) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (condy0919[at]gmail.com) 0.0 RCVD_IN_MSPIKE_H5 RBL: Excellent reputation (+5) [209.51.188.17 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders -0.0 T_SCC_BODY_TEXT_LINE No description available. 1.5 SPOOFED_FREEMAIL No description available. 0.8 SPOOF_GMAIL_MID From Gmail but it doesn't seem to be... X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.1 (--) How to reproduce: emacs -Q M-x shell RET M-x shell-resync-dirs RET Then Emacs will be unresponsive. Fortunately, C-g can quit the function. Before quitting, it's able to trace Emacs via perf. #+begin_src sh sudo perf trace -p $(pidof emacs) #+end_src The output tells Emacs is checking whether a path is directory, but it returns false. See the logs below. #+begin_src text 1898.605 ( 0.003 ms): emacs/889479 openat(dfd: CWD, filename: 0x5569b9323b80, flags: RDONLY|CLOEXEC|DIRECTORY|PATH) = -1 ENOENT (No such file or directory) 1898.623 ( 0.003 ms): emacs/889479 openat(dfd: CWD, filename: 0x5569b9323c50, flags: RDONLY|CLOEXEC|DIRECTORY|PATH) = -1 ENOENT (No such file or directory) 1898.639 ( 0.002 ms): emacs/889479 openat(dfd: CWD, filename: 0x5569b9323d20, flags: RDONLY|CLOEXEC|DIRECTORY|PATH) = -1 ENOENT (No such file or directory) 1898.656 ( 0.003 ms): emacs/889479 openat(dfd: CWD, filename: 0x5569b9323df0, flags: RDONLY|CLOEXEC|DIRECTORY|PATH) = -1 ENOENT (No such file or directory) 1898.673 ( 0.002 ms): emacs/889479 openat(dfd: CWD, filename: 0x5569b9323ec0, flags: RDONLY|CLOEXEC|DIRECTORY|PATH) = -1 ENOENT (No such file or directory) 1898.689 ( 0.002 ms): emacs/889479 openat(dfd: CWD, filename: 0x5569b9323f90, flags: RDONLY|CLOEXEC|DIRECTORY|PATH) = -1 ENOENT (No such file or directory) #+end_src Since I'm using zsh, `shell-resync-dirs' will send "dirs -l" to zsh process, then grab and parse the output. * Defect 1 After this while loop https://github.com/emacs-mirror/emacs/blob/f8cc706fb3d1ba30715c09aac9654ba08aeeb5c9/lisp/shell.el#L1072-L1074, the value of `dlsl` is '("-l" "" "dirs"), which means `shell-resync-dirs'' failed to grab/parse the output of `dirs -l'. * Defect 2 The while loop https://github.com/emacs-mirror/emacs/blob/f8cc706fb3d1ba30715c09aac9654ba08aeeb5c9/lisp/shell.el#L1078-L1092 can be infinite. When an element of `dlsl' doesn't exist, `file-directory-p' returns false, then no element of `dlsl' will be poped. An unintentional looping is happening. -- Zhiwei Chen From unknown Sat Jun 14 03:57:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#54384: 29.0.50; shell-resync-dirs failed to work Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Mar 2022 13:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54384 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Zhiwei Chen Cc: 54384@debbugs.gnu.org Received: via spool by 54384-submit@debbugs.gnu.org id=B54384.16475250289984 (code B ref 54384); Thu, 17 Mar 2022 13:51:02 +0000 Received: (at 54384) by debbugs.gnu.org; 17 Mar 2022 13:50:28 +0000 Received: from localhost ([127.0.0.1]:53497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nUqWK-0002ay-88 for submit@debbugs.gnu.org; Thu, 17 Mar 2022 09:50:28 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nUqWI-0002ak-BN for 54384@debbugs.gnu.org; Thu, 17 Mar 2022 09:50:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=xdkvVgijuUyj23QeYKzb97O1i7pyxXIsrXt1+I1BKgw=; b=MO7VqJ2TZ1G7jXzq0zGlfmu9TE DvG0YXJxz3+hriiYFnBeb8sFOfAYNcHNAeUlI3SHZrQX8ukI15ARNNwdjlIYayUgkSoIhBnOID9G7 2uRjks6ae4T3lOL0Jn9jZqZkWNSGIudM63HOxyNHG8MJnZORkAb+Ob65zNuMbdBF9r3I=; Received: from 109.179.236.69.tmi.telenormobil.no ([109.179.236.69] helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nUqW9-00089y-Gx; Thu, 17 Mar 2022 14:50:19 +0100 From: Lars Ingebrigtsen References: <875yog63it.fsf@gmail.com> Date: Thu, 17 Mar 2022 14:50:16 +0100 In-Reply-To: <875yog63it.fsf@gmail.com> (Zhiwei Chen's message of "Mon, 14 Mar 2022 21:56:58 +0800") Message-ID: <877d8su1rb.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Zhiwei Chen writes: > How to reproduce: > emacs -Q > M-x shell RET > M-x shell-resync-dirs RET > > Then Emacs will be unresponsive. Fortunately, C-g can quit the function. I've now fixed this in Emacs 29. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP 0.0 TVD_RCVD_IP Message was received from an IP address -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Zhiwei Chen writes: > How to reproduce: > emacs -Q > M-x shell RET > M-x shell-resync-dirs RET > > Then Emacs will be unresponsive. Fortunately, C-g can quit the function. I've now fixed this in Emacs 29. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 17 09:50:47 2022 Received: (at control) by debbugs.gnu.org; 17 Mar 2022 13:50:47 +0000 Received: from localhost ([127.0.0.1]:53500 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nUqWb-0002ba-Fp for submit@debbugs.gnu.org; Thu, 17 Mar 2022 09:50:47 -0400 Received: from quimby.gnus.org ([95.216.78.240]:48366) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nUqWV-0002bF-FH for control@debbugs.gnu.org; Thu, 17 Mar 2022 09:50:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=FWB6FGn/YTxX1gQrJz3lfqjK8AUh5+mAiE0PeFLFn9s=; b=YEcienG5/juHFaJG6iWDWJ7UnW TTR7PDMhavdyG5UvQ6c46vDJDlGBZfkTJD8d8I8uccUa7dQV83D3RP4Z3UzX9+pxYyEuM1kqNNoQZ DmEz6t9+QMDvabtTYh4hZZCgpUBfr1N0KZgJIYc63UEkGhjVIdraM4A9ySyHOxXWY2eg=; Received: from [109.179.236.69] (helo=xo) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nUqWN-0008AG-PA for control@debbugs.gnu.org; Thu, 17 Mar 2022 14:50:33 +0100 Date: Thu, 17 Mar 2022 14:50:30 +0100 Message-Id: <875yocu1qx.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #54384 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 54384 29.1 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 54384 29.1 quit