Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-11-27 Thread Mikulas Patocka
On Wed, 4 Oct 2017, Eduardo A. Bustamante López wrote: > On Tue, Oct 03, 2017 at 10:29:08PM +0200, Mikulas Patocka wrote: > > If $OLDPWD points to a non-existing directory, 'cd -' will fail. > > But if we clear $OLDPWD, 'cd -' will fail too (with just different message).

Re: Bash should reset OLDPWD upon login, *only*.

2017-10-03 Thread Mikulas Patocka
On Mon, 2 Oct 2017, Chet Ramey wrote: > On 10/1/17 7:30 PM, L A Walsh wrote: > > > Only in the case of login -- they user CAN'T set it before they login, but > > someone **could** have changed the system /etc/profile script to set OLDPWD > > to /hang (i.e. someone is behaving "maliciously").

Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-10-03 Thread Mikulas Patocka
On Tue, 3 Oct 2017, Chet Ramey wrote: > On 10/3/17 4:14 PM, Mikulas Patocka wrote: > > > > > > On Sun, 1 Oct 2017, Chet Ramey wrote: > > > >> On 9/30/17 4:20 AM, Mikulas Patocka wrote: > >> > >>> Is there some reason why do we need to

Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-10-03 Thread Mikulas Patocka
On Sun, 1 Oct 2017, Chet Ramey wrote: > On 9/30/17 4:20 AM, Mikulas Patocka wrote: > > > Is there some reason why do we need to check if $OLDPWD is a real > > directory? dash and ksh accept the $OLDPWD variable, but don't poke it > > with the stat syscall. zsh clear

Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-10-01 Thread Mikulas Patocka
On Sat, 30 Sep 2017, L A Walsh wrote: > > > Mikulas Patocka wrote: > > I don't set up OLDPWD in /etc/profile. > --- >No one does -- unless someone is trying to cause mischief. It's not > a likely event, but it would be annoying if someone did it. >

Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-09-30 Thread Mikulas Patocka
On Fri, 29 Sep 2017, Eduardo A. Bustamante López wrote: > On Fri, Sep 29, 2017 at 11:12:59AM +0200, Mikulas Patocka wrote: > > This patch doesn't revert the above change. It only removes a test if > > $OLDPWD is a directory. With this patch, if $OLDPWD points

Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-09-30 Thread Mikulas Patocka
On Fri, 29 Sep 2017, L A Walsh wrote: > Chet Ramey wrote: > > > > This is all correct. The change was introduced for a reason, and > > accommodating a rare occurrence by backing it out would be non- > > productive. > > > --- > The reason?: > > Why does bash clear OLDPWD when a child

Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-09-30 Thread Mikulas Patocka
On Fri, 29 Sep 2017, Eduardo A. Bustamante López wrote: > On Fri, Sep 29, 2017 at 12:51:37AM -0700, L A Walsh wrote: > [...] > > Why does bash clear OLDPWD when a child script is started? > > > > OLDPWD is exported and passed to any children, but bash apparently clears > > OLDPWD whenever a

Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-09-29 Thread Mikulas Patocka
On Fri, 29 Sep 2017, 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 @

Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-09-29 Thread Mikulas Patocka
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

[PATCH] Fix hang if $OLDPWD points to inaccessible directory

2017-09-28 Thread Mikulas Patocka
Bash attempts to execute the stat syscall on the $OLDPWD variable on every startup. This results in hard to diagnose hangs if the $OLDPWD variable points to a directory on network filesystem that is inaccessible (for example sshfs or nfs). How to reproduce the hang: - mount an sshfs directory