After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 682907 - GDM_SESSION_DEFAULT_PATH overrides system default user PATH
GDM_SESSION_DEFAULT_PATH overrides system default user PATH
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2012-08-28 23:57 UTC by Reuben Thomas
Modified: 2012-08-29 20:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
slave: don't set PATH in two places (4.80 KB, patch)
2012-08-29 20:29 UTC, Ray Strode [halfline]
committed Details | Review

Description Reuben Thomas 2012-08-28 23:57:30 UTC
GDM hardwires the user's initial PATH, via GDM_SESSION_DEFAULT_PATH.

See https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/978259 for a description of the problem, and suggested solution, and https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/844103 for another discussion (the two bugs are duplicates, with the latter authoritative).

I presume there is a reason why the code for GDM_SESSION_DEFAULT_PATH exists, so assuming that the suggestion to simply comment out the setting of PATH is impractical, is there a chance of allowing gdm to be configured so that (on systems where PATH is reliably set by PAM or some other mechanism) GDM_SESSION_DEFAULT_PATH is overridden by the system setting?

Otherwise, gdm must be recompiled whenever the default PATH is changed, which seems a bit hard on sysadmins.
Comment 1 Ray Strode [halfline] 2012-08-29 14:37:04 UTC
we could probably only set GDM_SESSION_DEFAULT_PATH if PATH is unset, and use PATH otherwise.  Of course, PATH would need to be set before GDM is started.  Is that the case?
Comment 2 Reuben Thomas 2012-08-29 19:48:37 UTC
PATH is not set before GDM is started, at least, not for the purposes of this bug. The setting of PATH that is important is the default setting for users once they have logged in, and of course when gdm is running they have not yet logged in.

Hence, it seems that GDM_SESSION_DEFAULT_PATH only makes sense when gdm is being used in such a way that there is no login step (automatic or otherwise).
Comment 3 Ray Strode [halfline] 2012-08-29 20:24:53 UTC
ah so the problem (i think) is that pam_env is refusing to overwrite the default we put in place. it looks like this is configurable in pam_env.conf but not /etc/environment. 

The launchpad link posts this snippet:

        /* FIXME: We do this here and in the session worker. We should consolidate
         * somehow.
         */

        gdm_session_direct_set_environment_variable (session,
                                                     "PATH",
                                                     strcmp (BINDIR, "/usr/bin") == 0?
                                                     GDM_SESSION_DEFAULT_PATH :
                                                     BINDIR ":" GDM_SESSION_DEFAULT_PATH);

Well we should just fix the FIXME.  Drop         gdm_session_direct_set_environment_variable (session) and instead do it soley session-worker (if it wasn't already done by exec() time
Comment 4 Ray Strode [halfline] 2012-08-29 20:28:58 UTC
The following fix has been pushed:
d3b749e slave: don't set PATH in two places

I think this should fix it, if not please reopen.
Comment 5 Ray Strode [halfline] 2012-08-29 20:29:00 UTC
Created attachment 222841 [details] [review]
slave: don't set PATH in two places

It's redundant and causing confusion with pam_env.