bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Mikulas Patocka
Subject: Re: [PATCH] Fix hang if $OLDPWD points to inaccessible directory
Date: Sat, 30 Sep 2017 10:16:38 +0200 (CEST)
User-agent: Alpine 2.02 (DEB 1266 2009-07-14)


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 script is started?
> 
> OLDPWD is exported and passed to any children, but bash apparently clears
> OLDPWD whenever a child script is started...
> 
> GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
> 
> Can bash be fixed to preserve the value of any OLDPWD in its initial
> environment, like it does with PWD?
> ---
> 
> I don't see a reason...
> I see a "want", but no real reason....
> 
> I'd agree it's a rare event to hit though, but when you do...
> 
> Requires console access, but changing /etc/profile to
> insert a bad OLDPWD to a known down network location might not be
> considered a trivial occurrence to someone stressed out and trying to log
> in and find out why everyone logging in is hanging...

I don't set up OLDPWD in /etc/profile.

I start the desktop environment from console using the "startx" command (I 
don't use graphical login screen) and the desktop environment inherits all 
variables that were there when I was working with bash on the console - 
including $OLDPWD.

A similar problem may happen if you start daemons using scripts in 
/etc/init.d/ (i.e. not using systemd) - in this case, the daemon also 
inherits all environment variables that were there when the admin was 
working with the shell, inclunding $OLDPWD.

Mikulas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]