summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-08-26 10:22:44 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2010-08-26 10:23:06 -0700
commit0adf4027f5859235c2e3bb61b564c95ec018fe61 (patch)
tree1a0d634317c38ad101c8ec07166e35e8d1a65fb7
parentfce1c1c8cbb4a3df303ae01b33459197cb42c557 (diff)
downloadtar-0adf4027f5859235c2e3bb61b564c95ec018fe61.tar.gz
tar: avoid assumptions about root access and chmod -w in test cases
* tests/extrac07.at, tests/extrac09.at, tests/listed03.at: Use AT_UNPRIVILEGED_PREREQ, since this test requires non-root privileges. * tests/extrac07.at: Don't use "chmod -w", as POSIX says it's not portable to start a chmod permissions-list with "-" as it may be confused with an option. Use "chmod a-w" instead.
-rw-r--r--tests/extrac07.at4
-rw-r--r--tests/extrac09.at2
-rw-r--r--tests/listed03.at2
3 files changed, 7 insertions, 1 deletions
diff --git a/tests/extrac07.at b/tests/extrac07.at
index 920175cd..d993dc36 100644
--- a/tests/extrac07.at
+++ b/tests/extrac07.at
@@ -28,13 +28,15 @@ AT_SETUP([extracting symlinks to a read-only dir])
AT_KEYWORDS([extract extract07 read-only symlink])
AT_TAR_CHECK([
+AT_UNPRIVILEGED_PREREQ
+
echo Prepare the directory
mkdir dir
genfile -f foo
cd dir
ln -s ../foo .
cd ..
-chmod -w dir
+chmod a-w dir
echo Create the archive
tar cf archive dir || exit 1
diff --git a/tests/extrac09.at b/tests/extrac09.at
index 4506c04d..8241c30a 100644
--- a/tests/extrac09.at
+++ b/tests/extrac09.at
@@ -23,6 +23,8 @@ AT_SETUP([no need to save dir with unreadable . and ..])
AT_KEYWORDS([extract extrac09])
AT_TAR_CHECK([
+AT_UNPRIVILEGED_PREREQ
+
mkdir dir
mkdir dir/sub
mkdir dir/sub/extract
diff --git a/tests/listed03.at b/tests/listed03.at
index 5bf8e583..f3feda76 100644
--- a/tests/listed03.at
+++ b/tests/listed03.at
@@ -23,6 +23,8 @@ AT_SETUP([incremental dump when the parent directory is unreadable])
AT_KEYWORDS([listed incremental listed03])
AT_TAR_CHECK([
+AT_UNPRIVILEGED_PREREQ
+
mkdir dir
mkdir dir/sub
mkdir dir/sub/a