GNOME Bugzilla – Bug 792150
Environment variable DISPLAY and XAUTHORITY equal (null)
Last modified: 2018-01-08 18:29:06 UTC
After commit https://git.gnome.org/browse/gdm/commit/?id=5683e5d, environment variable DISPLAY and XAUTHORITY equal (null) before they get the real value. For example: 1. add a line in file /etc/gdm/PreSession/Default for i in $(env); do echo PreSession script: $i; done 2. open gdm debug info, change file /etc/gdm/custom.conf [debug] # Uncomment the line below to turn on debugging Enable=true In journal log you can see: gdm-session-worker[1822]: PreSession script: DISPLAY=(null) gdm-session-worker[1822]: PreSession script: XAUTHORITY=(null) This will make some scripts running fail if script depends on these two environment variables.
Created attachment 366237 [details] [review] Avoiding DISPLAY and XAUTHORITY equal (null)
Review of attachment 366237 [details] [review]: hey thanks for the patch! my first question is, is this fixed by commit e3f731c5ef ? Is this only for wayland sessions? ::: daemon/gdm-session.c @@ +2253,3 @@ g_variant_builder_add_parsed (&details, "{'x11-display-name', <%s>}", self->priv->display_name); + else + g_variant_builder_add_parsed (&details, "{'x11-display-name', <%s>}", ""); Thing is, we don't want DISPLAY and AUTHORITY set to "" if they're NULL, we really do want them set to NULL.
(In reply to Ray Strode [halfline] from comment #2) > Review of attachment 366237 [details] [review] [review]: > > hey thanks for the patch! my first question is, is this fixed by commit > e3f731c5ef ? Commit e3f731c5ef did not fixed this, my test environment has included commit e3f731c5ef. > Is this only for wayland sessions? X session and wayland session both have this problem. > ::: daemon/gdm-session.c > @@ +2253,3 @@ > g_variant_builder_add_parsed (&details, > "{'x11-display-name', <%s>}", self->priv->display_name); > + else > + g_variant_builder_add_parsed (&details, > "{'x11-display-name', <%s>}", ""); > > Thing is, we don't want DISPLAY and AUTHORITY set to "" if they're NULL, we > really do want them set to NULL. Yes, setting DISPLAY and AUTHORITY to "" is not the best way. I think the better way is, when DISPLAY and AUTHORITY is NULL, don't set environment variable DISPLAY and AUTHORITY, don't let them equal (null). It is weird environment variable equals (null). This problem really makes some script fail. We add xdm script in PreSession, this makes script fail and login process fail and back to gdm login screen. We want to find a way to solve it from gdm side.
Created attachment 366307 [details] [review] common: don't run scripts with bogus DISPLAY and XAUTHORITY DISPLAY and XAUTHORITY might not be set if we're starting the X server as part of the session. In that case we should ensure the variables aren't set in the environment of the gdm session scripts. This commit fixes that.
can you give that a try ⬆ ?
(In reply to Ray Strode [halfline] from comment #5) > can you give that a try ⬆ ? It works. Thanks for your solution.
Attachment 366307 [details] pushed as 5dd631c - common: don't run scripts with bogus DISPLAY and XAUTHORITY