|
From: | Pádraig Brady |
Subject: | bug#25029: shuf generates “Bad file descriptor” error on nfs but only when run as a background process |
Date: | Sat, 26 Nov 2016 02:41:23 +0000 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
On 26/11/16 02:00, Paul Eggert wrote: > Pádraig Brady wrote: >> Actually the minimum reproducer is: >> >> $ shuf /dev/null 0>&- >> shuf: read error: Bad file descriptor > > Ouch. Isn't that a bug in glibc freopen? It shouldn't fail with errno==EINVAL > merely because stdin doesn't have a valid file descriptor. If so, we should > fix > the Gnulib freopen module to work around the bug. If not, I suppose we can > fix > this in freopen-safer. Yes it's surprising. I see POSIX states freopen() should only return EBADF in the case where the pathname specified is NULL. I.E. when operating on the old descriptor. But shouldn't freopen() be using a new descriptor here? Definitely looks like a glibc bug. cheers, Pádraig
[Prev in Thread] | Current Thread | [Next in Thread] |