Subject: standards/11197: POSIX.2: regular builtins can't be exec'ed.
To: None <gnats-bugs@gnats.netbsd.org>
From: Ben Harris <bjh21@netbsd.org>
List: netbsd-bugs
Date: 10/12/2000 05:24:16
>Number:         11197
>Category:       standards
>Synopsis:       POSIX.2: regular builtins can't be exec'ed.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 12 05:24:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Ben Harris
>Release:        2000-02-07
>Organization:
	Me!
>Environment:
NetBSD cromarty 1.4X NetBSD 1.4X (CROMARTY) #9: Wed May  3 23:49:51 BST 2000
     bjh21@cromarty:/usr/src/sys/arch/macppc/compile/CROMARTY macppc

>Description:
POSIX.2 requires that all utilities be able to be run by the likes of
xargs.  This includes things that are usually shell builtins.  In NetBSD,
of the utilities in the base standard, "cd", "command", "getopts",
"umask" and "wait" cannot be so run.

There are also some builtins in the User Portability Extension that are
likely to need the same treatment.
>How-To-Repeat:
$ export PATH=`getconf PATH`
$ echo "eep" | xargs cd
xargs: cd: No such file or directory
$ echo "eep" | xargs command
xargs: command: No such file or directory
$ echo "eep" | xargs getopts
xargs: getopts: No such file or directory
$ echo "eep" | xargs umask
xargs: umask: No such file or directory
$ echo "eep" | xargs wait
xargs: wait: No such file or directory

>Fix:
The relevant section of the POSIX.2 rationale suggests making each of
these a symlink to the following shell script:

$0 "$@"

Crude, but probably good enough for the purpose at hand.

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/arm26               <URL:http://www.netbsd.org/Ports/arm26/>

>Release-Note:
>Audit-Trail:
>Unformatted: