gnome-session fails when "alias ls='ls --color'" in .profile

Bug #48876 reported by spliffster
82
Affects Status Importance Assigned to Milestone
gdm (Ubuntu)
Fix Released
Medium
Ubuntu Desktop Bugs
Nominated for Hardy by Mark Painter
Dapper
Won't Fix
Medium
Ubuntu Desktop Bugs
gnome-session (Ubuntu)
Invalid
Undecided
Ubuntu Desktop Bugs
Nominated for Hardy by Mark Painter

Bug Description

Binary package hint: gnome-session

the summary says it all.

my .profile file looks like this:
--
#alias ls="ls --color"
alias r="ssh -X 10.0.0.32";
alias rr="ssh -X 10.0.0.32 sudo";

export PATH=.:/home/spliffy/bin:/home/spliffy/bin/bpmdj-2.9:$PATH
--

my default shell is bash. when i uncomment the first line in my .profile file then after entering user/pw in gdm, launching the gnome-session will fail with no meaningfull error message.

the .xsession-errors looks like this
--
spliffy@bpmdj:~$ cat .xsession-errors
/etc/gdm/PreSession/Default: Registering your session with wtmp and utmp
/etc/gdm/PreSession/Default: running: /usr/bin/sessreg -a -w /var/log/wtmp -u /var/run/utmp -x "/var/lib/gdm/:0.Xservers" -h "" -l ":0" "spliffy"
/etc/gdm/Xsession: Beginning session setup...
 ... and here a message that gnome-term (or xterm) will be loaded ...
--

Revision history for this message
spliffster (spliffster) wrote : reproducable

this is reproducable on 3 x86 pcs running dapper drake. This problem didn't exist with the previous release.

Revision history for this message
Edward Cho (조광일) (zerokarmaleft) wrote :
Changed in gnome-session:
importance: Untriaged → Medium
status: Unconfirmed → Confirmed
Revision history for this message
Sebastien Bacher (seb128) wrote :

A .profile with:

"#alias ls="ls --color"
alias r="ssh -X 10.0.0.32";
alias rr="ssh -X 10.0.0.32 sudo";"

on my box works just fine. Does anybody else get that issue?

Changed in gnome-session:
assignee: nobody → desktop-bugs
status: Confirmed → Unconfirmed
Revision history for this message
Edward Cho (조광일) (zerokarmaleft) wrote :

uncommenting the ls alias causes the errant behavior for me, and was the only line in my profile when I encountered this. commenting it out also fixes the symptoms.

Revision history for this message
Matthew Wang (dotwayman) wrote :

I encountered this problem in 6.06 today. If you have set 'ls' as an alias with argument '--color' in /etc/profile or $HOME/profile, it will be triggered.

The root cause is that, the script /etc/gdm/Xsession will source /etc/profile and $HOME/.profile, then it use "ls $1" to read /etc/X11/Xsession.d, the ANSI color control characters in its output will cause the problem.

Here's the fix: modify /etc/gdm/Xsession, change line 82
    for F in $(ls $1); do
to
   for F in $(/bin/ls $1); do

Revision history for this message
Daniel Holbach (dholbach) wrote :

Can everybody check that this resolves the issue? Reassigning to gdm, as it's gdm's ./debian/Xsession that probably needs changing.

Changed in gnome-session:
status: Unconfirmed → Needs Info
Revision history for this message
spliffster (spliffster) wrote : patch

i can confirm the solution mentioned in comment "From: Matthew Wang at 2006-08-05 14:55:35 CEST".

here is a `diff -Nru`patch:

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for your work on that. Do you pick a particular session to get the issue? Does "ls --color /etc/X11/Xsession.d" uses some color on your installation? I'm trying to figure why it's not happening everywhere and why it's breaking the login before applying the patch

Revision history for this message
Matthew Wang (dotwayman) wrote : Re: [Bug 48876] Re: gnome-session fails when "alias ls='ls --color'" in .profile

Sebastien,

My system is built up by the ubuntu 6.06 Live CD (double click install icon
on the desktop), I added the alias to /etc/profile just after first boot.
And I reproduced it easily in another fresh system also. So I think I was
not picking particular session.

"ls --color /etc/X11/Xsession.d" only shows texts with normal color, but
the output is filled with some ansi control chars (use cat -v to prove):

igo: ~ $ /bin/ls --color /etc/X11/Xsession.d | cat -v
^[[0m^[[0m20xorg-common_process-args^[[0m
^[[0m30xorg-common_xresources^[[0m
^[[0m50xorg-common_determine-startup^[[0m
^[[0m55gnome-session_gnomerc^[[0m
^[[0m75dbus_dbus-launch^[[0m
^[[0m90xorg-common_ssh-agent^[[0m
^[[0m99xorg-common_start^[[0m
^[[m

igo: ~ $ md5sum /bin/ls
cf3669f0230ba30c2ddede093bdaa031 /bin/ls

On 8/10/06, Sebastien Bacher <email address hidden> wrote:
>
> Thanks for your work on that. Do you pick a particular session to get
> the issue? Does "ls --color /etc/X11/Xsession.d" uses some color on your
> installation? I'm trying to figure why it's not happening everywhere and
> why it's breaking the login before applying the patch
>
> --
> gnome-session fails when "alias ls='ls --color'" in .profile
> https://launchpad.net/bugs/48876
>

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for tracking that issue, I'll fix that to dapper-updates and edgy next week

Changed in gdm:
status: Needs Info → Fix Committed
assignee: nobody → desktop-bugs
importance: Untriaged → Medium
status: Unconfirmed → Confirmed
Revision history for this message
spliffster (spliffster) wrote :

sebastien, matthew,

thanks alot for investigating/incoporating! i have not been able to locate the bogous usage of `ls` instead of `/bin/ls` myself.

Cheers,
Simon

Revision history for this message
Sebastien Bacher (seb128) wrote :

Fixed to edgy with this upload:

 gdm (2.15.9-0ubuntu2) edgy; urgency=low
 .
   * debian/Xsession:
     - specify "ls" path, fix gnome-session not starting due to some parsing
       issues for people using an ls="ls --color" alias to their profile,
       thanks to Matthew Wang from tracking it and
       suggesting the change (Ubuntu: #48876)

Changed in gdm:
status: Fix Committed → Fix Released
Revision history for this message
Jonathan Lim (snowblink) wrote :

Is this going to be fixed for Dapper?

Revision history for this message
Daniel Holbach (dholbach) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

not a gnome-session bug

Changed in gnome-session:
assignee: nobody → desktop-bugs
status: Unconfirmed → Rejected
Revision history for this message
wilk (j-cubizolles) wrote :

This bug has reappeared on my Hardy machine. I need to comment out
alias ls='ls --color'
in ~/.bashrc in order to run start a gnome-session in gdm

Revision history for this message
Cezary Baginski (cezary0) wrote :

Confirmed on Hardy.

bug present in /etc/gdm/Xsession, installed from package gdm-2.20.7.

Reason: $(ls $1) is used, which adds ansi color escape sequences

Fix1: change "ls" to "/bin/ls" to ignore the bash/sh alias (in /etc/gdm/Xsession)

Fix2: use run-parts with --list instead of defining a run_patch function (/etc/gdm/Xsession)

Fix3: this a problem in gdm packages, maintained at gnome.org. The bug is probably gone since debian specific folder in gdm has been removed (gdm-2.22). So we will have to wait until gdm-2.22 or higher becomes available in Ubuntu, or ... until someone backports its to gdm-2.20 (which is IMHO unlikely).

Patch attached anyway for anyone interested in a quick fix.

Rolf Leggewie (r0lf)
Changed in gdm (Ubuntu Dapper):
status: Confirmed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.