bug-coreutils
[Top][All Lists]
Advanced

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

Re: coreutils-6.1: needs 'ls' patch (bug #15043)


From: mwoehlke
Subject: Re: coreutils-6.1: needs 'ls' patch (bug #15043)
Date: Tue, 05 Sep 2006 09:59:00 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.5) Gecko/20060719 Thunderbird/1.5.0.5 Mnenhy/0.7.4.0

Eric Blake wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to mwoehlke on 8/31/2006 10:18 AM:
Look more closely at the code.  The reason linux was failing was because
it was not doing enough work, because the d_type shortcut let it skip a
stat where one was needed.  Platforms that did not have the bug are not
doing extra work, because they have already done the stat (not having a
d_type shortcut to rely on).  So #ifdef'ing on linux is not the right
approach, and Jim's patch was appropriate.
Ok, so if I am understanding correctly, you are saying that on
not-Linux, one of the other conditions in the 'if' will always cause the
block to be evaluated?

The bug in coloring directories according to their mode bits is that you
need to know the mode bits.  The only way to get mode bits is to call
[l]stat.  On newer Linux, and any other OS that provides d_type in
readdir, the bug was that we were not calling stat because "readdir's
d_type tells us it is a directory, we know what to color it".  On other
platforms, like cygwin, that do not provide d_type, we had already called
stat to figure out whether the file is a directory, so we already had the
mode bits.  The bug, then, was that Linux exposed a flaw in our
optimization logic, but the same flaw is present on any other system with
d_type - namely, if we know that a readdir entry is a directory, we STILL
need a stat when coloring directories according to mode bits.  Ultimately,
the correct behavior is that for ALL platforms, coloring directories
requires a stat at some point or another, and it was not a Linux-specific
bug (it just so happened that Linux was the only platform you tested that
had d_type and thus showed the bug).  Conditionalizing your fix on
__linux__ would have been wrong, had some other platform come up to speed
and implemented a reliable d_type.

Right, thanks for the explanation!

--
Matthew
73% of all statistics are made up on the spot.





reply via email to

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