Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 621400

Summary: sys-apps/baselayout-2.4.1: empty PATH after using su/sudo
Product: Gentoo Linux Reporter: Michał Górny <mgorny>
Component: Current packagesAssignee: William Hubbs <williamh>
Status: RESOLVED INVALID    
Severity: critical CC: base-system, floppym, herrtimson
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-06-10 14:31:04 UTC
After upgrading to new baselayout, env-update, etc.:

$ . /etc/profile
$ echo $PATH
/usr/x86_64-pc-linux-gnu/gcc-bin/5.4.0:[...] [correct]
$ sudo bash
Password: 
# echo $PATH

[empty]

Same after using su.

Funny enough, commenting the bit setting PATH=${ROOTPATH} seems to fix it somehow. Direct login to root works fine. /etc/profile.env contains ROOTPATH.
Comment 1 Mike Gilbert gentoo-dev 2017-06-10 14:44:08 UTC
I can't reproduce this. Can you share your sudoers file?
Comment 2 Mike Gilbert gentoo-dev 2017-06-10 15:03:38 UTC
Also, if you have secure_path enabled (it is enabled by default), the default value of PATH gets compiled into the sudo binary.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-06-10 20:11:02 UTC
Turned out to be PEBKAC. I had an old .bashrc entry that grepped profile files for path end evaled that (probably workaround for some issue). The grep just happened to catch too much post the change.