Package: x11-common Version: 1:7.5+6ubuntu3 Severity: wishlist Tags: patch When I upgraded to KDE 4.6.0 recently, some weird bug in kdm (I guess, haven't had the time to research further) started Xsession with an empty first argument. This resulted in the message 'Xsession: unable to launch "" X session --- "" not found; falling back to default session.' My suggestion is to interpret an empty first argument (which will of course never work as a session manager) the same as no arguments and just silently fall back to the default session. The rationale is that the user who is confronted with such a behaviour can't really do anything about it.
The original bug was reported on launchpad at <https://launchpad.net/bugs/710144> but I forwarded it here since this is an unmodified file from Debian. I'll attach two patches against 20x11-common_process-args; the first is a non- intrusive solution and the second refactors away the outer case since it is actually not needed. -- System Information: Debian Release: squeeze/sid APT prefers maverick-updates APT policy: (500, 'maverick-updates'), (500, 'maverick-security'), (500, 'maverick-backports'), (500, 'maverick') Architecture: amd64 (x86_64) Kernel: Linux 2.6.35-25-generic (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages x11-common depends on: ii debconf [debconf-2.0] 1.5.32ubuntu3 Debian configuration management sy ii debianutils 3.2.3 Miscellaneous utilities specific t ii lsb-base 4.0-0ubuntu8 Linux Standard Base 4.0 init scrip ii upstart [upstart-job] 0.6.6-4 event-based init daemon x11-common recommends no packages. x11-common suggests no packages. -- debconf information: x11-common/xwrapper/allowed_users: Console Users Only x11-common/xwrapper/actual_allowed_users: console
--- 20x11-common_process-args.orig 2011-02-08 16:31:30.000000000 +0100 +++ 20x11-common_process-args 2011-02-09 22:35:10.000000000 +0100 @@ -40,7 +40,7 @@ fi fi ;; - default) + default|"") # Default behavior was requested. ;; *)
--- 20x11-common_process-args.orig 2011-02-08 16:31:30.000000000 +0100 +++ 20x11-common_process-args 2011-02-09 23:03:52.000000000 +0100 @@ -14,56 +14,52 @@ fi } -# Determine how many arguments were provided. -case $# in - 0) - # No arguments given; use default behavior. +# the first (optional and only) parameter is the session name/executable +SESSION=${1:-default} +if [ $# -gt 1 ]; then + # more than one argument given; we don't know what to do. + message "unsupported number of arguments ($#);" \ + "falling back to default session." + SESSION=default +fi + +# see if we can handle the requested session. +case "$SESSION" in + default) + # default behavior was requested. ;; - 1) - # One argument given; see what it was. - case "$1" in - failsafe) - # Failsafe session was requested. - if has_option allow-failsafe; then - if [ -e /usr/bin/x-terminal-emulator ]; then - if [ -x /usr/bin/x-terminal-emulator ]; then - exec x-terminal-emulator -geometry +1+1 - else - # fatal error - errormsg "unable to launch failsafe X session ---" \ - "x-terminal-emulator not executable; aborting." - fi - else - # fatal error - errormsg "unable to launch failsafe X session ---" \ - "x-terminal-emulator not found; aborting." - fi - fi - ;; - default) - # Default behavior was requested. - ;; - *) - # Specific program was requested. - STARTUP_FULL_PATH=$(/usr/bin/which "$1" || true) - if [ -n "$STARTUP_FULL_PATH" ] && [ -e "$STARTUP_FULL_PATH" ]; then - if [ -x "$STARTUP_FULL_PATH" ]; then - STARTUP="$1" - else - message "unable to launch \"$1\" X session ---" \ - "\"$1\" not executable; falling back to default session." - fi + failsafe) + # failsafe session was requested. + if has_option allow-failsafe; then + if [ -e /usr/bin/x-terminal-emulator ]; then + if [ -x /usr/bin/x-terminal-emulator ]; then + exec x-terminal-emulator -geometry +1+1 else - message "unable to launch \"$1\" X session ---" \ - "\"$1\" not found; falling back to default session." + # fatal error + errormsg "unable to launch failsafe X session ---" \ + "x-terminal-emulator not executable; aborting." fi - ;; - esac + else + # fatal error + errormsg "unable to launch failsafe X session ---" \ + "x-terminal-emulator not found; aborting." + fi + fi ;; *) - # More than one argument given; we don't know what to do. - message "unsupported number of arguments ($#); falling back to default" \ - "session." + # specific program was requested. + STARTUP_FULL_PATH=$(/usr/bin/which "$SESSION" || true) + if [ -n "$STARTUP_FULL_PATH" ] && [ -e "$STARTUP_FULL_PATH" ]; then + if [ -x "$STARTUP_FULL_PATH" ]; then + STARTUP="$SESSION" + else + message "unable to launch \"$SESSION\" X session ---" \ + "\"$SESSION\" not executable; falling back to default session." + fi + else + message "unable to launch \"$SESSION\" X session ---" \ + "\"$SESSION\" not found; falling back to default session." + fi ;; esac