On 6/10/19 3:15 PM, Harald van Dijk wrote:
> On 10/06/2019 19:22, Chet Ramey wrote:
>> On 6/10/19 2:15 PM, Harald van Dijk wrote:
>>
>>>> Re: http://austingroupbugs.net/view.php?id=760#c4411 <&0 is a no-op, so
>>>> it's
>>>> unclear whether it counts as
>>>> "explicit redirection of standard input".
>>>
>>> In almost all shells, <&0 is not a no-op. It is a check that stdin is open.
>>> It will cause an immediate error without executing any command otherwise.
>>> By my reading of the standard, this is the required behaviour and it is a
>>> (minor) bug for a few shells to implement it as a no-op.
>>
>> "Almost all shells" is an exaggeration. Of the shells I tested, ksh93,
>> mksh, and the NetBSD sh treat it as an error. Bash, dash, yash, the SVR4.2
>> sh, and the FreeBSD sh ignore it or optimize it away.
>
> I do not think it is an exaggeration.
>
> FreeBSD sh and dash have a common ancestor should not be considered as
> separate shells here as this behaviour dates back to before dash even existed.
There is surprising divergence. If there were not, the NetBSD sh would
not have behaved differently.
>
> You miscategorised yash: it treats it as an error in POSIX mode.
Ok.
> bosh, pdksh, posh and zsh also treat it as an error.
So bosh and the other variants of the mksh branch.
I should have tested zsh, it wouldn't have been that hard.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/