Bug#302685: An explanation
The problem turned out to be a mixture of two
causes:
1) A bug in my .bash_profile, and
2) a vulnerability in X (a design flaw).
In my .bash_profile, I had lines in the form of
set line_oriented_history=on
These lines should have been in my .inputrc, instead.
When placed in .bash_profile, they changed the shell's
positional parameters.
Now, the X scripts like /etc/X11/Xsession and /etc/kde3/kdm/Xsession
have a serious design flaw. They pass important information
around in the positional parameters through the point where
my .bash_profile is sourced.
So, X sets $1 and runs /etc/kde3/kdm/Xsession.
/etc/kde3/kdm/Xsession sources $HOME/.bash_profile (around line 10).
X uses $1 (/etc/X11/Xsession sources
/etc/X11/Xsession.d/20x11-common_process-args
which uses $1)
There is probably no legitimate reason for a .bash_profile
to change $1 (though human ingenuity is always surprising),
so I consider this a bug in the Xsession scripts.
Reply to: