Bug#905129: im-config: Wrongly run shell scripts with user's shell interpreter, raises error with zsh
Package: im-config
Severity: important
Version: 0.30-1
X-Debbugs-CC: osamu@debian.org
Hi Osamu and debian-input-method team members,
TL;DR: file /etc/X11/Xsession.d/70im-config_launch is *not* called by /bin/sh,
as written in shabang; it is called by user's shell interpreter
instead, which may
result in unexpected outcome when user's default shell is neither
/bin/dash nor /bin/bash.
How to confirm that 70im-config_launch is not using "/bin/sh"
================================================
1. Add a single line at l13:
logger "im-config: WARNING: Currently the shell is ${SHELL}..."
2. Reboot, login and examine syslog. ${SHELL} is replaced by user
shell interpreter. If the user is using zsh, it will show "/usr/bin/zsh", which
is highly undesired.
Zsh-incompatible shell grammar in im-config shell snippet
==============================================
In file /usr/share/im-config/data/21_ibus.rc:
GTK_IM_MODULE=xim
# use immodule only when available for both GTK 2.0 and 3.0
IM_CONFIG_MARKER2=0
for IM_CONFIG_MARKER in /usr/lib/*/gtk-2.0/*/immodules/im-ibus.so \
/usr/lib/gtk-2.0/*/immodules/im-ibus.so ; do
if [ -e $IM_CONFIG_MARKER ]; then
IM_CONFIG_MARKER2=1
break
fi
done
Zsh does not accept the for statement, since on current unstable system
/usr/lib/gtk-2.0/*/immodules/im-ibus.so matches nothing. Zsh would fail here
while Bash and dash ignore the unmatched string.
Solution
=======
While the zsh-incompatible grammar can be fixed (perhaps with a thorough
examination of all im-config source code), the problem that
Xsession.d scripts are executed by user shell interpreter is a big problem
and should receive further examination.
--
Regards,
Boyuan Yang
Reply to: