www.cendio.com

Bug 5077

Summary: set display manager environment variables
Product: ThinLinc Reporter: Pierre Ossman <ossman@cendio.se>
Component: MiscAssignee: Pierre Ossman <ossman@cendio.se>
Status: CLOSED FIXED QA Contact: Bugzilla mail exporter <bugzilla-qa@cendio.se>
Severity: Normal    
Priority: P2 CC: samuel@cendio.se
Version: trunkKeywords: prosaic, samuel_tester
Target Milestone: 4.2.0   
Hardware: PC   
OS: Unknown   
Acceptance Criteria:
Bug Depends on:    
Bug Blocks: 5065    

Description From cendio 2014-04-09 11:29:58
(copied from bug 5065)

Desktop environments and applications are getting more dependent on being
started from a display manager. They expect certain environment variables to be
set that indicate which desktop environment is being used[1]. ThinLinc does not
set these and that's a general issue that we need to look at.

We need to start setting these environment variables:

    DESKTOP_SESSION
    XDG_SESSION_DESKTOP
    XDG_CURRENT_DESKTOP

Now the big problem is that those variables are strongly connected to the
session definitions in /usr/share/xsessions[2]. But in ThinLinc we've
completely ignored that mechanism in favour of our own profile selector. We
need to bridge that gap somehow.

I see two approaches:

1) We duplicate the information from these files into new fields in our
profiles.

2) We create a link between the profile entry and the relevant xsessions file.
The profile selector can then fetch any info it needs from there. We could even
replace cmdline and testcmd with information gathered.


The big difference between these two is how reliant we'll be on these files on
the system. We'll never be independent of them as the whole point is that we
need the information in there.

So the question is what is the risk that a xsessions file is missing or broken
even when the desktop environment is installed? I would guess that risk is low
as there is so much that depends on the exact naming and attributes of these
files.

[1] Why this isn't set by the desktop environment itself is beyond me...
[2] And possibly some other paths. Some info:

https://lists.debian.org/debian-devel/2004/05/msg00410.html
------- Comment #1 From cendio 2014-04-14 14:13:10 -------
Note that pam_systemd also looks at XDG_SESSION_DESKTOP. Unfortunately ThinLinc
runs PAM before selecting a desktop environment, so we're going to have to live
without that bit.
------- Comment #2 From cendio 2014-04-15 17:01:58 -------
Commited in 28853:28865 and 28869.
------- Comment #3 From cendio 2014-04-16 14:09:04 -------
Tester should verify:

 - That TLCOMMAND works

 - That all profile stanzas work

 - That gnome 2 and CDE work on Solaris

 - That gnome 2 works on Linux (e.g. RHEL)

 - That DESKTOP_SESSION and XDG_SESSION_DESKTOP are set

 - That XDG_CURRENT_DESKTOP is set from DesktopNames:

 - That XDG_CURRENT_DESKTOP is set from X-LightDM-DesktopName:

 - That multiple xdg_session entries follow the documented behaviour

 - That failure to find the .desktop file hides the entry

 - That TryExec is used.

 - That TryExec is ignored if empty.

 - That the documented fields are fetched from the .desktop file, and can
individually be overwritten.

 - That $XDG_TRY_EXEC is properly set for testcmd

 - That $XDG_EXEC is properly set for cmdline

 - Logging

 - That a single profile removes the choice

 - That no profiles results in an error

 - That you can create, remove and modify profiles from tlwebadm

 - That you can have an empty name in tlwebadm

 - Documentation

 - General error handling. Try to break everything. :)
------- Comment #4 From cendio 2014-05-06 11:31:36 -------
r24517 causes this:

$ LANG=C /opt/thinlinc/libexec/tl-select-profile
/opt/thinlinc/libexec/tl-select-profile:376: SyntaxWarning: name 'group_leader'
is assigned to before global declaration
  global group_leader
------- Comment #5 From cendio 2014-05-06 15:37:34 -------
(In reply to comment #4)
> r24517 causes this:
> 
> $ LANG=C /opt/thinlinc/libexec/tl-select-profile
> /opt/thinlinc/libexec/tl-select-profile:376: SyntaxWarning: name 'group_leader'
> is assigned to before global declaration
>   global group_leader

Fixed in r28944.
------- Comment #6 From cendio 2014-05-07 11:24:59 -------
(In reply to comment #3)
> Tester should verify:
> 
>  - That TLCOMMAND works

Verified on RHEL6 with build 4338.

>  - That all profile stanzas work
>
>  - That gnome 2 and CDE work on Solaris
> 
>  - That gnome 2 works on Linux (e.g. RHEL)
> 
>  - That DESKTOP_SESSION and XDG_SESSION_DESKTOP are set

CDE and gnome2 verified on Solaris with build 4332.
KDE, gnome2 and Windows verified on RHEL6 with build 4338.
gnome3, gnome-classic, Cinnamon, MATE and XFCE verified on Fedora 20 with build
4338.
Unity verified on Ubuntu 14.04 with build 4344.<

>  - That XDG_CURRENT_DESKTOP is set from DesktopNames:
> 
>  - That XDG_CURRENT_DESKTOP is set from X-LightDM-DesktopName:

Verified on Fedora 20 with build 4338, it works in XFCE and Gnome but with the
exception of Cinnamon. 
Using Cinnamon no matter if /usr/share/xsessions/cinnamon.desktop contains
values for DesktopNames or X-LightDM-DesktopName the XDG_CURRENT_DESKTOP
variable is always "GNOME".

>  - That multiple xdg_session entries follow the documented behaviour
> 
>  - That failure to find the .desktop file hides the entry
> 
>  - That TryExec is used.
> 
>  - That TryExec is ignored if empty.
> 
>  - That the documented fields are fetched from the .desktop file, and can
> individually be overwritten.
> 
>  - That $XDG_TRY_EXEC is properly set for testcmd
> 
>  - That $XDG_EXEC is properly set for cmdline
> 
>  - Logging
>
>  - That a single profile removes the choice
> 
>  - That no profiles results in an error
> 
>  - That you can create, remove and modify profiles from tlwebadm
> 
>  - That you can have an empty name in tlwebadm

Verified with build 4346 on Fedora 20.

>  - Documentation
> 
>  - General error handling. Try to break everything. :)

Looks good.