Subject: bug#21130: closed (Re: bug#21130: test fail: 'tests/ls/stat-failed')

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 21 Nov 2015 11:07:02 +0000

Your bug report

#21130: test fail: 'tests/ls/stat-failed'

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
21130: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21130
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#21130: test fail: 'tests/ls/stat-failed'
From: Pádraig Brady <[email-masked]>
To: [email-masked]
Date: Sat, 21 Nov 2015 11:05:29 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

On 24/07/15 22:46, Assaf Gordon wrote:
> Hello,
> 
> checking coreutils 8.24, running on NFS, the test 'ls/stat-failed' fails (log attached).
> 
> If I understand correctly,
> The test creates a symlink to a directory then removes execute permissions:
>     mkdir d
>     ln -s / d/s
>     chmod 600 d
> 
> Then tries to dereference it:
>      $ ls -Log d
>      ls: cannot access d/s: Permission denied
>      total 0
>      d????????? ? ?            ? s
> 
> The test expect 's' to have 'l' type, on my system it is 'd'.
> 
> The attached patch avoids the failure, though I don't know if this is correct or not (perhaps this failure should not be avoided?).
> 
> The system is:
>      $ uname -a
>      Linux XXX 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
>      $ gcc --version
>       gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)
> 
> The file system is NFS.

False failure documented and avoided in the attached.

thanks,
Pádraig.

>From 56d3269207db13b0f3a594d6d2cbc52913929d21 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email-masked]>
Date: Sat, 21 Nov 2015 10:59:37 +0000
Subject: [PATCH] tests: avoid false failure on older NFS implementations

* tests/ls/stat-failed.sh: Skip the test if 'd' is returned as the type,
and document where this was seen.  Also flag failure to write small
temp files during the test as an error rather than a failure.
Fixes http://bugs.gnu.org/21130
---
 tests/ls/stat-failed.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/ls/stat-failed.sh b/tests/ls/stat-failed.sh
index 002b71c..32e8304 100755
--- a/tests/ls/stat-failed.sh
+++ b/tests/ls/stat-failed.sh
@@ -31,7 +31,11 @@ chmod 600 d || framework_failure_
 ls -Log d > out
 test $? = 1 || fail=1
 
-cat <<\EOF > exp || fail=1
+# Linux 2.6.32 client with Isilon OneFS always returns d_type==DT_DIR ('d')
+# Newer Linux 3.10.0 returns the more correct DT_UNKNOWN ('?')
+grep '^[l?]?' out || skip_ 'unrecognized d_type returned'
+
+cat <<\EOF > exp || framework_failure_
 total 0
 ?????????? ? ?            ? s
 EOF
@@ -42,7 +46,7 @@ sed 's/^l/?/' out | compare exp - || fail=1
 rm -f out exp
 returns_ $LS_MINOR_PROBLEM ls --dired -l d > out || fail=1
 
-cat <<\EOF > exp || fail=1
+cat <<\EOF > exp || framework_failure_
   total 0
   ?????????? ? ? ? ?            ? s
 //DIRED// 44 45
-- 
2.5.0

Subject: test fail: 'tests/ls/stat-failed'
From: Assaf Gordon <[email-masked]>
To: [email-masked]
Date: Fri, 24 Jul 2015 17:46:36 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

checking coreutils 8.24, running on NFS, the test 'ls/stat-failed' fails (log attached).

If I understand correctly,
The test creates a symlink to a directory then removes execute permissions:
    mkdir d
    ln -s / d/s
    chmod 600 d

Then tries to dereference it:
     $ ls -Log d
     ls: cannot access d/s: Permission denied
     total 0
     d????????? ? ?            ? s

The test expect 's' to have 'l' type, on my system it is 'd'.

The attached patch avoids the failure, though I don't know if this is correct or not (perhaps this failure should not be avoided?).

The system is:
     $ uname -a
     Linux XXX 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
     $ gcc --version
      gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4)

The file system is NFS.

regards,
  - assaf
>From 213564fc8c82cd5c48a1572b1a35e1780a4f245a Mon Sep 17 00:00:00 2001
From: Assaf Gordon <[email-masked]>
Date: Fri, 24 Jul 2015 17:27:04 -0400
Subject: [PATCH] tests: avoid test failure for ls/stat-failed.sh

* tests/ls/stat-failed.sh: accept 'l' or 'd' as indication for a symlink
  for a directory inside a directory with no access on NFS.
---
 tests/ls/stat-failed.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/ls/stat-failed.sh b/tests/ls/stat-failed.sh
index 002b71c..f177ed17 100755
--- a/tests/ls/stat-failed.sh
+++ b/tests/ls/stat-failed.sh
@@ -36,7 +36,7 @@ total 0
 ?????????? ? ?            ? s
 EOF
 
-sed 's/^l/?/' out | compare exp - || fail=1
+sed 's/^[ld]/?/' out | compare exp - || fail=1
 
 # Ensure that the offsets in --dired output are accurate.
 rm -f out exp
@@ -49,6 +49,6 @@ cat <<\EOF > exp || fail=1
 //DIRED-OPTIONS// --quoting-style=literal
 EOF
 
-sed 's/^  l/  ?/' out | compare exp - || fail=1
+sed 's/^  [ld]/  ?/' out | compare exp - || fail=1
 
 Exit $fail
-- 
1.9.1