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.
This commit is contained in:
Paul Eggert
2010-08-26 10:22:44 -07:00
parent fce1c1c8cb
commit 0adf4027f5
3 changed files with 7 additions and 1 deletions

View File

@@ -28,13 +28,15 @@ AT_SETUP([extracting symlinks to a read-only dir])
AT_KEYWORDS([extract extract07 read-only symlink]) AT_KEYWORDS([extract extract07 read-only symlink])
AT_TAR_CHECK([ AT_TAR_CHECK([
AT_UNPRIVILEGED_PREREQ
echo Prepare the directory echo Prepare the directory
mkdir dir mkdir dir
genfile -f foo genfile -f foo
cd dir cd dir
ln -s ../foo . ln -s ../foo .
cd .. cd ..
chmod -w dir chmod a-w dir
echo Create the archive echo Create the archive
tar cf archive dir || exit 1 tar cf archive dir || exit 1

View File

@@ -23,6 +23,8 @@ AT_SETUP([no need to save dir with unreadable . and ..])
AT_KEYWORDS([extract extrac09]) AT_KEYWORDS([extract extrac09])
AT_TAR_CHECK([ AT_TAR_CHECK([
AT_UNPRIVILEGED_PREREQ
mkdir dir mkdir dir
mkdir dir/sub mkdir dir/sub
mkdir dir/sub/extract mkdir dir/sub/extract

View File

@@ -23,6 +23,8 @@ AT_SETUP([incremental dump when the parent directory is unreadable])
AT_KEYWORDS([listed incremental listed03]) AT_KEYWORDS([listed incremental listed03])
AT_TAR_CHECK([ AT_TAR_CHECK([
AT_UNPRIVILEGED_PREREQ
mkdir dir mkdir dir
mkdir dir/sub mkdir dir/sub
mkdir dir/sub/a mkdir dir/sub/a