bug-coreutils
[Top][All Lists]
Advanced

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

Re: 'make check' fails


From: Jim Meyering
Subject: Re: 'make check' fails
Date: Sat, 05 Dec 2009 17:43:43 +0100

Pádraig Brady wrote:
> Sergei Steshenko wrote:
>> --- On Sat, 12/5/09, Jim Meyering <address@hidden> wrote:
>>> The "?" makes me think /file_exchange is a dangling
>>> symlink.
>>> If that's the case, selecting only directories may be
>>> enough:
>>>
>>> diff --git a/tests/ls/readdir-mountpoint-inode
>>> b/tests/ls/readdir-mountpoint-inode
>>> index c021473..de563d7 100755
>>> --- a/tests/ls/readdir-mountpoint-inode
>>> +++ b/tests/ls/readdir-mountpoint-inode
>>> @@ -65,6 +65,8 @@ inode_via_readdir()
>>>  for dir in $mount_points; do
>>>    readdir_inode=$(inode_via_readdir $dir)
>>>    stat_inode=$(env stat --format=%i $dir)
>>> +  # skip non-directories (i.e., dangling symlinks)
>>> +  test -d $dir || continue
>
> Note the symlinks are not dereferenced by ls or stat below anyway.
> Also I quickly tried to mount on a symlink but it was
> canonicalized at some stage.
>
>>> If that doesn't do it, then we can skip $dir when
>>> stat_inode is 0.
>
> That would work but as Sergei confirms below, the stat
> is succeeding and returning 0 for st_ino.
> Perhaps we should change ls to also print the 0 if the stat succeeds?

Do you think that'd be worthwhile?
I wouldn't want to update the documentation to explain under
which conditions you might see a "0" rather than "?" ;-)

> That means we can distinguish between a failure (?) and the OS
> returning 0 as a "valid" number.
> Also, even if we do that, in the test we would need to skip the case
> where `stat` returns nothing on error.

As suggested, this should do the trick:

>From 9a53d84a7f29a62026d6b57ec9fb24560de11295 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 5 Dec 2009 17:41:28 +0100
Subject: [PATCH] tests: readdir-mountpoint-inode avoid false-positive 
w/virtualbox

* tests/ls/readdir-mountpoint-inode: With some systems, stat can
succeed on a mount point and report that the inode number is 0.
Since ls displays "?" for those, that would otherwise show up as a
difference.  Skip such mount points.  Reported by Sergei Steshenko
in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/19142
---
 tests/ls/readdir-mountpoint-inode |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tests/ls/readdir-mountpoint-inode 
b/tests/ls/readdir-mountpoint-inode
index c021473..979b579 100755
--- a/tests/ls/readdir-mountpoint-inode
+++ b/tests/ls/readdir-mountpoint-inode
@@ -65,6 +65,8 @@ inode_via_readdir()
 for dir in $mount_points; do
   readdir_inode=$(inode_via_readdir $dir)
   stat_inode=$(env stat --format=%i $dir)
+  # If stat fails or says the inode is 0, skip $dir.
+  case $stat_inode in 0|'') continue;; esac
   test "$readdir_inode" = "$stat_inode" || fail=1
 done

--
1.6.6.rc1.280.ge45b




reply via email to

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