Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 532032 - lxde-base/lxdm sets DESKTOP_SESSION=MATE but DESKTOP_SESSION=mate is expected by mate-base/mate-session-manager-1.8.1-r1, mate-base/mate-menus-1.8.0
Summary: lxde-base/lxdm sets DESKTOP_SESSION=MATE but DESKTOP_SESSION=mate is expected...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: LXDE team (DEFUNCT)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-09 08:40 UTC by Joakim Tjernlund
Modified: 2016-08-14 18:15 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
LXDM Xsession, copied from lightdm, minor adjustments (Xsession,1.80 KB, application/x-shellscript)
2014-12-24 12:23 UTC, Joakim Tjernlund
Details
Patch lxdm-0.5.0 to use Xsession (lxdm-0.5.0.patch,411 bytes, text/plain)
2014-12-24 12:24 UTC, Joakim Tjernlund
Details
LXDM Xsession (Xsession,1.93 KB, application/x-shellscript)
2015-01-17 13:05 UTC, Joakim Tjernlund
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joakim Tjernlund 2014-12-09 08:40:05 UTC
mate-base/mate-session-manager:
  /etc/X11/xinit/xinitrc.d/{10-user-dirs-update-mate,15-xdg-data-mate}
mate-base/mate-menus:
  /etc/X11/xinit/xinitrc.d/10-xdg-menu-mate
all test for "$DESKTOP_SESSION" = "mate"
However LXDM (lxde-base/lxdm) sets DESKTOP_SESSION to "MATE" so
the scripts will never trigger.


Note that lightdm sets DESKTOP_SESSION to "mate"
Comment 1 Joakim Tjernlund 2014-12-09 09:10:06 UTC
I also note that this scripts fails, /etc/X11/xinit/xinitrc.d/15-xdg-data-mate
#!/bin/sh

if [ "$DESKTOP_SESSION" = "mate" ]; then
	if [ -z "$XDG_DATA_DIRS" ]; then
		export XDG_DATA_DIRS=/usr/share/mate:/usr/local/share/:/usr/share/
	else
		export XDG_DATA_DIRS=/usr/share/mate:"$XDG_DATA_DIRS"
	fi
fi
evne when the "$DESKTOP_SESSION" = "mate" has been fixed
This appears to be overwritten by /etc/env.d/90xdg-data-base and
/etc/env.d/30xdg-data-local

Remove those two env.d files fixes the problem.


Again, lighdm works fine in this regard
Comment 2 Joakim Tjernlund 2014-12-10 10:34:01 UTC
Found the problem with XDG_DATA_DIRS, /etc/lxdm/Xsession have last:
  exec -l bash -c "$LXSESSION"
The -l make it a login shell which sources /etc/profile.env again
and overwrite previous XDG_DATA_DIRS

Removing the -l seems to work without problems but I cannot say for sure though.

Does LXDM need to launch a login shell?
Comment 3 Joakim Tjernlund 2014-12-10 10:39:29 UTC
Browsing the net indicates that the DESKTOP_SESSION name should all
be lower case.

I think this bug should be transferred to the lxdm maintainers.
Can someone do that for me?
Comment 4 Joakim Tjernlund 2014-12-10 15:23:57 UTC
This script put into /etc/lxdm/xinitrc :
----------------------------------------
LXSESSION=$1

#Convert to lower case
DESKTOP_SESSION=${DESKTOP_SESSION,,}
export DESKTOP_SESSION

lxdm_xinit="
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
    for f in /etc/X11/xinit/xinitrc.d/* ; do
	[ -x \"\$f\" ] && . \"\$f\"
    done
    unset f
fi
$LXSESSION
"

if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS";
then
    eval "$(dbus-launch --sh-syntax --exit-with-session)"
fi

exec -l bash -c "eval $lxdm_xinit"
------------------------------------

Fixes the MATE problem while keeping login shell (exec -l) semantics
Comment 5 Matthias Maier gentoo-dev 2014-12-10 23:17:15 UTC
Assigning to lxde herd as this looks like a bug in lxdm.
Comment 6 Joakim Tjernlund 2014-12-22 12:25:19 UTC
ping?

I suspect the real bug is starting an login shell. I am back to

/etc/lxdm/xinitrc:

LXSESSION=$1

#Convert to lower case
DESKTOP_SESSION=${DESKTOP_SESSION,,}
export DESKTOP_SESSION

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
    for f in /etc/X11/xinit/xinitrc.d/* ; do
	[ -x "$f" ] && . "$f"
    done
    unset f
fi

if which dbus-launch >/dev/null && test -z "$DBUS_SESSION_BUS_ADDRESS";
then
    eval "$(dbus-launch --sh-syntax --exit-with-session)"
fi

exec bash -c "$LXSESSION"
Comment 7 Markos Chandras (RETIRED) gentoo-dev 2014-12-22 17:08:37 UTC
did you try to discuss this with lxdm upstream?
Comment 8 Joakim Tjernlund 2014-12-22 17:17:12 UTC
(In reply to Markos Chandras from comment #7)
> did you try to discuss this with lxdm upstream?

No, but I fired off a mail just now.
Comment 9 Joakim Tjernlund 2014-12-22 17:24:28 UTC
(In reply to Markos Chandras from comment #7)
> did you try to discuss this with lxdm upstream?

No, but I fired off a mail just now. (In reply to Joakim Tjernlund from comment #8)
> (In reply to Markos Chandras from comment #7)
> > did you try to discuss this with lxdm upstream?
> 
> No, but I fired off a mail just now.

However, looking at /etc/lxdm/Xsession, Gentoo should just
provide it own script like /etc/X11/Xsession or /etc/X11/xinit/Xsession
and be done.

Currenlty Gentoo ends up in the default and that is a bad default.
Comment 10 Joakim Tjernlund 2014-12-22 19:33:56 UTC
This is lightdm Xsession file, looks alot cleaner and also processes
/etc/X11/Xresources, "$HOME/.Xresources"



#!/bin/sh
#
# LightDM wrapper to run around X sessions.

echo "Running X session wrapper"

# Load profile
for file in "/etc/profile" "$HOME/.profile" "/etc/xprofile" "$HOME/.xprofile"; do
    if [ -f "$file" ]; then
        echo "Loading profile from $file";
        . "$file"
    fi
done

# Load resources
for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do
    if [ -f "$file" ]; then
        echo "Loading resource: $file"
        xrdb -nocpp -merge "$file"
    fi
done

# Load keymaps
for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
    if [ -f "$file" ]; then
        echo "Loading keymap: $file"
        setxkbmap `cat "$file"`
        XKB_IN_USE=yes
    fi
done    

# Load xmodmap if not using XKB
if [ -z "$XKB_IN_USE" ]; then
    for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
        if [ -f "$file" ]; then
           echo "Loading modmap: $file"
           xmodmap "$file"
        fi
    done
fi

unset XKB_IN_USE

# Run all system xinitrc shell scripts.
xinitdir="/etc/X11/xinit/xinitrc.d"
if [ -d "$xinitdir" ]; then
    for script in $xinitdir/*; do
        echo "Loading xinit script $script"
        if [ -x "$script" -a ! -d "$script" ]; then
            . "$script"
        fi
    done
fi

# Load Xsession scripts
xsessionddir="/etc/X11/Xsession.d"
if [ -d "$xsessionddir" ]; then
    for i in `ls $xsessionddir`; do
        script="$xsessionddir/$i"
        echo "Loading X session script $script"
        if [ -r "$script"  -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
            . "$script"
        fi
    done
fi

echo "X session wrapper complete, running session $@"

exec $@
Comment 11 Markos Chandras (RETIRED) gentoo-dev 2014-12-22 21:00:35 UTC
such changes should be communicated with upstream so all distros can benefit from them. I am not going to patch lxdm like that.
Comment 12 Joakim Tjernlund 2014-12-22 21:26:54 UTC
(In reply to Markos Chandras from comment #11)
> such changes should be communicated with upstream so all distros can benefit
> from them. I am not going to patch lxdm like that.

Sure, I was hoping a maintainer could bring some sense out of this and
move forward. I really don't know this stuff, I just sniff out
the error and try to suggest something that *COULD* be a way forward.
Comment 13 Joakim Tjernlund 2014-12-23 17:57:09 UTC
I just found out that the below files are Gentoo specific, please
update mate-base/mate-session-manager and mate-base/mate-menus to
look for both "mate" and "MATE"

mate-base/mate-session-manager:
  /etc/X11/xinit/xinitrc.d/{10-user-dirs-update-mate,15-xdg-data-mate}
mate-base/mate-menus:
  /etc/X11/xinit/xinitrc.d/10-xdg-menu-mate
all test for "$DESKTOP_SESSION" = "mate"
However LXDM (lxde-base/lxdm) sets DESKTOP_SESSION to "MATE" so
the scripts will never trigger.
Comment 14 Matthias Maier gentoo-dev 2014-12-23 18:02:33 UTC
Good point. Will do.
Comment 15 Joakim Tjernlund 2014-12-23 18:08:42 UTC
(In reply to Markos Chandras from comment #11)
> such changes should be communicated with upstream so all distros can benefit
> from them. I am not going to patch lxdm like that.

It just occurred to me that LXDM expects distributions to
provide its own startup script(from /etc/lxdm/Xsession):
#!/bin/bash

# use bash for "exec -l", howto run login shell by /bin/sh ?

if [ $# -eq 1 -a -n "$1" ]; then
	LXSESSION=$1
else
# default session
	LXSESSION=/usr/bin/startlxde
fi

[ -f /etc/profile ] && . /etc/profile
[ -f ~/.profile ] && . ~/.profile

if [ -f /etc/X11/xinit/xinitrc-common ]; then
# fedora
	. /etc/X11/xinit/xinitrc-common
	exec -l bash -c "$LXSESSION"
elif [ -x /etc/X11/xinit/Xsession ]; then
# fedora
	exec /etc/X11/xinit/Xsession "$LXSESSION"
elif [ -x /etc/X11/Xsession ]; then
# mandriva, debian, ubuntu
	exec /etc/X11/Xsession "$LXSESSION"
elif [ -x /etc/X11/xinit/xinitrc ]; then
#suse
	export WINDOWMANAGER=$LXSESSION
	exec -l bash -c /etc/X11/xinit/xinitrc
else
# unknown, user should custom /etc/lxdm/xinitrc self
	if [ -x /etc/lxdm/xinitrc ]; then
		. /etc/lxdm/xinitrc "$LXSESSION"
	fi

So Gentoo should provide its own script, either a /etc/X11/Xsession or
/etc/lxdm/xinitrc will do.

I propose a modified lightdm script:
#!/bin/sh
#
# LightDM wrapper to run around X sessions.

echo "Running X session wrapper"

#Convert MATE to lower case, until mate scripts are fixed
[ "$DESKTOP_SESSION" = "MATE" ] && DESKTOP_SESSION = mate
export DESKTOP_SESSION

# Load resources
for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do
    if [ -f "$file" ]; then
        echo "Loading resource: $file"
        xrdb -nocpp -merge "$file"
    fi
done

# Load keymaps
for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do
    if [ -f "$file" ]; then
        echo "Loading keymap: $file"
        setxkbmap `cat "$file"`
        XKB_IN_USE=yes
    fi
done    

# Load xmodmap if not using XKB
if [ -z "$XKB_IN_USE" ]; then
    for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do
        if [ -f "$file" ]; then
           echo "Loading modmap: $file"
           xmodmap "$file"
        fi
    done
fi

unset XKB_IN_USE

#Make DBUS start optimally
command=$@

# Run all system xinitrc shell scripts.
xinitdir="/etc/X11/xinit/xinitrc.d"
if [ -d "$xinitdir" ]; then
    for script in $xinitdir/*; do
        echo "Loading xinit script $script"
        if [ -x "$script" -a ! -d "$script" ]; then
            . "$script"
        fi
    done
fi

# Load Xsession scripts
xsessionddir="/etc/X11/Xsession.d"
if [ -d "$xsessionddir" ]; then
    for i in `ls $xsessionddir`; do
        script="$xsessionddir/$i"
        echo "Loading X session script $script"
        if [ -r "$script"  -a -f "$script" ] && expr "$i" : '^[[:alnum:]_-]\+$' > /dev/null; then
            . "$script"
        fi
    done
fi

echo "X session wrapper complete, running session $@"

exec $command
Comment 16 Markos Chandras (RETIRED) gentoo-dev 2014-12-23 19:36:03 UTC
posting code in comments is very inefficient. Please create proper patches or files and attach them separately
Comment 17 Joakim Tjernlund 2014-12-23 23:26:25 UTC
(In reply to Markos Chandras from comment #16)
> posting code in comments is very inefficient. Please create proper patches
> or files and attach them separately

This was just for Comments, I find it easier to comment inline.
Is my suggestion acceptable at all?

Perhars we should just replace /etc/lxdm/Xsession with our own?
Which is POSIX sh compatile also?
Comment 18 Joakim Tjernlund 2014-12-24 12:20:40 UTC
(In reply to Joakim Tjernlund from comment #17)
> (In reply to Markos Chandras from comment #16)
> > posting code in comments is very inefficient. Please create proper patches
> > or files and attach them separately
> 
> This was just for Comments, I find it easier to comment inline.
> Is my suggestion acceptable at all?
> 
> Perhars we should just replace /etc/lxdm/Xsession with our own?
> Which is POSIX sh compatile also?

This is precisley what lightdm does so patch will follow
Comment 19 Joakim Tjernlund 2014-12-24 12:23:02 UTC
Created attachment 392316 [details]
LXDM Xsession, copied from lightdm, minor adjustments
Comment 20 Joakim Tjernlund 2014-12-24 12:24:36 UTC
Created attachment 392318 [details]
Patch lxdm-0.5.0 to use Xsession
Comment 21 Joakim Tjernlund 2015-01-12 18:01:37 UTC
(In reply to Matthias Maier from comment #14)
> Good point. Will do.

Ping?
Comment 22 Joakim Tjernlund 2015-01-17 13:05:54 UTC
Created attachment 394158 [details]
LXDM Xsession

Fixed a bug 
  [ "$DESKTOP_SESSION" = "MATE" ] && DESKTOP_SESSION = mate
needs to be
  [ "$DESKTOP_SESSION" = "MATE" ] && DESKTOP_SESSION=mate
Comment 23 Joakim Tjernlund 2015-05-24 16:33:04 UTC
Cold someone move this along please?
Comment 24 Joakim Tjernlund 2015-07-11 19:27:00 UTC
This is getting old, why cannot LXDE team act on this?
Comment 25 Joakim Tjernlund 2016-07-25 19:27:00 UTC
ping
Comment 26 Brian Evans (RETIRED) gentoo-dev 2016-08-14 18:15:12 UTC
Changes added with lxdm-0.5.3