Bug 1546221

Summary: /etc/profile.d/which2.sh invalid sh syntax
Product: [Fedora] Fedora Reporter: Jason Tibbitts <j>
Component: whichAssignee: Than Ngo <than>
Status: CLOSED RAWHIDE QA Contact: Jason Tibbitts <j>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mathieu-acct, than
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-16 17:06:27 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 Jason Tibbitts 2018-02-16 16:27:12 UTC
When logging into a rawhide VM, I get the following:

/etc/profile.d/which2.sh:3: = not found

And indeed, line 3 of that script is:

if [ "$0" == ksh ] ; then

which is not valid sh syntax.  It does for whatever reason work in bash, but my login shell is zsh.  You can use the doubled equals sign in the [[...]] form if that's what you prefer, though I don't know anything about how ksh supports that so it's probably best to stick with whatever plain old /bin/test supported.  In that case, just using a single equals sign would be the right move.

Comment 1 Jason Tibbitts 2018-02-16 17:06:27 UTC
Since the fix was trivial, I went ahead and fixed this in rawhide.  I also committed three very minor specfile cleanups; I hope that is OK.  I removed Group:, the buildroot cleaning in %install and the needless %defattr in %files.  Technically the %attr bit in %files is also unneeded (confirmed with rpmdiff) but I left it in.

If you're unhappy with these changes, please feel free to revert them.  I just thought I would save you the time.

Comment 2 Mathieu Chouquet-Stringer 2020-03-25 16:29:59 UTC
Hello,

It's broken again in F32 Beta with rpm version which-2.21-17.fc32.x86_64:

/etc/profile.d/which2.sh:3: = not found

And indeed, line 3 is:
if [ "$0" == "ksh" -o "$0" == "-ksh" ] ; then

Cheers,
Mathieu

Comment 3 Mathieu Chouquet-Stringer 2020-03-25 16:36:07 UTC
I opened BZ#1817138 for it...