bug-coreutils
[Top][All Lists]
Advanced

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

Re: test failure in make check-root


From: Jim Meyering
Subject: Re: test failure in make check-root
Date: Fri, 27 Mar 2009 09:42:54 +0100

Jim Meyering wrote:
> Kamil Dudka wrote:
>> On Thursday 26 of March 2009 18:00:47 Jim Meyering wrote:
>>> diff --git a/tests/install/install-C-root b/tests/install/install-C-root
>>> index df2843d..d5cc2de 100755
>>> --- a/tests/install/install-C-root
>>> +++ b/tests/install/install-C-root
>>> @@ -23,6 +23,7 @@ fi
>>>
>>>  . $srcdir/test-lib.sh
>>>  require_root_
>>> +"$abs_srcdir/setgid-check"
>>
>> . "$abs_srcdir/setgid-check"
>
> Thanks!
> I'd missed the leading ".".

Actually, there are too many uses of that script,
and each use requires too much syntax.

I've been migrating those sourced-scripts into functions
defined in tests/test-lib.sh, so I'm doing this instead:

   +skip_if_setgid_


>From e65d0d0525159f963b3b859706dc920bcae0a636 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 27 Mar 2009 09:23:35 +0100
Subject: [PATCH 1/2] tests: migrate setgid-check into test-lib.sh

* tests/test-lib.sh (skip_if_setgid_): New function.
* tests/setgid-check: Remove file.
* tests/Makefile.am (EXTRA_DIST): Remove setgid-check.
* tests/chmod/c-option: Use the new function rather than sourcing
the separate file.
* tests/cp/cp-parents: Likewise.
* tests/install/install-C: Likewise.
* tests/mkdir/parents: Likewise.
* tests/mkdir/perm: Likewise.
---
 tests/Makefile.am       |    1 -
 tests/chmod/c-option    |    2 +-
 tests/cp/cp-parents     |    2 +-
 tests/install/install-C |    2 +-
 tests/mkdir/parents     |    2 +-
 tests/mkdir/perm        |    2 +-
 tests/setgid-check      |   36 ------------------------------------
 tests/test-lib.sh       |   15 +++++++++++++++
 8 files changed, 20 insertions(+), 42 deletions(-)
 delete mode 100644 tests/setgid-check

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5f150ad..6356eaa 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -15,7 +15,6 @@ EXTRA_DIST =          \
   other-fs-tmpdir      \
   require-perl         \
   sample-test          \
-  setgid-check         \
   test-lib.sh          \
   $(pr_data)

diff --git a/tests/chmod/c-option b/tests/chmod/c-option
index eb8530a..7bf9e78 100755
--- a/tests/chmod/c-option
+++ b/tests/chmod/c-option
@@ -28,7 +28,7 @@ file=f
 touch $file || framework_failure
 chmod 444 $file || framework_failure

-. "$abs_srcdir/setgid-check"
+skip_if_setgid_

 fail=0

diff --git a/tests/cp/cp-parents b/tests/cp/cp-parents
index bfaf747..f4130e6 100755
--- a/tests/cp/cp-parents
+++ b/tests/cp/cp-parents
@@ -28,7 +28,7 @@ fi
 working_umask_or_skip_

 # Run the setgid check from the just-created directory.
-. "$abs_srcdir/setgid-check"
+skip_if_setgid_

 mkdir foo bar || framework_failure
 mkdir -p a/b/c d e g || framework_failure
diff --git a/tests/install/install-C b/tests/install/install-C
index 3bf0c7b..9d0ec90 100755
--- a/tests/install/install-C
+++ b/tests/install/install-C
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
 fi

 . $srcdir/test-lib.sh
-. "$abs_srcdir/setgid-check"
+skip_if_setgid_

 mode1=0644
 mode2=0755
diff --git a/tests/mkdir/parents b/tests/mkdir/parents
index 46f5867..3ae35a9 100755
--- a/tests/mkdir/parents
+++ b/tests/mkdir/parents
@@ -22,7 +22,7 @@ if test "$VERBOSE" = yes; then
 fi

 . $srcdir/test-lib.sh
-. "$abs_srcdir/setgid-check"
+skip_if_setgid_

 mkdir -m 700 e-dir || framework_failure

diff --git a/tests/mkdir/perm b/tests/mkdir/perm
index 2f12d07..146a88e 100755
--- a/tests/mkdir/perm
+++ b/tests/mkdir/perm
@@ -23,7 +23,7 @@ if test "$VERBOSE" = yes; then
 fi

 . $srcdir/test-lib.sh
-. "$abs_srcdir/setgid-check"
+skip_if_setgid_

 working_umask_or_skip_

diff --git a/tests/setgid-check b/tests/setgid-check
deleted file mode 100644
index cf26184..0000000
--- a/tests/setgid-check
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- sh -*-
-# Disable the current test if the working directory seems to have
-# the setgid bit set.
-
-# Copyright (C) 2000, 2002, 2004, 2005, 2007, 2009 Free Software Foundation, 
Inc.
-
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# This test should be run in the temporary directory that ends
-# up being removed via the trap commands.
-
-cwd_is_setgid=no
-
-setgid_tmpdir=setgid-$$
-(umask 77; mkdir $setgid_tmpdir)
-perms=$(stat --printf %A $setgid_tmpdir)
-rmdir $setgid_tmpdir
-case $perms in
-  drwx------);;
-  drwxr-xr-x);;  # Windows98 + DJGPP 2.03
-  *) cwd_is_setgid=yes;;
-esac
-if test $cwd_is_setgid = yes; then
-  skip_test_ 'this directory has the setgid bit set'
-fi
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index 45026f1..17a3538 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -262,6 +262,21 @@ mkfifo_or_skip_()
   fi
 }

+# Disable the current test if the working directory seems to have
+# the setgid bit set.
+skip_if_setgid_()
+{
+  setgid_tmpdir=setgid-$$
+  (umask 77; mkdir $setgid_tmpdir)
+  perms=$(stat --printf %A $setgid_tmpdir)
+  rmdir $setgid_tmpdir
+  case $perms in
+    drwx------);;
+    drwxr-xr-x);;  # Windows98 + DJGPP 2.03
+    *) skip_test_ 'this directory has the setgid bit set';;
+  esac
+}
+
 skip_if_mcstransd_is_running_()
 {
   test $# = 0 || framework_failure
--
1.6.2.rc1.285.gc5f54


>From e412e5cb495627202d5697cb8fe042b761e2b7d5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 27 Mar 2009 09:26:03 +0100
Subject: [PATCH 2/2] tests: avoid spurious test failure in set-GID build dir

* tests/install/install-C-root: Skip this test if in set-gid directory.
Reported by Sven Joachim and C de-Avillez.
---
 tests/install/install-C-root |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/tests/install/install-C-root b/tests/install/install-C-root
index df2843d..234ebe7 100755
--- a/tests/install/install-C-root
+++ b/tests/install/install-C-root
@@ -23,6 +23,7 @@ fi

 . $srcdir/test-lib.sh
 require_root_
+skip_if_setgid_

 u1=1
 u2=2
--
1.6.2.rc1.285.gc5f54




reply via email to

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