On Thu, 28 Sep 2017, Eduardo A. Bustamante López wrote:
> 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 This patch doesn't revert the above change. It only removes a test if $OLDPWD is a directory. With this patch, if $OLDPWD points to a directory, there will be no change, and if $OLDPWD points to non-directory, it will not be cleared. > 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. Hung mount shouldn't cause problems unless someone is accessing it. What happened to me - I use the autofs filesystem to automatically mount filesystems on various machines. I was on some autofs-mounted directory, I moved to the home directory (which is not on autofs) and I typed startx. Some times after that I shut down the remote machine that provided the autofs mount. The whole X session started to severely mibehave, starting various programs caused hangs, I couldn't even start an xterm with the shell, I couldn't even start the chome browser - the reason for the hangs was, that the OLDPWD variable pointing to the autofs directory ended up being propagated to the Xserver, to the desktop environment and to any program that was running within the X session. I caused serious trouble and I think it should be fixed. If I started Xwindow on the non-functioning autofs directory, it would be expected that I get hangs. However, I started Xwindow in the home directory that has nothing to do with autofs - and I got hangs. Mikulas > 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. >