bug-bash
[Top][All Lists]
Advanced

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

Re: bash should not alter PATH with 'command -p'


From: Chet Ramey
Subject: Re: bash should not alter PATH with 'command -p'
Date: Thu, 4 Jun 2015 10:57:42 -0400

> Thanks for the response!  It's always fun trying to figure out what POSIX
> means.  I'm sure there's people who probably rely on the consequences of an
> altered PATH, too, so i don't expect you can make anyone happy whatever
> happens here.  (I would guess that a "reasonable" compromise might be to at
> least change the behaviour under 'bash --posix' or bash as /bin/sh, though
> that wouldn't help in the particular case affecting my script.

This turned out to be a little more involved than I thought, but I changed
things so that command -p won't change the $PATH.  If you want to have a
command-specific version of $PATH, you can use the temporary environment
for that, but there's no way to use command -p without modifying $PATH in
bash-4.3 and previous versions.

This uncovered a bug, too: if you use command -p with a temporary environment
assignment to PATH, that tempenv assignment is what persists after the
command completes.  My changes fix that also.

This will be in the next release of bash.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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