Red Hat Bugzilla – Bug 11029
su does not return the error code to invoking shell
Last modified: 2008-05-01 11:37:55 EDT
When logged in as root and execute:
su - username -c "exit 2"; echo $?
The result is 0 not 2. It seems su does not return the error code from
executing the command to the invoking shell. Please fix it since the
application I try to port from (HP-UX) relies on this functionality of su.
I'm using sh-utils.2.0-1 package.
*** Bug 34768 has been marked as a duplicate of this bug. ***
This is fixed in sh-utils-2.0.11-1 (rawhide)
The problem exists with sh-utils-2.0.11-2
Was the fix dropped between 2.0.11-1 and 2.0.11-2?
Created attachment 21465 [details]
Here's the fix
Created attachment 21466 [details]
Actually, this one is better.
The problem with 2.0.11-1 -> 2.0.11-2 was that 2.0.11-1 accidentally nuked PAM
support (bad configure check), and the problem exists only if PAM support is
being used. PAM was fixed in 2.0.11-2 -> the bug re-appeared.
I've added the fix in 2.0.11-3.