Public bug reported:

The debian/Xsession script (presumably overriding the one used by
upstream) re-execs itself with the user's $SHELL and, depending on the
concrete shell type, sources some login and profile scripts.  Then it
sources /etc/X11/Xsession, which in turn sources the scripts in
/etc/X11/Xsession.d.

In the particular case when $SHELL is zsh, debian/Xsession currently
does the following:

    [ -z "$ZSH_NAME" ] && exec $SHELL $0 "$@"
    emulate -R zsh
    [ -d /etc/zsh ] && zdir=/etc/zsh || zdir=/etc
    zhome=${ZDOTDIR:-$HOME}
    # zshenv is always sourced automatically.
    [ -f $zdir/zprofile ] && . $zdir/zprofile
    [ -f $zhome/.zprofile ] && . $zhome/.zprofile
    [ -f $zdir/zlogin ] && . $zdir/zlogin
    [ -f $zhome/.zlogin ] && . $zhome/.zlogin
    setopt shwordsplit noextendedglob

which means that scripts in /etc/X11/Xsession.d are sourced as zsh,
contrary to what's mentioned in most of them, namely that they are
sourced by Xsession(5), which "is a Bourne shell (sh(1)) script"
(according the the manpage).

In many of these scripts, the following idiom is applied:

    SOMEVAR=$SOMEVAR:somevalue

When this is parsed by zsh, the $VAR:x construct is interpreted as the
value held in $VAR with modifier x.  If this idiom were to be used in
zsh, it would have to be written as

    SOMEVAR=${SOMEVAR}:somevalue

in order to prevent the first letter of somevalue to be interpreted as a
modifier.

Since the Xsession.d scripts are meant to be interpreted as Bourne
scripts, zsh should be set in Bourne shell compatibility mode before
sourcing /etc/X11/Xsession (by adding 'emulate -R sh' as the last
command in the compound-list), or maybe instead of sourcing
/etc/X11/Xsession, the script should exec it.

** Affects: sddm (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: exec source xsession zsh

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2108975

Title:
  SDDM's custom Xsession dealing with zsh

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/sddm/+bug/2108975/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to