bug-coreutils
[Top][All Lists]
Advanced

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

bug#8292: COREUTILS-8.9: Potential bug in tests/cp/preserve-gid


From: Jim Meyering
Subject: bug#8292: COREUTILS-8.9: Potential bug in tests/cp/preserve-gid
Date: Sun, 20 Mar 2011 09:15:37 +0100

gmail wrote:
> This is my first contact and mail with this mailing list, to summarize
> i'm a coder maintening a personnal home server using several GNU tools
> since the late 90's.
>
> I build COREUTILS-8.9 in a chroot jail (gcc 4.5.2/libc 2.13/binutils
> 2.21/make 3.82) with an athlon architecture on ext3 FS and, as root,
> got one failed test on  tests/cp/preserve-gid :
...
> -t1 a0 "$nameless_uid" "$nameless_gid1" cp -p
> -t1 b0 "$nameless_uid" "$nameless_gid1" cp -p
> -t1 b1 "$nameless_uid" "$nameless_gid2" cp -p
> -t1 c0 "$nameless_uid" "$nameless_gid1" cp -p
> -t1 c1 "$nameless_uid" "$nameless_gid2" cp -p
> +t1 a0 "$nameless_uid" "$nameless_gid1" "../${path_dir_}/cp" -p
> +t1 b0 "$nameless_uid" "$nameless_gid1" "../${path_dir_}/cp" -p
> +t1 b1 "$nameless_uid" "$nameless_gid2" "../${path_dir_}/cp" -p
> +t1 c0 "$nameless_uid" "$nameless_gid1" "../${path_dir_}/cp" -p
> +t1 c1 "$nameless_uid" "$nameless_gid2" "../${path_dir_}/cp" -p
>
>  Exit $fail
>
> The checks are now all succesfull on my platform.
...
> The cp call ( "$@" "$f" b  ) in preserve-gid with arguments with quote
> could be a problem for some old fahsioned shells, even if i don't see
> any concerned shells.

If you find a problem, please let us know,
but due to the way init.sh selects a usable shell,
I think we don't have to worry about old shells.

> Some commands in other test scripts could have the same problem and
> should be then enforced in the same way, i'll do this if this is the
> right solution.

Nice analysis.  Thanks for reporting that.
That's a particularly convoluted part of the test suite.
I think the patch below solves the problem, too, while
continuing to invoke tools solely by their name
(i.e., with no relative or absolute prefix)
Can you confirm?

BTW, coreutils-8.10 is the latest stable release.

>From 7a3eca37167590a0cc245dc4ea7cb23815d81665 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sun, 20 Mar 2011 08:56:06 +0100
Subject: [PATCH] tests: fix a bug in cp/preserve-gid

* tests/cp/preserve-gid (t1): Export PATH into the environment used
by setuidgid, so that it runs the just-built "cp", rather than whatever
happens to be in $PATH.  Otherwise, we would see a test failure
whenever there is a less-functional cp in PATH.
Analysis by address@hidden in http://debbugs.gnu.org/8292.
---
 tests/cp/preserve-gid |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tests/cp/preserve-gid b/tests/cp/preserve-gid
index ac6d221..41b993c 100755
--- a/tests/cp/preserve-gid
+++ b/tests/cp/preserve-gid
@@ -56,7 +56,8 @@ t1() {
   f=$1; shift
   u=$1; shift
   g=$1; shift
-  t0 "$f" "$u" "$g" setuidgid -g "$nameless_gid1,$nameless_gid2" \
+  t0 "$f" "$u" "$g" env PATH="$PATH" \
+      setuidgid -g "$nameless_gid1,$nameless_gid2" \
       "$nameless_uid" "$@"
 }

--
1.7.4.1.499.g53f9





reply via email to

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