Andrew Stribblehill: ls color considered harmful
This is a rant I have made many times in person: far too many to count. Since I can't possibly warn everybody who might be affected by this, face to face, I'm hoping you will all spread the word.
The problem
To begin with, I should say that
ls --color is useful. It can show you which items in your directory listing are directories, symlinks, broken symlinks, device nodes, named pipes, whatever. I am glad that it exists.
However, let’s consider the basic action of ls. It is, of course, to display which files and directories exist in a directory. This is really quick and easy in Unix. Simply use the libc function opendir() then just readdir() till it returns NULL and errno is 0. In terms of syscalls, this is an open(), one or two read()s and a close().
When you turn on the color option, every directory item incurs the weight of an extra stat() call to see what it is.
Worse still, if it’s a symlink, ls will obligingly bound across to the thing linked to, to check it exists. If this causes your automounter to wake up and mount something remote, that’s quite an overhead. If your mount hangs because the remote filesystem is unavailable, you can say goodbye to that process; it'll be stuck blocking on a syscall that will never return.
A partial solution
To fix the symlink problem, here’s what you do. ls was written to avoid chasing symlinks if configured not to. Check your environment variables for the LS_COLORS variable with:
$ env grep ^LS_COLORS
If it exists, you have a config file for colour ls: you should edit /etc/DIR_COLORS* or copy it to $HOME/.dircolors and edit it there. Otherwise, type:
$ dircolors --print-database > $HOME/.dircolors
The edit you need to do is to remove or comment out the ORPHAN line from the file.
Unless you were able to edit the file in /etc, you now need to make sure that this new $HOME/.dircolors file is used. In your shell login script (.bash_login for bash and .login for (t)csh, put the line:
eval dircolors $HOME/.dircolors
(Note that these are backticks, not apostrophes.)
Next time you log in, you'll be able to use colourful ls without fear of a remote filesystem freezing your directory listings.
In conclusion
Use ls --color when you need it, but as with all powerful tools, use it with care.
Corrections: James pointed out that to dump the default config it is –print-database not –print-directory.
Here s an important lesson I learnt today: if you are in
Thailand and still feel the effects of
I finally did it.
Most of my small and personal projects (
I recently had my first podcast experience, when I was approached by
Mario Heide of the German podcast
For those unfamiliar with the project, etch-and-a-half has the goal of
making the existing etch release work on more hardware, but with minimal
risk to existing etch users.
This will be done by *adding* new kernel packages to the existing release.
Kernel selection isn't final yet - the kernel team would like to use 2.6.24
if it proves itself stable in time; 2.6.22 is the backup choice.
etch-and-a-half isn't restricted to kernel updates by-definition; new
X drivers, or proven-safe X driver updates are reasonable candidates as
well (though at this point, no changes have been proposed).
An oft-asked question is around updating desktop packages, e.g. new versions
of GNOME/KDE. This is beyond the scope of etch-and-a-half because it
introduces a great deal more change than just additional hardware support,
its wouldn't be a transparent upgrade to existing etch users, and we cannot
say with a high level of confidence that it wouldn't introduce regressions
for existing users.
That said - a localized change to a package that adds support for new hardware
and clearly doesn't break existing hardware is a valid candidate for any stable
release. Such requests should be submitted to the SRM team like any other
stable update request.
The current plan for etch and a half is to release as part of a point release.
4.0r4 is the planned point release, since 4.0r3 is planned to have a quick
turnaround to fix issues with 4.0r2. This means that pre-release bits will
be made available via proposed-updates - testers are greatly appreciated.
There is no plan to add support for etch-and-a-half to the etch branch of d-i.
Rather, support will likely be added in a beta of the lenny installer.
A wiki page exists
I've got an upload of gpe-tetris pending - see 
This week has mostly involved me getting my live
samba.grep.be.
This machine has been my trusty publically-accessible server for
about four years now. It runs my website, including this blog, is my
primary MX, contains my subversion repositories, and my gallery. For
slightly less than the first year of 
…so that you will eventually know the indescribable joy of finding all of them sound asleep at a reasonably early point in the evening.
I
We have a problem with our tools in Debian, and it's this:
Above the core tools in