bug-coreutils
[Top][All Lists]
Advanced

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

bug with ls: unnecessary stat calls on symlink targets


From: Jeremy Maitin-Shepard
Subject: bug with ls: unnecessary stat calls on symlink targets
Date: Fri, 01 Jun 2007 17:37:17 -0400
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.990 (gnu/linux)

Currently, if there is a color for LINK, and EXEC, but not for ORPHAN or
MISSING, ls still stats the target of every symlink, but never uses the
information.  It does this as a result of the following commit:

http://cvs.savannah.gnu.org/viewvc/coreutils/src/ls.c?root=coreutils&r1=1.369&r2=1.370

In particular, there is a check for EXEC being colored.  I don't
understand why this is done.  A symlink to an executable file is still
colored using the LINK color, rather than the EXEC color; the results of
the stat do not affect the color used.

Possibly the commit was made under the assumption that symlinks to
executable files are colored using the exec style, but that does not
seem to be the current behavior, nor is it the behavior I desire.  I
would like executable files to still be colored using the EXEC color,
but I want to avoid all stat calls on symlink targets (and as a result
all symlinks should be colored using the LINK style).  (The reason I
want to avoid stat calls on symlink targets is that I have symlinks to
automounted paths, and I do not want things automounted every time I
list certain directories.)

It may be possible that in certain cases the is_colored (C_EXEC) check
is useful (I didn't look carefully enough at the code to see), in which
case a more sophisticated check should be used or it may be the case
that it is never useful and that check should be removed.  I have fixed
the problem for myself by simply removing the is_colored (C_EXEC) check.

-- 
Jeremy Maitin-Shepard




reply via email to

[Prev in Thread] Current Thread [Next in Thread]