Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 136027 - app-admin/sudo and hardcoded $PATH problems with gcc
Summary: app-admin/sudo and hardcoded $PATH problems with gcc
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Andrea Barisani (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-07 22:45 UTC by David Brown
Modified: 2006-08-06 09:34 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch against sys-admin/sudo-1.6.8_p9-r2 removing ../gcc-bin/.. path elements (oops. reverse patch -- sorry) (sudo-1.6.8_p9-r2.ebuild.patch-remove-gcc-bin-from-path,1.05 KB, patch)
2006-06-23 19:18 UTC, Aaron Brooks
Details | Diff
Patch against sys-admin/sudo-1.6.8_p9-r2 removing ../gcc-bin/.. path elements (sudo-1.6.8_p9-r2.ebuild.patch-remove-gcc-bin-from-path,1.05 KB, patch)
2006-06-28 19:36 UTC, Aaron Brooks
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Brown 2006-06-07 22:45:13 UTC
The 'app-admin/sudo' package hardcodes the ROOT_PATH into its executable.  If a user changes GCC versions, but doesn't rebuild sudo, then commands executed via sudo will still use the old gcc version.  It would be useful to mention this in the gcc-upgrade manual.

The rebuild of sudo is a little tricky, since if you use sudo to do it, it will still get the old path.  The easiest way to do it is:

  % sudo bash -l
  # emerge app-admin/sudo

With the 'bash -l' giving a login shell, which will run the /etc/profile again.
Comment 1 Aaron Brooks 2006-06-23 19:13:58 UTC
This issue is not a documentation issue -- there's a fix to this.

The gcc wrapper that is provided by gcc-config checks $PATH in the
user's environment first but will fall back and check /etc/env.d/05gcc
if $PATH does not contain a gcc-bin path. See:

    /usr/portage/sys-devel/gcc-config/files/wrapper-1.4.7.c

Since sudo is always configured --with-secure-path="$ROOTPATH",
$ROOTPATH should have the gcc-bin stripped from it.

I think it's pretty clear that since the gcc-bin path is specific to
a compiler version, compiling it into sudo will necessarily result in
a broken sudo. In my opinion the correct action is to strip gcc-bin
from $PATH allowing the gcc wrapper to check the more up to date value
in /etc/env.d/.

I'm attaching a patch to sudo-1.6.8_p9-r2.ebuild which performs the
above. This patch works on my system.
Comment 2 Aaron Brooks 2006-06-23 19:18:20 UTC
Created attachment 89971 [details, diff]
Patch against sys-admin/sudo-1.6.8_p9-r2 removing ../gcc-bin/.. path elements (oops. reverse patch -- sorry)
Comment 3 nm (RETIRED) gentoo-dev 2006-06-24 08:40:42 UTC
Not a documentation bug; reassigning.
Comment 4 Aaron Brooks 2006-06-28 19:36:58 UTC
Created attachment 90397 [details, diff]
Patch against sys-admin/sudo-1.6.8_p9-r2 removing ../gcc-bin/.. path elements
Comment 5 Aaron Brooks 2006-08-02 17:17:59 UTC
Is there anything happening with this bug? The current behavior of
sudo breaks gcc-wrapper functionality, making it impossible to switch
gcc profiles while using sudo. This should be fixed. The attached
patch is sufficient to create the correct behavior.
Comment 6 Tavis Ormandy (RETIRED) gentoo-dev 2006-08-06 09:34:55 UTC
p12-r1 in cvs fixes this issue, it's ~x86 currently but assuming everything goes well I'll file a stable request soon.

Thanks for the patch.