[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#283764: X clients will not start. Fix found.



retitle 283764 xfree86-common: Xsession can barf if user has aliased ls to force colors on
thanks

On Tue, Nov 30, 2004 at 11:14:40PM -0800, David Lawyer wrote:
> Package: xfree86-common
> Version: 4.3.0.dfsg.1.-1

Version *what*?

> When I type "startx" at the console, x starts and quits.  But if I type
> "startx" at a dumb terminal on a serial port, x starts OK and goes to
> the icewm (ice window manager which I have installed).  So why can I
> start X from a dumb terminal but not from the console? 
> 
> It took me some time to determine why.  The error is in the file
> /etc/X11/Xsession.  The run_parts() function has
> 	for F in $(ls $1); do
> it should be:
> 	for F in $(command ls $1); do
> 
> This is because I have in my /etc/profile:
> 
> if [ $TERM = linux -o $TERM = xterm ]; then
>     if [ $TERM = linux ]; then
>        eval `dircolors`;
>        ls () { command ls --color $* ; }
>     fi
> else     
>     ls () { command ls -F $* ; }
>     .....
> 
> So when I use a dumb terminal and $TERM = my-dumb-terminal (or whatever)
> then ls() is defined differently.  But at the console, ls() is made
> to support colors and the run_parts() can't seem to cope with the
> control codes which are embedded in the file names to create colors.
> One word "command" fixes it.
> 
> What was frustrating was that there were no error messages.

Ah.  Thanks for the analysis.  This report brings to mind two rules, one of
which you should probably learn, and the other of which I should have
remembered:

1) Don't override the names of Unix commands, even in your interactive
   shell environment.  It promotes bad habits.
2) Never use "ls" when "echo" will suffice.

Thanks again.

-- 
G. Branden Robinson                |      "I came, I saw, she conquered."
Debian GNU/Linux                   |      The original Latin seems to have
branden@debian.org                 |      been garbled.
http://people.debian.org/~branden/ |      -- Robert Heinlein

Attachment: signature.asc
Description: Digital signature


Reply to: