GNU bug report logs - #25029
shuf generates “Bad file descriptor” error on nfs but only when run as a background process

Previous Next

Package: coreutils;

Reported by: Alex Ryan <alexander.j.ryan <at> gmail.com>

Date: Fri, 25 Nov 2016 22:25:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eric Blake <eblake <at> redhat.com>
To: Pádraig Brady <P <at> draigBrady.com>, Alex Ryan <alexander.j.ryan <at> gmail.com>, 25029 <at> debbugs.gnu.org
Subject: bug#25029: shuf generates “Bad file descriptor” error on nfs but only when run as a background process
Date: Mon, 28 Nov 2016 10:37:16 -0600
[Message part 1 (text/plain, inline)]
On 11/25/2016 05:59 PM, Pádraig Brady wrote:
> On 25/11/16 22:24, Alex Ryan wrote:
>> I am not certain about this but I *think* this might be a bug in shuf.
>>
>> full description of how to reproduce is here
>> http://stackoverflow.com/questions/40730239/shuf-generates-bad-file-descriptor-error-on-nfs-but-only-when-run-as-a-backgro
> 
> The minimum reproducer is:
> 
>   $ shuf 0>&-
>   shuf: read error: Bad file descriptor
> 
> The reason is that the specified file is reopened to stdin,
> which is a general technique used by single file filters.
> I.E. this isn't specific to shuf:
> 
>   $ tac 0>&-
>   tac: standard input: read error: Bad file descriptor

Technically, POSIX states that ANY attempt to execute a program with fd
0, 1, or 2 closed is undefined behavior, so the bug is yours for not
providing an explicit stdin in the first place.  But I agree that it is
a nice quality-of-implementation thing for coreutils to have
reasonably-sane behavior in the fact of closed fds, even if POSIX does
not require us to.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 8 years and 236 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.