Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 22 Oct 2021 18:07:32 +0100
From: Stephane Chazelas <>
To: Oğuz <>
Cc: Rob Landley <>, enh <>,
	Rich Felker <>,
	austin-group-l <>,
	"" <>
Subject: Re: Posix issue 8 pending change to system().

2021-10-22 12:43:11 +0300, Oğuz:
> > So system() was broken when sh started accepting more than one
> > option argument.
> >
> I wouldn't say broken. This is rather an academic case, I don't see why
> anyone would name a utility that way (`-potato'/`+potato'), I don't know a
> single utility that is named that way either.


zsh has a "-" builtin command (to run a command with it's
argv[0] prefixed with a "-").

$ zsh -c '- ps -f'
zsh: bad option string: '- ps -f'
$ zsh -c -- '- ps -f'
UID          PID    PPID  C STIME TTY          TIME CMD
chazelas  728758   93970  0 18:01 pts/8    00:00:00 /bin/zsh
chazelas  729347  728758  0 18:02 pts/8    00:00:00 -ps -f

(from 1990; less useful now that most shells support a -l /
--login to achieve the same effect as "- sh").

Note that it's not only about the command's name, one could want
to do:

system("++dir++/ blah");

> The standard should note this corner case and encourage developers to
> implement `system()' to behave as if `sh -c -- command' were called, and
> leave it at that.

Yes, it should make sure that system("any shell code") correctly
gets a shell to interpret that code.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.