[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory
From: |
Eduardo A . Bustamante López |
Subject: |
Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory |
Date: |
Thu, 28 Sep 2017 10:14:11 -0500 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
On Thu, Sep 28, 2017 at 11:44:02AM +0200, Mikulas Patocka wrote:
[...]
> +++ bash/variables.c
> @@ -899,7 +899,7 @@ set_pwd ()
> don't find OLDPWD in the environment, or it doesn't name a directory,
> make a dummy invisible variable for OLDPWD, and mark it as exported. */
> temp_var = find_variable ("OLDPWD");
> - if (temp_var == 0 || value_cell (temp_var) == 0 || file_isdir (value_cell
> (temp_var)) == 0)
> + if (temp_var == 0 || value_cell (temp_var) == 0)
> {
> temp_var = bind_variable ("OLDPWD", (char *)NULL, 0);
This patch would revert the change introduced in:
http://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=e6f5e0c858b7c0839d346d7d55e56894648c5a33
Which was prompted by the following bug report from John Wiersba:
https://lists.gnu.org/archive/html/bug-bash/2015-11/msg00115.html
Correct me if I'm wrong, but a hanged sshfs mount will cause many more
issues, not only with OLDPWD.
I tried the following:
dualbus@ubuntu:~/test$ ls -l
total 4
drwxr-xr-x 2 dualbus dualbus 4096 sep 28 10:05 host
dualbus@ubuntu:~/test$ sshfs $host: host
dualbus@ubuntu:~/test$ ls -ld host
drwxr-xr-x 1 dualbus dualbus 20480 sep 28 08:15 host
dualbus@ubuntu:~/test$ cd host
dualbus@ubuntu:~/test/host$ pwd
/home/dualbus/test/host
dualbus@ubuntu:~/test/host$ cd ..
dualbus@ubuntu:~/test$ df host | sed "s/$host/<host>/"
Filesystem 1K-blocks Used Available Use% Mounted on
<host>: 20511592 13003368 6452528 67% /home/dualbus/test/host
dualbus@ubuntu:~/test$ sudo iptables -A OUTPUT -p tcp -d $host -j DROP
dualbus@ubuntu:~/test$ ls
^C^C^C^C^C
Also tried:
cd ho<TAB> # hangs
cd host # hangs
ls -l host # hangs
So in my opinion, it's not worth to revert this change given that you'll have
many more troubles with a hanged network filesystem.
Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory, Mikulas Patocka, 2017/09/29