Red Hat Bugzilla – Bug 19053
Many programs from fileutils do not work when run with closed stdout
Last modified: 2007-03-26 23:36:35 EDT
There is a problem in fileutils, which affects namely scripts. Scripts
run from some daemons, with closed standard output. However, fileutils
contains buggy code in lib/closeout.c, which causes programs from fileutils
to fail in the case of closed stdout.
Try to run the following on Red Hat 7.0 (under bash):
/bin/rm -f /some/file >&-
The result is an error condition (write error: bad file descriptor), and
of /some/file fails.
I have written a simple patch and a new spec-file, which are available
at http://ftp.linux.cz/pub/linux/people/jan_kasprzak/fileutils/. The patch
simply checks for errno value after fclose() and handles EBADF value
as if there was no error at all.
This bug can affect many shell scripts, and it is hard to detect..
This is fixed in 4.0.27-1 (rawhide).