coreutils
[Top][All Lists]
Advanced

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

[PATCH] tests: stat-free-color: accommodate stat of /selinux on rawhide


From: Jim Meyering
Subject: [PATCH] tests: stat-free-color: accommodate stat of /selinux on rawhide
Date: Wed, 01 Jun 2011 16:14:16 +0200

This test started to fail on rawhide, due to some new start-up
code that is run when selinux is enabled.  That code includes
a stat of /selinux:

  statfs("/sys/fs/selinux", 0x7fffbb8f1de0) = -1 ENOENT (No such file or 
directory)
  statfs("/selinux", {f_type=0xf97cff8c, f_bsize=4096, f_blocks=0, f_bfree=0, 
f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) 
= 0
  statfs("/selinux", {f_type=0xf97cff8c, f_bsize=4096, f_blocks=0, f_bfree=0, 
f_bavail=0, f_files=0, f_ffree=0, f_fsid={0, 0}, f_namelen=255, f_frsize=4096}) 
= 0
  stat("/selinux", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0

Here's the fix:

>From ccf2d9a482d19c949befde807184b0f5bbf72397 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Wed, 1 Jun 2011 16:08:21 +0200
Subject: [PATCH] tests: stat-free-color: accommodate stat of /selinux on
 rawhide

* tests/ls/stat-free-color: This test recently began to fail on
rawhide because dynamic library start-up code now stats "/selinux",
making the total number of calls 2 rather than the prior 1.
Create two more dangling symlinks, so that any erroneous stat-
or lstat-calling code will get at least those three.
---
 tests/ls/stat-free-color |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tests/ls/stat-free-color b/tests/ls/stat-free-color
index 06e621e..b1c4744 100755
--- a/tests/ls/stat-free-color
+++ b/tests/ls/stat-free-color
@@ -21,7 +21,9 @@ print_ver_ ls
 require_strace_ stat
 require_dirent_d_type_

-ln -s nowhere dangle || framework_failure_
+for i in 1 2 3; do
+  ln -s nowhere dangle-$i || framework_failure_
+done

 # Disable enough features via LS_COLORS so that ls --color
 # can do its job without calling stat (other than the obligatory
@@ -49,6 +51,11 @@ eval $(dircolors -b color-without-stat)

 strace -o log -e stat,lstat,stat64,lstat64 ls --color=always . || fail=1
 n_lines=$(wc -l < log)
-test $n_lines = 1 || fail=1
+
+# Expect one or two stat calls.
+case $n_lines in
+  1|2) ;;
+  *) fail=1 ;;
+esac

 Exit $fail
--
1.7.5.3.716.g40fa6



reply via email to

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