Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Jul 2017 00:08:39 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 220587] /bin/sh Incorrect options handling
Message-ID:  <bug-220587-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D220587

            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@FreeBSD.org
          Reporter: ryan@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 sho=
uld
be interpreted as an option.

Furthermore, passing -s as the program_name argument causes the shell to re=
ad
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
```

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-220587-8>