Bug 1194044 - which fails to find matching bash functions
Summary: which fails to find matching bash functions
Alias: None
Product: Fedora
Classification: Fedora
Component: which
Version: 22
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Than Ngo
QA Contact: Fedora Extras Quality Assurance
: 819602 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2015-02-18 20:30 UTC by Scott Shambarger
Modified: 2015-11-11 17:10 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-11-11 17:10:48 UTC
Type: Bug

Attachments (Terms of Use)
Adjust /etc/profile.d/which2.sh as manpage recommends (1.40 KB, patch)
2015-02-18 20:30 UTC, Scott Shambarger
no flags Details | Diff

Description Scott Shambarger 2015-02-18 20:30:54 UTC
Created attachment 993306 [details]
Adjust /etc/profile.d/which2.sh as manpage recommends

Description of problem:
The which alias declared in /etc/profile.d/which2.sh fails to find bash functions which would be used to resolve a particular command.  So for example, if a function for ls is declared, "which ls" shows /bin/ls when in fact the function named "ls" is actually used.

This is a continuation of bug 819602 (which was closed as EOL)

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Declare a bash function mytest, eg "mytest() { echo "hello"; }"
2. Type "mytest" at prompt, which executes function (results in "hello")
3. Type "which mytest"

Actual results:

/usr/bin/which: no mytest in ($PATH)

Expected results:

mytest ()                                                                       
    echo "hello"                                                                

Additional info:
The attached patch to fix the problem is described in the which manpage, and is therefore a preferred and supported way to have which work with bash functions.

Comment 1 Till Maas 2015-02-18 20:38:58 UTC
*** Bug 819602 has been marked as a duplicate of this bug. ***

Comment 2 Till Maas 2015-02-18 20:44:35 UTC
@Ngo Than: It is now 2.5 years without any answer from you, I will now update which for you

Also please respond, since I now also start the nonresponsive maintainer policy:

Comment 3 Fedora End Of Life 2015-11-04 13:32:22 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Scott Shambarger 2015-11-11 17:10:48 UTC
Bug appears fixed in which-2.20-9 (yay!...only F22 onwards though)
Tested and works perfectly.
Moving to F22 and closing.

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