GNU bug report logs -
#54384
29.0.50; shell-resync-dirs failed to work
Previous Next
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.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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
This bug report was last modified 3 years and 61 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.