dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Jason Miller <jason@milr.com>
Cc: dash@vger.kernel.org
Subject: Re: command lookup and POSIX
Date: Fri, 07 Mar 2014 16:44:00 -0700	[thread overview]
Message-ID: <531A59C0.6050303@redhat.com> (raw)
In-Reply-To: <20140307224821.GA22435@home.jasonmmiller.org>

[-- Attachment #1: Type: text/plain, Size: 1590 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-03-07 23:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-07 19:43 command lookup and POSIX Jason Miller
2014-03-07 21:53 ` Eric Blake
2014-03-07 22:48   ` Jason Miller
2014-03-07 23:44     ` Eric Blake [this message]
2014-03-08 17:22 ` Paul Gilmartin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=531A59C0.6050303@redhat.com \
    --to=eblake@redhat.com \
    --cc=dash@vger.kernel.org \
    --cc=jason@milr.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).