Bug 151632

Summary: gcc4 breaks sudo?
Product: [Fedora] Fedora Reporter: Robert Scheck <redhat-bugzilla>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: high Docs Contact:
Priority: medium    
Version: rawhideCC: twoerner, wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 4.0.0-0.36 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-03-25 07:40:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 151893    
Bug Blocks: 136450    

Description Robert Scheck 2005-03-21 08:29:35 UTC
Description of problem:
at-3.1.8-60 out of RHEL4 does the following, which is - I would say - okay:
[root@rhel4 ~]# sudo -u root echo "foo"
foo
[root@rhel4 ~]#

at-3.1.8-66 out of Fedora Core development does this, which isn't okay:
[root@devel ~]# sudo -u root echo "foo"
usage: sudo -V | -h | -L | -l | -v | -k | -K | [-H] [-P] [-S] [-b] [-p prompt]
            [-u username/#uid] [-r role] [-t type] -s | <command>
[root@devel ~]# 

Ehm...okay, there's a pipe before <command>, but why do I also get here the 
usage information?
[root@devel ~]# sudo -u root | echo "foo"
foo
usage: sudo -V | -h | -L | -l | -v | -k | -K | [-H] [-P] [-S] [-b] [-p prompt]
            [-u username/#uid] [-r role] [-t type] -s | <command>
[root@devel ~]# 

Version-Release number of selected component (if applicable):
at-3.1.8-66

How reproducible:
Everytime, see above.

Actual results:
at has a strange behaviour

Expected results:
"Normal" behaviour or better documentation or whatelse to match with the 
standards.

Comment 1 Robert Scheck 2005-03-21 08:35:26 UTC
Oh shit, this should be applied to sudo rather at. BIG SORRY!! The problem is 
sudo-1.6.7p5-30.1 (RHEL4) vs. sudo-1.6.7p5-31 (Fedora Core Development)...
re-assigning ;-)

Comment 2 Robert Scheck 2005-03-21 09:13:36 UTC
Oh dear (it's too early at Monday), the problem is such simple:

[root@devel ~]# sudo -u nobody id
usage: sudo -V | -h | -L | -l | -v | -k | -K | [-H] [-P] [-S] [-b] [-p prompt]
            [-u username/#uid] [-r role] [-t type] -s | <command>
[root@devel ~]# 

[root@rhel4 ~]# sudo -u nobody id
uid=99(nobody) gid=99(nobody) groups=99(nobody)
[root@rhel4 ~]#

Something went simply wrong at sudo, completely wrong behaviour!

Comment 3 Robert Scheck 2005-03-21 13:30:30 UTC
Ha, and this problem is caused by gcc4! If I rebuild sudo using gcc32 (compat-
package), rebuilding works and sudo also -- as expected! Fixup for gcc4, 
please... ;-)

Comment 4 Jakub Jelinek 2005-03-23 06:44:03 UTC
The fact that it works when rebuilt with gcc32 does not mean it is not a bug
in sudo.
But more importantly, you haven't specified the architecture, which is quite
important.

Comment 5 Robert Scheck 2005-03-23 08:16:27 UTC
Well, I would say anyway, the problem is sudo, because:

Take a vanilla sudo-1.6.7p5, run ./configure && make && ./sudo -u nobody id
=> Fails with the error already written above

Take a vanilla sudo-1.6.8p7, run ./configure && make && ./sudo -u nobody id
=> Works fine: uid=99(nobody) gid=99(nobody) groups=99(nobody)

But to make you, Jakub, happy: it's an i686 (Intel(R) Xeon(TM) CPU 3.06GHz) 
using gcc-Version 4.0.0 20050314 (Red Hat 4.0.0-0.34) and glibc-2.3.4-16.

Comment 6 Jakub Jelinek 2005-03-23 11:35:17 UTC
Ok, this indeed looks like a GCC bug.
As a workaround, you might prevent parse_args from being inlined
(either __attribute__((noinline)), or by removing static from it).

Comment 7 Jakub Jelinek 2005-03-25 07:40:10 UTC
Should be fixed in gcc-4.0.0-0.36.