GNU bug report logs - #54384
29.0.50; shell-resync-dirs failed to work

Previous Next

Package: emacs;

Reported by: Zhiwei Chen <condy0919 <at> gmail.com>

Date: Mon, 14 Mar 2022 13:58:02 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54384 in the body.
You can then email your comments to 54384 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#54384; Package emacs. (Mon, 14 Mar 2022 13:58:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zhiwei Chen <condy0919 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 14 Mar 2022 13:58:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Zhiwei Chen <condy0919 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; shell-resync-dirs failed to work
Date: Mon, 14 Mar 2022 21:56:58 +0800
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#54384; Package emacs. (Thu, 17 Mar 2022 13:51:02 GMT) Full text and rfc822 format available.

Message #8 received at 54384 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Zhiwei Chen <condy0919 <at> gmail.com>
Cc: 54384 <at> debbugs.gnu.org
Subject: Re: bug#54384: 29.0.50; shell-resync-dirs failed to work
Date: Thu, 17 Mar 2022 14:50:16 +0100
Zhiwei Chen <condy0919 <at> gmail.com> 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




bug marked as fixed in version 29.1, send any further explanations to 54384 <at> debbugs.gnu.org and Zhiwei Chen <condy0919 <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 17 Mar 2022 13:51:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 15 Apr 2022 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 60 days ago.

Previous Next


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