bug-coreutils
[Top][All Lists]
Advanced

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

Re: two new chroot bugs


From: Giuseppe Scrivano
Subject: Re: two new chroot bugs
Date: Sat, 04 Jul 2009 10:43:05 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.95 (gnu/linux)

Hi Jim,

Jim Meyering <address@hidden> writes:

> From cfe8e7a0001a10d4deceb6065134fe8c402d0368 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <address@hidden>
> Date: Thu, 28 May 2009 22:36:05 +0200
> Subject: [PATCH 1/4] tests: use "nobody" as the default group name in chroot 
> test

the "nobody" group is not present on all systems, for example on Debian
it is "nogroup" so IMHO it is better to find it at runtime using the
"nobody" user's group.

The second patch is just a small refactoring.

Cheers,
Giuseppe


>From a089ec8770afa349f1e0b6e9d090d739f0afe6dd Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <address@hidden>
Date: Sat, 4 Jul 2009 10:14:31 +0200
Subject: [PATCH 1/2] tests: use the "nobody" user's group as the default group 
id test

* tests/chroot/credentials: Use the group id, not its name.
* tests/test-lib.sh (NON_ROOT_GROUP): Use the "nobody" user's group in
place of "nogroup".
---
 tests/chroot/credentials |    2 +-
 tests/test-lib.sh        |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/chroot/credentials b/tests/chroot/credentials
index 58c098f..f200f14 100755
--- a/tests/chroot/credentials
+++ b/tests/chroot/credentials
@@ -37,7 +37,7 @@ test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP 
/ whoami)" != root
     || fail=1
 
 # Verify that there are no additional groups.
-test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP 
--groups=$NON_ROOT_GROUP / id -nG)"\
+test "$(chroot --userspec=$NON_ROOT_USERNAME:$NON_ROOT_GROUP 
--groups=$NON_ROOT_GROUP / id -G)"\
     = $NON_ROOT_GROUP || fail=1
 
 # Verify that when specifying only the user name we get the current
diff --git a/tests/test-lib.sh b/tests/test-lib.sh
index d99e3a9..9797b55 100644
--- a/tests/test-lib.sh
+++ b/tests/test-lib.sh
@@ -209,7 +209,7 @@ require_root_()
 {
   uid_is_privileged_ || skip_test_ "must be run as root"
   NON_ROOT_USERNAME=${NON_ROOT_USERNAME=nobody}
-  NON_ROOT_GROUP=${NON_ROOT_GROUP=nobody}
+  NON_ROOT_GROUP=${NON_ROOT_GROUP=$(id -g $NON_ROOT_USERNAME)}
 }
 
 skip_if_root_() { uid_is_privileged_ && skip_test_ "must be run as non-root"; }
-- 
1.6.3.3


>From e892d0d2155dab81ded428e0c0d04d91febe9b3c Mon Sep 17 00:00:00 2001
From: Giuseppe Scrivano <address@hidden>
Date: Sat, 4 Jul 2009 10:25:03 +0200
Subject: [PATCH 2/2] tests: refactor code to use require_proc_pid_status_

* tests/tail-2/tail-n0f: Read the process status using the test-lib.sh
require_proc_pid_status_ function.
---
 tests/tail-2/tail-n0f |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/tests/tail-2/tail-n0f b/tests/tail-2/tail-n0f
index 322fddc..fce7ed1 100755
--- a/tests/tail-2/tail-n0f
+++ b/tests/tail-2/tail-n0f
@@ -40,9 +40,7 @@ for file in empty nonempty; do
     tail --sleep=4 -${c_or_n} 0 -f $file &
     pid=$!
     sleep .5
-    set _ `sed -n '/^State:[    ]*\([^  ]\)/s//\1/p' /proc/$pid/status`
-    shift # Remove the leading `_'.
-    state=$1
+    state=$(get_process_status_ $pid)
     case $state in
       S*) ;;
       *) echo $0: process in unexpected state: $state 1>&2; fail=1 ;;
-- 
1.6.3.3





reply via email to

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