Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 22 Oct 2021 12:43:11 +0300
From: Oğuz <oguzismailuysal@...il.com>
To: Stephane Chazelas <stephane@...zelas.org>
Cc: Rob Landley <rob@...dley.net>, enh <enh@...gle.com>, Rich Felker <dalias@...c.org>, 
	austin-group-l <austin-group-l@...ngroup.org>, 
	"libc-coord@...ts.openwall.com" <libc-coord@...ts.openwall.com>
Subject: Re: Posix issue 8 pending change to system().

22 Ekim 2021 Cuma tarihinde Stephane Chazelas via austin-group-l at The
Open Group <austin-group-l@...ngroup.org> yazdı:

> 2021-10-22 01:11:43 -0500, Rob Landley via austin-group-l at The Open
> Group:
> [...]
> > > > Where system("-blah") fails because sh is insane legacy weirdness
> and it turns
> > > > out that -c does NOT take an argument. So:
> > > >
> > > >   sh -c -i "echo hello"
> > > >
> > > > Works, which that means "sh -c -potato" tries to parse -potato as an
> option, and
> > > > fails.
> [...]
>
> Note that if it was even insaner legacy, it would be fine.
>
> In the Bourne shell, only the first argument was considered for
> options.
>
> In the Bourne shell originally, you'd have had to write:
>
> sh -fc 'echo hello'
>
> Or
>
> sh -cf 'echo hello'
>
> to interpret "echo hello" while the f option is enabled. sh -c
> -f 'echo hello' would interpret -f with "echo hello" in $0.
>
> 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.

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.


-- 
Oğuz

Content of type "text/html" skipped

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.