Subject: bug#25029: shuf generates “Bad file descriptor” error on nfs but only when run as a background process

From: Paul Eggert <[email-masked]>
Date: Sat, 26 Nov 2016 16:27:26 -0800

On 11/26/2016 04:18 PM, Pádraig Brady wrote:
> Does the freopen module now need to depend on
> the dup2 and open modules?  For example using dup2(fd, fd)
> to test fd validity fails on Linux 2.6.29

I tried to avoid that dependency, by using code that checks errno after 
dup2 fails, so that the workaround should be attempted only on hosts 
with the more-recent freopen bug. I haven't tested it on ancient 
GNU/Linux systems, though.