RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 612126 - bash can't handle moved binaries well
Summary: bash can't handle moved binaries well
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: bash
Version: 6.0
Hardware: All
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Roman Rakus
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-07-07 11:28 UTC by Michal Hlavinka
Modified: 2014-01-13 00:12 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-07-23 12:39:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Michal Hlavinka 2010-07-07 11:28:04 UTC
Description of problem:
bash uses hash table to speed up searching of binaries in PATH, but when binary is moved, bash reports "not found" instead of trying to search again.

Version-Release number of selected component (if applicable):
bash-4.1.2-3.el6.x86_64
bash-4.1.7-1.fc13.x86_64


How reproducible:
always

Steps to Reproduce:
# cp /bin/grep /usr/bin/grep
# grep
# type grep 
grep is hashed (/usr/bin/grep)
# rm /usr/bin/grep
# grep


Actual results:
bash: /usr/bin/grep: No such file or directory

Expected results:
no error
bash should just remove entry from hash table and look for grep again using PATH

Comment 2 Roman Rakus 2010-07-23 12:39:50 UTC
This has been already discussed on the upstream mailing list; see http://www.mail-archive.com/bug-bash@gnu.org/msg06799.html

Comment 3 Michal Hlavinka 2010-07-26 11:55:26 UTC
well, that discussion on the upstream mailing list is slightly different.

mailing list:
PATH=a:b:...
binary in b
add binary in a
-> b is still used

I understand upstream explanation that it'd made hashtable useless if you have to check path all the time, but this is not the bug I'm describing here, because in that case you still can use some binary. Well, discussion if different binary (mailing list case)


my bug report:
remove item from hash table if execution fails because file was removed and this should be pretty well doable and you'll still be able to use hashtable for better performance. When I got this error, it was because some package moved its binary file to different place which resulted in disappearing from bash completely. It took some time to find out what's happening, because the "only" result I got was /usr/bin/binary = "not found" vs. which binary = /usr/bin/binary

hashtable should be also cleared when PATH variable is changed (don't know if this is not already happening, did no test)

Because this bug is not the same as mentioned in the mailing list and fixing this would not prevent using hashtable for its purpose, I think this bug should be reopened.

Comment 4 Roman Rakus 2010-07-26 13:00:15 UTC
One thing you missed; the `checkhash'. Try to enable this option with shopt. Yeah, it is not set by default...


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