Bug 19053

Summary: Many programs from fileutils do not work when run with closed stdout
Product: [Retired] Red Hat Linux Reporter: Jan "Yenya" Kasprzak <kas>
Component: fileutilsAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED RAWHIDE QA Contact: Aaron Brown <abrown>
Severity: medium Docs Contact:
Priority: high    
Version: 7.0CC: kas
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: ftp://ftp.linux.cz/pub/linux/people/jan_kasprzak/fileutils/
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-10-13 14:46:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan "Yenya" Kasprzak 2000-10-13 14:46:46 UTC
There is a problem in fileutils, which affects namely scripts. Scripts
often
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
removal
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..

Comment 1 Bernhard Rosenkraenzer 2000-10-13 14:54:28 UTC
This is fixed in 4.0.27-1 (rawhide).