Bug 1288411 - Latest "which" package (which-2.20-10.fc22) breaks backwards compatibility.
Latest "which" package (which-2.20-10.fc22) breaks backwards compatibility.
Product: Fedora
Classification: Fedora
Component: which (Show other bugs)
All Linux
unspecified Severity high
: ---
: ---
Assigned To: Ngo Than
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2015-12-04 01:48 EST by thestrider
Modified: 2016-06-28 08:22 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-06-28 08:22:12 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description thestrider 2015-12-04 01:48:38 EST
Description of problem: The latest F22 "which" package (and possibly some other recent "which" releases) breaks backwards compatibility by enforcing an alias.

alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot'

This alias gets set in the file "/etc/profile.d/which2.sh", which is installed as part of the "which" package.  Since the aliased "which" command reads aliases itself, the output will at times break the expected convention for a vanilla call, and this breaks other programs.

E.g., in previous versions of which, one can issue the call `rpm -qf $(which <SOME_FILE>)` to retrieve the package name associated with a given file.  This is now broken, when the file is a command with an associated alias (e.g. 'ls' or 'which' itself).  This is just one simple example.  There must certainly be many additional custom user scripts which are now broken, having assumed that a vanilla call to `which` would return vanilla output.

Version-Release number of selected component (if applicable):2.20-10.fc22

How reproducible: Self-evident by calling `which which`, or by reading the contents of "/etc/profile.d/which2.sh".

Steps to Reproduce:
1. Self-evident. See above.

Actual results: For `which which`, the actual output is the following:

## BEGIN `which which ` OUTPUT ###
alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot'
## END `which which ` OUTPUT ###

Expected results:  For `which which`, the expected output is the following:

## BEGIN `which which ` OUTPUT ###
## END `which which ` OUTPUT ###

Additional info:
Comment 1 Ngo Than 2016-06-28 08:22:12 EDT
i don't see any compatibility in the new version, it behaves the same like before.
The default alias for which is read-alias and read-functions. You can disable read-alias for youi case.

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