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: Stephen Dowdy
Subject: Re: bash should not alter PATH with 'command -p'
Date: Tue, 2 Jun 2015 09:27:53 -0600

Chet,

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.

thanks again,
--stephen

On Tue, Jun 2, 2015 at 8:56 AM, Chet Ramey <address@hidden> wrote:
On 5/28/15 3:59 PM, address@hidden wrote:

> Bash Version: 4.3
> Patch Level: 30
> Release Status: release
>
> Description:
>

> 'command -p'
>     Ref:http://pubs.opengroup.org/onlinepubs/009696699/utilities/command.html
>
>     "... -p Perform the command search using a default value for PATH that is guaranteed to find all of the standard utilities. ..."
>
>     The way i read that is:
>         "search for a command only in a default PATH location, then invoke it (not altering user environment in the process)"
>     The way 'bash' seems to be looking at that is:
>         "set the user's PATH to a default value, then invoke"

Kind of.  It's more like `command -p foo args' is turned into
PATH=stdpath foo args
where the new PATH survives only for the duration of the command.  It's
probably not the spirit of the -p option, though it's been this way for
many years.  I will take a look and see what can be done.

Chet

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



--
Stephen Dowdy  -  Systems Administrator  -  NCAR/RAL
303.497.2869   -  address@hidden        -  http://www.ral.ucar.edu/~sdowdy/


reply via email to

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