Bug 1288411

Summary: Latest "which" package (which-2.20-10.fc22) breaks backwards compatibility.
Product: [Fedora] Fedora Reporter: thestrider
Component: whichAssignee: Than Ngo <than>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 22CC: than
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-28 12:22:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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

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

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.
2.
3.

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'
	/usr/bin/which
## END `which which ` OUTPUT ###



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

## BEGIN `which which ` OUTPUT ###
/usr/bin/which
## END `which which ` OUTPUT ###


Additional info:

Comment 1 Than Ngo 2016-06-28 12:22:12 UTC
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.