FS#35620 - [systemd] $PATH defaults to include /usr/sbin.

Attached to Project: Arch Linux
Opened by Curtis Shimamoto (WonderWoofy) - Monday, 03 June 2013, 15:50 GMT
Last edited by Dave Reisner (falconindy) - Monday, 03 June 2013, 20:40 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Dave Reisner (falconindy)
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description: In src/core/main.c there is a default PATH set according to whether or not split /usr is set. But if it is not, it is set to /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin. This seemed to be a sane default until our recent /usr move. Now we don't actually have a /usr/sbin that is not a symlink, so it does not match wth out current PATH set by /etc/profile.


Additional info:
* systemd 204-3 (probably all actually)
* the source file in question is src/core/main.c, and begins on line 1474. This includes this:

/* Set up PATH unless it is already set */
setenv("PATH",
#ifdef HAVE_SPLIT_USR
"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
#else
"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin",
#endif

It should be noted that this only has an effect in instances where the /etc/profile is not sourced. So for example, it happens if one uses systemd --user. I thought about submitting this upstream, but I think that since we at Arch Linux have quickly moved to the unified /usr/bin setup, we are likely one of the very, very few effected. So at this point in time, it is probably more reasonable to simply patch this ourselves, though please let me know if you disagree.

Also, since the PATH that it does default to also works, this should not be looked at with any kind of severity in priority. Having things fall into the /usr/sbin path seems to be of no real consequence, and does not make my system run any differently. But I did actually go and change the PATH in the main.c file and have been using it for about a day, with no ill effects (I didn't expect anything to go wrong by changing the PATH to mirror what is in /etc/profile).

So I just wanted to bring this to someone's attention, and this seemed like the best way to ensure that the proper people will know of this "issue".


Steps to reproduce: Simply user "systemd --user" and see what the PATH defaults to. To set this up, one should follow the systemd/user section in the wiki, though I am fairly certain that Tom Gunderson uses this already, as he maintains the user-session-units and xorg-launch-helper AUR packages. So it may be good to simply ask him, or assign him this report. He was also the one to propose and fix the PATH variable set by /etc/profile.
This task depends upon

Closed by  Dave Reisner (falconindy)
Monday, 03 June 2013, 20:40 GMT
Reason for closing:  Upstream
Additional comments about closing:  This is harmless and will eventually fix itself.
Comment by Dave Reisner (falconindy) - Monday, 03 June 2013, 20:02 GMT
This was done because fedora half-assed their usr merge and left out /usr/sbin (for now). I'm not interested in doing anything here:

- it's harmless
- it's the upstream default
- eventually this solves itself
Comment by Curtis Shimamoto (WonderWoofy) - Monday, 03 June 2013, 20:24 GMT
Yes, I agree on all three of those points. Thanks Dave.

Loading...