Re: command lookup and POSIX

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

 



On 03/07/2014 03:48 PM, Jason Miller wrote:
> On 14:53 Fri 07 Mar     , Eric Blake wrote:
>> On 03/07/2014 12:43 PM, Jason Miller wrote:
>>> Reading this:
>>>
>>> http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_01_01

By the way, this is the Issue 6 version of POSIX (2001, updated via
technical corrigendum 1 and 2 through 2004).  You want to be looking at
Issue 7 (2008, with technical corrigendum 1 in 2013).

>>>
>>> Any built-in other than the special built-ins, or listed in the table
>>> there should not be run unless it is present in the PATH.
>>>
>>> dash however doesn't follow that:
>>>
>>> PS1="% " dash
>>>
>>>     % PATH=
>>
>> Stop right there.
>>
>> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08
>>
>> "If PATH is unset or is set to null, the path search is
>> implementation-defined."
>>
>> Therefore, you have triggered implementation-defined behavior, rather
>> than exposing a bug in dash.
> Okay same question with PATH=/foo (dash's behavior is the same)

Still a problem in your script - POSIX says that you have a
non-compliant environment if you do certain things to PATH, at which
point dash can do whatever it wants.  Basically, if PATH ever lacks any
directories in 'getconf PATH', you have left the realm of POSIX
compliance.  See also the application usage for command:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux