bug-coreutils
[Top][All Lists]
Advanced

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

Re: Bug#369822: ls -i stats unnecessarily


From: James Youngman
Subject: Re: Bug#369822: ls -i stats unnecessarily
Date: Fri, 2 Jun 2006 00:12:25 +0100

On 6/1/06, Jim Meyering <address@hidden> wrote:

> The latter is harder because for some files (mount points in a chroot
> with a buggy glibc) d_ino is nonzero and wrong.  In those cases, you have
> to use lstat to get the true value.  The invalid d_ino problem came up
> recently with the report of pwd failing on systems with a losing (and
> slightly old) glibc.
>
> If someone else does all the work to make ensure the optimization
> is safe, I'd accept a patch.

After writing that, I remembered that this optimization
has already been done on the trunk.  However, there's no check
for the glibc problem:
[...]
The problem is rare enough that I won't be losing any
sleep over it.  But it would be good to fix it, or at least
add a test case comparing st_ino vs. d_ino for every readable
directory from "." up to "/".  Then (from test failure reports)
we can hope to get an idea of how often the problem arises.

You could stat "/" at startup, and if its inode number is 2 (hint that
we're probably not chrooted), trust d_ino, and don't trust it if d_ino
is not 2 (we're probably chrooted).   The check is only probabilistic,
but it might help.  It shouldn't be fooled by fsirand.

James.




reply via email to

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