Re: bug: background jobs have their inputs bound to `/dev/null`, even in the face of explicit redirection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pablo Repetto <pablo.ernesto.repetto@xxxxxxxxx> wrote:
>
> # the following produces no output, both are erroneous
> echo x | { cat & wait; }

This is totally expected and correct.

> echo x | { <&0 cat & wait; }

This is expected too only because you're doing 0<&0 which is
a no-op.  To get what you want to happen,  you need to save the
zero fd before dash redirects it:

echo x | { { cat <&3& } 3<&0; wait; }

> # OTHER SUPPORTING EVIDENCE
> 
> bash received a closely related bug report in 2016. Both the discussion
> on whether a pipeline into a compound command counts as explicit redirection
> and the ultimate patch applied are extremely relevant.
> 
> https://groups.google.com/g/gnu.bash.bug/c/bgTSFM8UAek

I disagree.  If you like bash's behaviour, please get the standard
changed.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt




[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux