Bug 773268 - csh.login doesn't add sbin PATHs for userdefined PATH (inconsistency with bash)
csh.login doesn't add sbin PATHs for userdefined PATH (inconsistency with bash)
Product: Fedora
Classification: Fedora
Component: setup (Show other bugs)
Unspecified Unspecified
unspecified Severity low
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-01-11 06:08 EST by Corinna Vinschen
Modified: 2012-02-12 08:45 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-02-12 08:45:08 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to /etc/csh.login which always adds the sbin paths to $path (758 bytes, patch)
2012-01-16 07:35 EST, Corinna Vinschen
no flags Details | Diff

  None (edit)
Description Corinna Vinschen 2012-01-11 06:08:47 EST
Description of problem:

  When installing wireshark, a GUI menu entry is expected to show up, but
  it isn't, at least not in XFCE4.

  The reason is the TryExec line in the file


  Given that wireshark is installed into /usr/sbin, it's not
  found in the default PATH for a normal user.  There are two
  obvious fixes possible:

  - Install wireshark to /usr/bin or
  - change fedora-wireshark.desktop so that TryExec caintains the full path:


How reproducible:

  Install wireshark and observe how wireshark does not show up in the
  XFCE4 application menu.
Comment 1 Corinna Vinschen 2012-01-11 06:42:09 EST
Oops, I just realized that the same problem applies to the "Exec"
entry in fedora-wireshark.desktop.  Right now it's

  Exec=wireshark %f

but that results in a message box

  Failed to execute command "wireshark %f".

when trying to start wireshark via the XFCE4 menu.  Same possible
fixes apply.

Comment 2 Jan Safranek 2012-01-12 03:20:09 EST
/usr/sbin is in PATH of all users (see /etc/profile) and I've just checked the desktop file works in my XFCE. Is there something what removes sbin from your PATH?
Comment 3 Corinna Vinschen 2012-01-12 04:49:26 EST
Oh, ok.

In my scenario XFCE4 is started via vncserver which is started via a
vncserver@:X.service systemd entry.  My login shell is tcsh.

Apparently the service is started with a minimal $PATH which only consists of /usr/local/bin:/bin:/usr/bin.  Since /etc/csh.login only sets $PATH if
$PATH doesn't exist yet, the sbin paths are not added to $PATH.  That's why
they are missing in XFCE4.

What I did now was to change my ~/.vnc/xstartup file to add the sbin
paths to $PATH.  That did the trick.

So I guess we can close this issue.  I just wonder if there shouldn't
be an EnvironmentFile entry in vncserver@.service by default which sets
the default path for an interactive session.

Comment 4 Jan Safranek 2012-01-16 06:26:46 EST
I would blame /etc/csh.login. IMHO both /etc/profile and /etc/csh.login should be consistent and ensure that sbin stuff is in $PATH.
Comment 5 Ondrej Vasik 2012-01-16 06:57:42 EST
Yep, it would be better to ensure that at least the most common dirs are defined in the user defined path in /etc/csh.login ( bash's /etc/profile includes /sbin, /usr/sbin, /usr/local/sbin even to the userdefined $PATH ). I'll change that in next rawhide setup build.
Comment 6 Corinna Vinschen 2012-01-16 07:35:25 EST
Created attachment 555494 [details]
Patch to /etc/csh.login which always adds the sbin paths to $path
Comment 7 Corinna Vinschen 2012-01-16 07:37:48 EST

I just attached a patch suggestion relative to /etc/csh.login
from F16.  It should be equivalent to the pathmunge functionality
in /etc/profile.  I'm just not sure if it should do the same for
/bin, /usr/bin, /usr/local/bin.

Comment 8 Corinna Vinschen 2012-01-16 07:44:48 EST
> ... should be equivalent...

Or not.  I inverted the `set path = ' lines accidentally :-(

Comment 9 Ondrej Vasik 2012-01-16 08:51:15 EST
Thanks for the patch - I planned something like that...
In Bash, default PATH is set to "/usr/local/bin:/bin:/usr/bin" - so it is not necessary to handle these dirs in pathmunge(). 
In Tcsh, it seems to be the same... so I think with your patch (after the small correction) will csh.login work correctly.
Comment 10 Corinna Vinschen 2012-01-16 09:27:05 EST
If $PATH is not defined in the environment on startup, tcsh falls back
to _PATH_DEFPATH if it exists.  On Linux, _PATH_DEFPATH is defined as

  #define _PATH_DEFPATH   "/usr/bin:/bin"

in /usr/include/paths.h.

So, if you want to have /usr/local/bin in the default path, too, it
should be included in the path list from my patch as well, it seems.

Comment 11 Ondrej Vasik 2012-01-16 09:56:25 EST
When I tried that on my tcsh account, I got "/usr/local/bin:/bin:/usr/bin" ... so probably something else changed it, strange... anyway - adjusting just sbin directories will be consistent with bash.

btw. Is there any reason in your patch to use set path instead of setenv path ? I would expect path to be set in envvars.
Comment 12 Corinna Vinschen 2012-01-16 10:39:45 EST
I examined /etc and I don't see where the /usr/local/bin is coming
from, except you set it explicitely in /etc/csh.login, as it is right
now, or you set it in your ~/.login or ~/.cshrc file.  tcsh itself
is very certainly built with defaulting to _PATH_DEFPATH, as it's
defined in the upstream sources:

  $ strings /bin/tcsh | grep /usr/bin

I used the `set path = ( ... ${path:q} )' syntax for no special reason
other than I'm used to it.  The internal $path and the external $PATH
variables are kept in sync anyway, and the ${path:q} syntax is a simple
way to correctly maintain paths with spaces in them.

Comment 13 Ondrej Vasik 2012-02-12 08:45:08 EST
Build in rawhide (and F17) as setup-2.8.48-1.fc1[78], closing RAWHIDE.

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