diff options
author | Jim Meyering <meyering@redhat.com> | 2008-04-24 12:43:20 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-04-27 21:31:32 +0200 |
commit | 8dc387dba567da10e2e90107fd044baaef580145 (patch) | |
tree | 3b768293185e0babb07578202830a4b6d7ddf62d /tests/cp | |
parent | cca6a8d7e525edb232160046d074fff16a76bbb5 (diff) | |
download | coreutils-8dc387dba567da10e2e90107fd044baaef580145.tar.xz |
tests: cp/perm (usually not run) was failing on systems with SELinux
* tests/cp/perm: Use stat to get the permission string, not ls.
This test was run only when RUN_VERY_EXPENSIVE_TESTS=yes was set
in the environment. It would fail on SELinux-enable systems
because ls-generated permission strings would not match, e.g.,
"test _-rw-r--r--+ = _-rw-r--r--" would fail.
Diffstat (limited to 'tests/cp')
-rwxr-xr-x | tests/cp/perm | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/tests/cp/perm b/tests/cp/perm index b24221f03..b482c173d 100755 --- a/tests/cp/perm +++ b/tests/cp/perm @@ -41,9 +41,7 @@ for u in 31 37 2; do for o_perm in r w x rw wx xr rwx; do touch src || exit 1 chmod u=r,g=rx,o= src || exit 1 - set _ `ls -l src` - shift - expected_perms=$1 + expected_perms=$(stat --format=%A src) rm -f dest test $existing_dest = yes && { touch dest || exit 1 @@ -52,8 +50,7 @@ for u in 31 37 2; do $cmd $force src dest || exit 1 test "$cmd" = mv && test -f src && exit 1 test "$cmd" = cp && { test -f src || exit 1; } - set _ `ls -l dest` - shift + actual_perms=$(stat --format=%A dest) case "$cmd:$force:$existing_dest" in cp:*:yes) @@ -68,7 +65,7 @@ for u in 31 37 2; do expected_perms=`echo $expected_perms|sed 's/..\(..\).$/--\1-/'` ;; esac - test _$1 = _$expected_perms || exit 1 + test _$actual_perms = _$expected_perms || exit 1 # Perform only one iteration when there's no existing destination. test $existing_dest = no && break 3 done |