Bug 773268 - csh.login doesn't add sbin PATHs for userdefined PATH (inconsistency with bash)
Summary: csh.login doesn't add sbin PATHs for userdefined PATH (inconsistency with bash)
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: setup
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-01-11 11:08 UTC by Corinna Vinschen
Modified: 2012-02-12 13:45 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-02-12 13:45:08 UTC
Type: ---
Embargoed:


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

Description Corinna Vinschen 2012-01-11 11:08:47 UTC
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
  /usr/share/applications/fedora-wireshark.desktop

    TryExec=wireshark

  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:

      TryExec=/usr/sbin/wireshark

How reproducible:

  Install wireshark and observe how wireshark does not show up in the
  XFCE4 application menu.

Comment 1 Corinna Vinschen 2012-01-11 11:42:09 UTC
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.


Corinna

Comment 2 Jan Safranek 2012-01-12 08:20:09 UTC
/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 09:49:26 UTC
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.


Thanks,
Corinna

Comment 4 Jan Safranek 2012-01-16 11:26:46 UTC
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 11:57:42 UTC
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 12:35:25 UTC
Created attachment 555494 [details]
Patch to /etc/csh.login which always adds the sbin paths to $path

Comment 7 Corinna Vinschen 2012-01-16 12:37:48 UTC
Hi,

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.


Thanks,
Corinna

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

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


Sorry,
Corinna

Comment 9 Ondrej Vasik 2012-01-16 13:51:15 UTC
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 14:27:05 UTC
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.


Corinna

Comment 11 Ondrej Vasik 2012-01-16 14:56:25 UTC
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 15:39:45 UTC
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.


Corinna

Comment 13 Ondrej Vasik 2012-02-12 13:45:08 UTC
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.