all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Zhiwei Chen <condy0919@gmail.com>
To: 54384@debbugs.gnu.org
Subject: bug#54384: 29.0.50; shell-resync-dirs failed to work
Date: Mon, 14 Mar 2022 21:56:58 +0800	[thread overview]
Message-ID: <875yog63it.fsf@gmail.com> (raw)

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





             reply	other threads:[~2022-03-14 13:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-14 13:56 Zhiwei Chen [this message]
2022-03-17 13:50 ` bug#54384: 29.0.50; shell-resync-dirs failed to work Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875yog63it.fsf@gmail.com \
    --to=condy0919@gmail.com \
    --cc=54384@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.