Bug#272921: 55gnome-session_gnomerc doesn't work when gnome-session is run with arguments

Andrei Badea Andrei Badea <andrei.badea@movzx.net>, 272921@bugs.debian.org
Wed, 22 Sep 2004 22:12:32 +0200


Package: gnome-session
Version: 2.6.2-5

The /etc/X11/Xsession.d/55gnome-session_gnomerc script doesn't work correctly 
when gnome-session is run with arguments (such as in "gnome-session 
--purge-delay 3000").

Running gnome-session with arguments causes this error message:

/etc/X11/Xsession.d/55gnome-session_gnomerc: line 3: [: too many arguments

To reproduce (using GDM):

1) change /usr/share/xsessions/gnome.desktop to run gnome-session with at least 
one argument
2) login into a Gnome session
3) the error message can be found in ~/.xsession-errors. Also the ~/.gnomerc 
file (if it exists) is not executed

This happens because the code in 55gnome-session_gnomerc that gets the file name 
from the STARTUP variable doesn't account for possible arguments in STARTUP.

A simple (and not perfect) way to solve this is to delete all characters after 
the first space (including). I'm attaching a patch:

--- 55gnome-session_gnomerc     2004-04-22 11:19:28.000000000 +0200
+++ 55gnome-session_gnomerc.new 2004-09-22 21:51:40.000000000 +0200
@@ -1,7 +1,7 @@
  # If we are running the GNOME session, source ~/.gnomerc

-if [ `basename "$STARTUP"` = gnome-session -o \
-       \( `basename "$STARTUP"` = x-session-manager -a \
+if [ `basename "${STARTUP/ */}"` = gnome-session -o \
+       \( `basename "${STARTUP/ */}"` = x-session-manager -a \
         `readlink /etc/alternatives/x-session-manager` = \
                 /usr/bin/gnome-session \) ]; then
    GNOMERC=$HOME/.gnomerc

Best regards,
Andrei

-- 
andrei.badea@movzx.net # http://movzx.net # ICQ: 52641547