Bug 11029 - su does not return the error code to invoking shell
Summary: su does not return the error code to invoking shell
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: sh-utils
Version: 6.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
: 34768 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2000-04-25 13:03 UTC by carlosqg
Modified: 2008-05-01 15:37 UTC (History)
0 users

Clone Of:
Last Closed: 2001-06-21 15:10:53 UTC

Attachments (Terms of Use)
Here's the fix (281 bytes, patch)
2001-06-21 15:06 UTC, Tim Waugh
no flags Details | Diff
Actually, this one is better. (523 bytes, patch)
2001-06-21 15:10 UTC, Tim Waugh
no flags Details | Diff

Description carlosqg 2000-04-25 13:03:08 UTC
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.

Comment 1 Bernhard Rosenkraenzer 2001-05-20 10:14:57 UTC
*** Bug 34768 has been marked as a duplicate of this bug. ***

Comment 2 Bernhard Rosenkraenzer 2001-05-20 10:16:41 UTC
This is fixed in sh-utils-2.0.11-1 (rawhide)

Comment 3 Patrick C. F. Ernzer 2001-06-21 14:28:13 UTC
The problem exists with sh-utils-2.0.11-2

Was the fix dropped between 2.0.11-1 and 2.0.11-2?

Comment 4 Tim Waugh 2001-06-21 15:06:01 UTC
Created attachment 21465 [details]
Here's the fix

Comment 5 Tim Waugh 2001-06-21 15:10:49 UTC
Created attachment 21466 [details]
Actually, this one is better.

Comment 6 Bernhard Rosenkraenzer 2001-07-18 11:04:38 UTC
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.

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