diff options
author | Jim Meyering <meyering@redhat.com> | 2008-01-08 15:50:51 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-01-08 15:53:29 +0100 |
commit | e80379051b72cff4c948c7045491c9faa8a2a643 (patch) | |
tree | 36813949c3a23ddb7abf8a2ab1f1a919fd4fd378 /tests | |
parent | 0c3544ddc20ad65a040cb0dfbd4be9e078ee333c (diff) | |
download | coreutils-e80379051b72cff4c948c7045491c9faa8a2a643.tar.xz |
parent-perm: avoid a bizarre test failure.
* tests/cp/parent-perm: Accommodate the situation in which
chmod ("dir", 02755) returns 0 yet fails to set the S_ISGID bit.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/cp/parent-perm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/cp/parent-perm b/tests/cp/parent-perm index 1c7a222bb..cedcac4df 100755 --- a/tests/cp/parent-perm +++ b/tests/cp/parent-perm @@ -33,6 +33,15 @@ cp -p --parent a/b/d/foo e || fail=1 # Ensure that permissions on just-created directory, e/a/, # are the same as those on original, a/. -test $(stat --printf %A a) = $(stat --printf %A e/a) || fail=1 + +# The sed filter maps any 's' from an inherited set-GID bit +# to the usual 'x'. Otherwise, under unusual circumstances, this +# test would fail with e.g., drwxr-sr-x != drwxr-xr-x . +# For reference, the unusual circumstances is: build dir is set-gid, +# so "a/" inherits that. However, when the user does not belong to +# the group of the build directory, chmod ("a/e", 02755) returns 0, +# yet fails to set the S_ISGID bit. +test $(stat --printf %A a|sed s/s/x/g) = $(stat --printf %A e/a|sed s/s/x/g) || + fail=1 (exit $fail); exit $fail |