Bug 217394 - bash does not close filehandles when asked.
bash does not close filehandles when asked.
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: bash (Show other bugs)
5.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tomas Janousek
Chris Ward
: Reopened
: 345181 (view as bug list)
Depends On: 380421
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-27 13:49 EST by Oleg Drokin
Modified: 2008-05-21 11:35 EDT (History)
3 users (show)

See Also:
Fixed In Version: RHBA-2008-0380
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-05-21 11:35:55 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Oleg Drokin 2006-11-27 13:49:42 EST
Description of problem:

When I want to close a filehandle in current shell (exec NUM<&-), it suddenly
stopped to work with rhel5betas.
It worked just fine with rhel4 and with fedora core 2 & 3, stopped to work in
fc6 too.

How reproducible:

100% reproducible, this simple script demonstrates the issue:
exec 101< /etc/passwd ; ls -la /proc/$$/fd ; exec 101<&- ; ls -la /proc/$$/fd
On rhel5beta I get
total 5
dr-x------ 2 green green  0 Nov 27 20:44 .
dr-xr-xr-x 4 green green  0 Nov 27 20:44 ..
lrwx------ 1 green green 64 Nov 27 20:44 0 -> /dev/pts/22
lrwx------ 1 green green 64 Nov 27 20:44 1 -> /dev/pts/22
lr-x------ 1 green green 64 Nov 27 20:44 101 -> /etc/passwd
lrwx------ 1 green green 64 Nov 27 20:44 2 -> /dev/pts/22
lrwx------ 1 green green 64 Nov 27 20:44 255 -> /dev/pts/22
total 5
dr-x------ 2 green green  0 Nov 27 20:44 .
dr-xr-xr-x 4 green green  0 Nov 27 20:44 ..
lrwx------ 1 green green 64 Nov 27 20:44 0 -> /dev/pts/22
lrwx------ 1 green green 64 Nov 27 20:44 1 -> /dev/pts/22
lr-x------ 1 green green 64 Nov 27 20:44 101 -> /etc/passwd
lrwx------ 1 green green 64 Nov 27 20:44 2 -> /dev/pts/22
lrwx------ 1 green green 64 Nov 27 20:44 255 -> /dev/pts/22

Where correct output is this (note how /etc/passwd is not show in second ls
output) (this example is from fc2):
total 5
dr-x------  2 green green  0 Nov 27 17:12 .
dr-xr-xr-x  3 green green  0 Nov 27 17:12 ..
lrwx------  1 green green 64 Nov 27 20:38 0 -> /dev/pts/1
lrwx------  1 green green 64 Nov 27 20:38 1 -> /dev/pts/1
lr-x------  1 green green 64 Nov 27 20:38 101 -> /etc/passwd
lrwx------  1 green green 64 Nov 27 20:38 2 -> /dev/pts/1
lrwx------  1 green green 64 Nov 27 20:38 255 -> /dev/pts/1
total 4
dr-x------  2 green green  0 Nov 27 17:12 .
dr-xr-xr-x  3 green green  0 Nov 27 17:12 ..
lrwx------  1 green green 64 Nov 27 20:38 0 -> /dev/pts/1
lrwx------  1 green green 64 Nov 27 20:38 1 -> /dev/pts/1
lrwx------  1 green green 64 Nov 27 20:38 2 -> /dev/pts/1
lrwx------  1 green green 64 Nov 27 20:38 255 -> /dev/pts/1

Additional info:
This must be some generic bash bug, as SLES10 also has this problem.
Comment 1 Oleg Drokin 2006-12-04 13:52:02 EST
This seems to be fixed in latest bash, at least this entry at
http://tiswww.tis.case.edu/~chet/bash/CHANGES eems to be related:

ii. Fixed a bug that could cause file descriptors > 10 to not be closed even
    when closed explicitly by a script.        
Comment 3 RHEL Product and Program Management 2007-06-05 16:49:17 EDT
This request was evaluated by Red Hat Product Management for
inclusion in a Red Hat Enterprise Linux release.  Since this
bugzilla is in a component that is not approved for the current
release, it has been closed with resolution deferred.  You may
reopen this bugzilla for consideration in the next release.
Comment 5 RHEL Product and Program Management 2007-10-16 00:08:01 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.
Comment 6 Chris Ward 2007-10-29 12:11:37 EDT
Which versions of Bash does this bug effect?
Comment 7 Tomas Janousek 2007-10-29 12:17:40 EDT
Only 3.1, I think. Isn't this a duplicate of bug 345181?
Comment 8 Tomas Janousek 2007-10-29 12:18:30 EDT
(or the other way round, probably, I should've closed the other one)
Comment 9 Tomas Janousek 2007-10-29 12:35:44 EDT
*** Bug 345181 has been marked as a duplicate of this bug. ***
Comment 10 Roland Friedwagner 2007-11-14 03:22:02 EST
The Bug description ist wrong.
Should be Product: Red Hat Enterprise Linux
Version: 5(.1)

On our site we have to rewrite Shell Scripts, 
which do not work anymore after upgrade from RHEL4.

A quick fix whould be very appreciated.

Kind Regards,
 Roland
Comment 11 Tomas Janousek 2007-11-14 03:46:04 EST
I know, we're fixing this in EL 5.2.
Comment 16 errata-xmlrpc 2008-05-21 11:35:55 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0380.html

Note You need to log in before you can comment on or make changes to this bug.