Bug 322505 - kdm does not execute Xsession scripts as sh scripts
Summary: kdm does not execute Xsession scripts as sh scripts
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kdm
Classification: Miscellaneous
Component: general (show other bugs)
Version: 4.10.2
Platform: Debian unstable Linux
: NOR normal
Target Milestone: ---
Assignee: kdm bugs tracker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-17 21:37 UTC by Thomas Preud'homme
Modified: 2018-04-16 20:25 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Preud'homme 2013-07-17 21:37:55 UTC
Currently, when the user shell is zsh, kdm launch the X session in zsh 
emulation mode (it does "emulate -R zsh" in /etc/kde4/kdm/Xsession as generated by kdm/kfrontend/genkdmconf.c). However, all X session scripts assume bourne shell behavior. In particular, this leads to a bug in /usr/share/im-config/data/20_ibus.rc

This file contains several line like this one:

for IM_CONFIG_MARKER in $(ls /usr/lib/*/gtk-2.0/*/immodules/im-ibus.so \
                        /usr/lib/gtk-2.0/*/immodules/im-ibus.so 2>/dev/null || 
true); do

In zsh emulation mode this fails because either all the modules are in arch-
specific path, or not and in this case zsh just returns an error. Quoting 
zshexpn manpage:

The word is replaced with a list of sorted filenames that match the pattern. If 
no matching pattern is found, the shell gives an error message, unless the 
NULL_GLOB option is set, in  which  case  the  word is deleted; or unless the 
NOMATCH option is unset, in which case the word is left unchanged.

Because of this, GTK and QT apps don't use ibus despite it being running.

I tried changing the "emulate -R zsh" line by "emulate -R sh" and it now works 
great for me since several weeks. It seems though that you (kdm developers) 
explicitely want the shell to behave in its normal mode since "set +o 
posix" is executed for bash so there might be a reason to execute zsh in zsh emulation mode but I'm not sure what that is.

Therefore, I'm not sure what the correct solution is but at least I can tell that Xsession scripts are expecting to be executed as bourne shell scripts. as can be seen from the few #!/bin/sh shebang lines in /etc/X11/Xsession and in some other places (I forgot where).

Best regards,

Thomas

Reproducible: Always

Steps to Reproduce:
1. Install im-config and ibus
2. Set user shell to zsh
3. echo $QT4_IM_MODULE in a shell
Actual Results:  
QT4_IM_MODULE is not set

Expected Results:  
Changing "emulate -R zsh" to "emulate -R sh" in /etc/kde4/kdm/Xsession lead to the correct behavior : QT4_IM_MODULE is set to ibus.
Comment 1 Marshall Pierce 2013-09-14 18:50:02 UTC
I think I'm seeing this same problem manifest itself in a different way: I can't log in at all, and my .xsession-errors has this in it:

/usr/share/config/kdm/Xsession:59: bad math expression: operand expected at `/etc/X11/x...'

See http://forum.kde.org/viewtopic.php?f=66&t=117462&p=292299#p292299 for the forum thread on this.
Comment 2 Nate Graham 2018-04-16 20:25:27 UTC
KDM is unmaintained and not used in KDE Plasma 5.

SDDM is the login manager used in KDE Plasma 5. If you still have this same issue with SDDM, please file an issue on the SDDM bugtracker (after doing a search for existing issues first!): https://github.com/sddm/sddm/issues/