Harald van Dijk wrote, on 20 Mar 2025:
>
> On 20/03/2025 11:04, Geoff Clare via austin-group-l at The Open Group wrote:
> > Chet Ramey wrote, on 18 Mar 2025:
> > > The original language, from 1992, is "In all cases, explicit redirection
> > > of standard input shall override this activity." Bash interpreted that to
> > > mean that the implicit redirection of didn't happen.
> >
> > The input we need from you on 0<&0 is, given that bash's behaviour
> > differs from the other shells whose behaviour we normally take into
> > consideration, do you think the resolution of bug 1913 should allow
> > the current bash behaviour or will you change bash to behave like
> > those other shells?
>
> This is one corner case where bash's behaviour differs from other shells but
> outside of that corner case, bash's behaviour matches other significant
> shells and you are suggesting changing POSIX to no longer permit this. Let
> me make this clearer with examples.
>
> $ echo hello | bash -o posix -c "{ cat & wait; }"
> $ echo hello | bash -o posix -c "{ cat & wait; } 0<&0"
> hello
> $ echo hello | ksh -o posix -c "{ cat & wait; }"
> $ echo hello | ksh -o posix -c "{ cat & wait; } 0<&0"
> hello
> $ echo hello | bosh -c "{ cat & wait; }"
> $ echo hello | bosh -c "{ cat & wait; } 0<&0"
> hello
> $ echo hello | pbosh -c "{ cat & wait; }"
> $ echo hello | pbosh -c "{ cat & wait; } 0<&0"
> hello
I see these as not so much about 0<&0 but the other (asynchronous
list) issue. They are special cases of commands where redirections
done before an asynchronous list is started affect whether the
redirection from /dev/null is done. The one with 0<&0 was only
previously allowed because 0<&0 had unspecified behaviour; the other
cases have never been allowed by POSIX. For example:
$ echo hello > FIFO & bash -o posix -c "{ cat & wait; } 0<FIFO"
[1] 3690
hello
$ echo hello > FIFO & ksh93u+m -o posix -c "{ cat & wait; } 0<FIFO"
[1] 3699
hello
--
Geoff Clare <[email protected]>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England