On 9/29/17 5:12 AM, Mikulas Patocka wrote: > > > 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.
OLDPWD must be a directory, and while it's technically the user's responsibility to ensure that it is, the shell should only inherit it if it has a valid value. (As I said back in 2015, in the same way it inherits PWD only if it names the current directory.) > >> 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. That's like saying a problem will only be a problem if someone makes it a problem. It really seems like you want bash to save you from a problem you introduced by yanking a remote mount out from underneath your system. It seems better to, say, specify that the automount operation is interruptible than to change the shell for what is a rare occurrence. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/