Subject: bin/19893: /bin/sh doesn't parse "sh -c 'echo $0 $*' -x a b" properly
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dsl@l8s.co.uk>
List: netbsd-bugs
Date: 01/17/2003 17:24:33
>Number:         19893
>Category:       bin
>Synopsis:       /bin/sh doesn't parse "sh -c 'echo $0 $*' -x a b" properly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 17 09:22:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     David Laight
>Release:        NetBSD 1.6L
>Organization:
	none
>Environment:
System: NetBSD snowdrop 1.6L NetBSD 1.6L (GENERIC) #202: Thu Jan 16 15:13:14 GMT 2003
dsl@snowdrop:/oldroot/usr/bsd-current/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:
	/bin/sh parses -c as if with getopt(c,v,"c:") however posix
	shows the semantics as:
	    sh -c [-abCefhimnuvx] [-o option] [+abCefhimnuvx] [+o option]
		    command_string [command_name [argument...]]
	note that 'command_string' is after all the options.
>How-To-Repeat:
	Run:
	    sh -c 'echo $0 $*' -x a b
	Compare the output with (the correct) one from ksh.

>Fix:
	I'm working on one...
	I hope it doesn't break anything though!
>Release-Note:
>Audit-Trail:
>Unformatted: