[Bug 220587] /bin/sh Incorrect options handling
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Mon Jul 10 00:08:39 UTC 2017
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220587
Bug ID: 220587
Summary: /bin/sh Incorrect options handling
Product: Base System
Version: 11.0-RELEASE
Hardware: Any
OS: Any
Status: New
Severity: Affects Only Me
Priority: ---
Component: bin
Assignee: freebsd-bugs at FreeBSD.org
Reporter: ryan at freqlabs.com
The system shell /bin/sh is consuming options after the command string when -c
is used. According to the synopsis, nothing after the -c command_string should
be interpreted as an option.
Furthermore, passing -s as the program_name argument causes the shell to read
from standard input, which is at odds with the description of the -c option in
the manual and in the POSIX standard.
The behavior on FreeBSD is inconsistent with the behavior on other operating
systems. A NetBSD and an Ubuntu Linux system were checked, and both have the
expected behavior.
Observed behavior:
```
$ sh -c 'echo $0 $@' -m foo
foo
$ sh -c 'echo $0 $@' -s foo
$ <child shell, reading commands from standard input>
```
Expected behavior:
```
$ sh -c 'echo $0 $@' -m foo
-m foo
$ sh -c 'echo $0 $@' -s foo
-s foo
```
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list