[Top][All Lists]

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

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

From: Greg Wooledge
Subject: Re: Bash should reset OLDPWD upon login, *only*.
Date: Tue, 3 Oct 2017 16:50:27 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Tue, Oct 03, 2017 at 10:36:17PM +0200, Mikulas Patocka wrote:
> The problem is that $OLDPWD causes unintended activations of the 
> automounter and unintended delays. For example
> /root# cd /some/automounted/directory
> /some/automounted/directory# cd ~
> /root# /etc/init.d/mail-daemon start
> - now, the mail daemon inherits OLDPWD=/some/automounted/directory and 
> every incoming email will poke this directory and activate the automounter 
> and cause delay.

To be fair, there are several things that have to happen in order for
this problem to arise:

1) The system must be using sysv-rc style init scripts, and not any of
   the other init systems where the interactive environment doesn't
   leak into daemons in the first place.

2) The mail-daemon (and the init.d scripts which launch it) must not
   cleanse the environment.

3) The mail-daemon must invoke a bash script, specified directly in the
   shebang, or via a /bin/sh -> bash symlink.

4) The sysadmin has to get unlucky with respect to the order in which
   tasks are performed within a single shell session.

I'm not doubting that there exist some systems where all of these
conditions may be simultaneously met, but it's quite a stack.

The question remains: what, if anything, should be changed?

reply via email to

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