summaryrefslogtreecommitdiffstats
path: root/testsuite/check.sh
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/check.sh')
-rwxr-xr-xtestsuite/check.sh349
1 files changed, 210 insertions, 139 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 56aafdb..348e447 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -54,8 +54,8 @@ bad3_lz="${testdir}"/test3_bad3.tar.lz
bad4_lz="${testdir}"/test3_bad4.tar.lz
bad5_lz="${testdir}"/test3_bad5.tar.lz
bad6_lz="${testdir}"/test3_bad6.tar.lz
-eof="${testdir}"/eof.tar
-eof_lz="${testdir}"/eof.tar.lz
+eoa="${testdir}"/eoa_blocks.tar
+eoa_lz="${testdir}"/eoa_blocks.tar.lz
fail=0
lwarnc=0
test_failed() { fail=1 ; printf " $1" ; [ -z "$2" ] || printf "($2)" ; }
@@ -65,12 +65,12 @@ cyg_symlink() { [ ${lwarnc} = 0 ] &&
# Description of test files for tarlz:
# test.txt.tar.lz: 1 member (test.txt).
-# t155.tar[.lz]: directory + 3 links + file + eof, all with 155 char names
+# t155.tar[.lz]: directory + 3 links + file + EOA, all with 155 char names
# t155_fv?.tar[.lz]: like t155.tar but with 3 kinds of format violations
-# t155_fv1.tar[.lz]: extended header followed by EOF blocks
-# t155_fv2.tar[.lz]: extended header followed by global header
-# t155_fv3.tar[.lz]: consecutive extended headers
-# t155_fv[456].tar.lz: like t155_fv[123].tar.lz but violation starts member
+# t155_fv1.tar[.lz]: extra extended header before EOA blocks
+# t155_fv2.tar[.lz]: first extended header followed by global header
+# t155_fv3.tar[.lz]: consecutive extended headers in last member
+# t155_fv[456].tar.lz: like t155_fv[123].tar.lz but violation alone in member
# tar_in_tlz1.tar.lz: 2 members (test.txt.tar test3.tar) 3 lzip members
# tar_in_tlz2.tar.lz: 2 members (test.txt.tar test3.tar) 5 lzip members
# ts_in_link.tar.lz: 4 symbolic links (link[1-4]) to / /dir/ dir/ dir(107/)
@@ -90,21 +90,21 @@ cyg_symlink() { [ ${lwarnc} = 0 ] &&
# test3_bad2.tar.lz: byte at offset 49 changed from 0x49 to 0x69 (mid stream)
# test3_bad3.tar.lz: byte at offset 176 changed from 0x7D to 0x6D (mid stream)
# test3_bad4.tar.lz: combined damage of test3_bad2.tar.lz and test3_bad3.tar.lz
-# test3_bad5.tar.lz: [71-134] --> zeroed (first trailer + seconf header)
+# test3_bad5.tar.lz: [71-134] --> zeroed (first trailer + second header)
# test3_bad6.tar.lz: 510 zeros prepended to test3.tar.lz (header in two blocks)
-# test3_eof?.tar: like test3_eof?.tar.lz but uncompressed
-# test3_eof1.tar.lz: test3.tar.lz without eof blocks
-# test3_eof2.tar.lz: test3.tar.lz with only one eof block
-# test3_eof3.tar.lz: test3.tar.lz with one zeroed block between foo and bar
-# test3_eof4.tar.lz: test3.tar.lz ended by extended header without eof blocks
-# test3_eof5.tar.lz: test3.tar.lz split ext first member, without eof blocks
+# test3_eoa?.tar: like test3_eoa?.tar.lz but uncompressed
+# test3_eoa1.tar.lz: test3.tar.lz without EOA blocks
+# test3_eoa2.tar.lz: test3.tar.lz with only one EOA block
+# test3_eoa3.tar.lz: test3.tar.lz with one zeroed block between foo and bar
+# test3_eoa4.tar.lz: test3.tar.lz ended by extended header without EOA blocks
+# test3_eoa5.tar.lz: test3.tar.lz split extended bar member, without EOA blocks
# test3_em?.tar.lz: test3.tar.lz with one empty lzip member at each position
# test3_em6.tar.lz: test3.tar.lz preceded by four empty lzip members
# test3_gh?.tar: test3.tar with global header at each position
# test3_gh?.tar.lz: test3.tar.lz with global before bar split in 4 ways
# test3_gh5.tar.lz: test3.tar.lz with global in lzip member before foo
# test3_gh6.tar.lz: test3.tar.lz with global before foo in same member
-# test3_nn.tar[.lz]: test3.tar[.lz] with no name in bar member
+# test3_nn.tar[.lz]: test3.tar[.lz] with zeroed name (no name) in bar member
# test3_sm?.tar.lz: test3.tar.lz with extended bar member split in 4 ways
# tlz_in_tar1.tar: 1 member (test3.tar.lz) first magic damaged
# tlz_in_tar2.tar: 2 members (foo test3.tar.lz) first magic damaged
@@ -179,7 +179,9 @@ done
[ $? = 1 ] || test_failed $LINENO
"${TARLZ}" -q -z .
[ $? = 1 ] || test_failed $LINENO
-"${TARLZ}" -q -tf "${in_tar_lz}" ""
+"${TARLZ}" -z -o - --uncompressed "${test3}" > /dev/null 2>&1
+[ $? = 1 ] || test_failed $LINENO
+"${TARLZ}" -q -tf "${in_tar_lz}" "" # empty non-option argument
[ $? = 1 ] || test_failed $LINENO
"${TARLZ}" --help > /dev/null || test_failed $LINENO
"${TARLZ}" -V > /dev/null || test_failed $LINENO
@@ -187,25 +189,32 @@ done
[ $? = 1 ] || test_failed $LINENO
"${TARLZ}" -tf 2> /dev/null
[ $? = 1 ] || test_failed $LINENO
-"${TARLZ}" --owner=invalid_oner_name -tf "${test3_lz}" 2> /dev/null
+bad_dates='@-9223372036854775809 @9223372036854775808
+ -2147481749-01-01T00:00:00 2147483648-01-01T00:00:00
+ 2017-10-01T 2017-10 ./nx_file'
+for i in ${bad_dates} ; do
+ "${TARLZ}" -c --mtime="$i" "${in}" > /dev/null 2>&1
+ [ $? = 1 ] || test_failed $LINENO "$i"
+done
+"${TARLZ}" --owner=invalid_owner_name -tf "${test3_lz}" 2> /dev/null
[ $? = 1 ] || test_failed $LINENO
-"${TARLZ}" --group=invalid_goup_name -tf "${test3_lz}" 2> /dev/null
+"${TARLZ}" --group=invalid_group_name -tf "${test3_lz}" 2> /dev/null
[ $? = 1 ] || test_failed $LINENO
printf "\ntesting --list and --extract..."
# test --list and --extract
-"${TARLZ}" -tf "${eof_lz}" --missing-crc || test_failed $LINENO
-"${TARLZ}" -xf "${eof_lz}" --missing-crc || test_failed $LINENO
+"${TARLZ}" -tf "${eoa_lz}" --missing-crc || test_failed $LINENO
+"${TARLZ}" -xf "${eoa_lz}" --missing-crc || test_failed $LINENO
"${TARLZ}" -C nx_dir -tf "${in_tar}" > /dev/null || test_failed $LINENO
"${TARLZ}" -xf "${in_tar}" --missing-crc || test_failed $LINENO
cmp "${in}" test.txt || test_failed $LINENO
rm -f test.txt || framework_failure
"${TARLZ}" -tf "${in_tar_lz}" --missing-crc > /dev/null || test_failed $LINENO
for i in 0 2 6 ; do
- "${TARLZ}" -n$i -xf "${in_tar_lz}" --missing-crc || test_failed $LINENO $i
- cmp "${in}" test.txt || test_failed $LINENO $i
- rm -f test.txt || framework_failure
+ "${TARLZ}" -n$i -xf "${in_tar_lz}" --missing-crc || test_failed $LINENO $i
+ cmp "${in}" test.txt || test_failed $LINENO $i
+ rm -f test.txt || framework_failure
done
# test3 reference files for -t and -tv (list3, vlist3)
@@ -323,51 +332,51 @@ for i in 0 2 6 ; do
rm -rf dir || framework_failure
done
-# test --list and --extract eof
-"${TARLZ}" -tvf "${testdir}"/test3_eof1.tar > out 2> /dev/null
+# test --list and --extract EOA
+"${TARLZ}" -tvf "${testdir}"/test3_eoa1.tar > out 2> /dev/null
[ $? = 2 ] || test_failed $LINENO
diff -u vlist3 out || test_failed $LINENO
-"${TARLZ}" -tvf "${testdir}"/test3_eof2.tar > out || test_failed $LINENO
+"${TARLZ}" -tvf "${testdir}"/test3_eoa2.tar > out || test_failed $LINENO
diff -u vlist3 out || test_failed $LINENO
-"${TARLZ}" -q -tf "${testdir}"/test3_eof3.tar || test_failed $LINENO
-"${TARLZ}" -tvf "${testdir}"/test3_eof4.tar > out 2> /dev/null
+"${TARLZ}" -q -tf "${testdir}"/test3_eoa3.tar || test_failed $LINENO
+"${TARLZ}" -tvf "${testdir}"/test3_eoa4.tar > out 2> /dev/null
[ $? = 2 ] || test_failed $LINENO
diff -u vlist3 out || test_failed $LINENO
for i in 0 2 6 ; do
- "${TARLZ}" -n$i -tvf "${testdir}"/test3_eof1.tar.lz > out 2> /dev/null
+ "${TARLZ}" -n$i -tvf "${testdir}"/test3_eoa1.tar.lz > out 2> /dev/null
[ $? = 2 ] || test_failed $LINENO $i
- diff -u vlist3 out || test_failed $LINENO
- "${TARLZ}" -n$i -tvf "${testdir}"/test3_eof2.tar.lz > out ||
+ diff -u vlist3 out || test_failed $LINENO $i
+ "${TARLZ}" -n$i -tvf "${testdir}"/test3_eoa2.tar.lz > out ||
test_failed $LINENO $i
- diff -u vlist3 out || test_failed $LINENO
- "${TARLZ}" -q -n$i -tf "${testdir}"/test3_eof3.tar.lz ||
+ diff -u vlist3 out || test_failed $LINENO $i
+ "${TARLZ}" -q -n$i -tf "${testdir}"/test3_eoa3.tar.lz ||
test_failed $LINENO $i
- "${TARLZ}" -n$i -tvf "${testdir}"/test3_eof4.tar.lz > out 2> /dev/null
+ "${TARLZ}" -n$i -tvf "${testdir}"/test3_eoa4.tar.lz > out 2> /dev/null
[ $? = 2 ] || test_failed $LINENO $i
- diff -u vlist3 out || test_failed $LINENO
- "${TARLZ}" -n$i -tvf "${testdir}"/test3_eof5.tar.lz > out 2> /dev/null
+ diff -u vlist3 out || test_failed $LINENO $i
+ "${TARLZ}" -n$i -tvf "${testdir}"/test3_eoa5.tar.lz > out 2> /dev/null
[ $? = 2 ] || test_failed $LINENO $i
- diff -u vlist3 out || test_failed $LINENO
+ diff -u vlist3 out || test_failed $LINENO $i
done
rm -f out || framework_failure
#
-"${TARLZ}" -q -xf "${testdir}"/test3_eof1.tar
+"${TARLZ}" -q -xf "${testdir}"/test3_eoa1.tar
[ $? = 2 ] || test_failed $LINENO
cmp cfoo foo || test_failed $LINENO
cmp cbar bar || test_failed $LINENO
cmp cbaz baz || test_failed $LINENO
rm -f foo bar baz || framework_failure
-"${TARLZ}" -xf "${testdir}"/test3_eof2.tar || test_failed $LINENO
+"${TARLZ}" -xf "${testdir}"/test3_eoa2.tar || test_failed $LINENO
cmp cfoo foo || test_failed $LINENO
cmp cbar bar || test_failed $LINENO
cmp cbaz baz || test_failed $LINENO
rm -f foo bar baz || framework_failure
-"${TARLZ}" -xf "${testdir}"/test3_eof3.tar || test_failed $LINENO
+"${TARLZ}" -xf "${testdir}"/test3_eoa3.tar || test_failed $LINENO
cmp cfoo foo || test_failed $LINENO
[ ! -e bar ] || test_failed $LINENO
[ ! -e baz ] || test_failed $LINENO
rm -f foo bar baz || framework_failure
-"${TARLZ}" -q -xf "${testdir}"/test3_eof4.tar
+"${TARLZ}" -q -xf "${testdir}"/test3_eoa4.tar
[ $? = 2 ] || test_failed $LINENO
cmp cfoo foo || test_failed $LINENO
cmp cbar bar || test_failed $LINENO
@@ -375,32 +384,31 @@ cmp cbaz baz || test_failed $LINENO
rm -f foo bar baz || framework_failure
#
for i in 0 2 6 ; do
- "${TARLZ}" -q -n$i -xf "${testdir}"/test3_eof1.tar.lz
- [ $? = 2 ] || test_failed $LINENO $i
- cmp cfoo foo || test_failed $LINENO $i
- cmp cbar bar || test_failed $LINENO $i
- cmp cbaz baz || test_failed $LINENO $i
- rm -f foo bar baz || framework_failure
- "${TARLZ}" -n$i -xf "${testdir}"/test3_eof2.tar.lz ||
- test_failed $LINENO $i
- cmp cfoo foo || test_failed $LINENO $i
- cmp cbar bar || test_failed $LINENO $i
- cmp cbaz baz || test_failed $LINENO $i
- rm -f foo bar baz || framework_failure
- "${TARLZ}" -q -n$i -xf "${testdir}"/test3_eof4.tar.lz
- [ $? = 2 ] || test_failed $LINENO $i
- cmp cfoo foo || test_failed $LINENO $i
- cmp cbar bar || test_failed $LINENO $i
- cmp cbaz baz || test_failed $LINENO $i
- rm -f foo bar baz || framework_failure
- "${TARLZ}" -q -n$i -xf "${testdir}"/test3_eof5.tar.lz
- [ $? = 2 ] || test_failed $LINENO $i
- cmp cfoo foo || test_failed $LINENO $i
- cmp cbar bar || test_failed $LINENO $i
- cmp cbaz baz || test_failed $LINENO $i
- rm -f foo bar baz || framework_failure
+ "${TARLZ}" -q -n$i -xf "${testdir}"/test3_eoa1.tar.lz
+ [ $? = 2 ] || test_failed $LINENO $i
+ cmp cfoo foo || test_failed $LINENO $i
+ cmp cbar bar || test_failed $LINENO $i
+ cmp cbaz baz || test_failed $LINENO $i
+ rm -f foo bar baz || framework_failure
+ "${TARLZ}" -n$i -xf "${testdir}"/test3_eoa2.tar.lz || test_failed $LINENO $i
+ cmp cfoo foo || test_failed $LINENO $i
+ cmp cbar bar || test_failed $LINENO $i
+ cmp cbaz baz || test_failed $LINENO $i
+ rm -f foo bar baz || framework_failure
+ "${TARLZ}" -q -n$i -xf "${testdir}"/test3_eoa4.tar.lz
+ [ $? = 2 ] || test_failed $LINENO $i
+ cmp cfoo foo || test_failed $LINENO $i
+ cmp cbar bar || test_failed $LINENO $i
+ cmp cbaz baz || test_failed $LINENO $i
+ rm -f foo bar baz || framework_failure
+ "${TARLZ}" -q -n$i -xf "${testdir}"/test3_eoa5.tar.lz
+ [ $? = 2 ] || test_failed $LINENO $i
+ cmp cfoo foo || test_failed $LINENO $i
+ cmp cbar bar || test_failed $LINENO $i
+ cmp cbaz baz || test_failed $LINENO $i
+ rm -f foo bar baz || framework_failure
done
-"${TARLZ}" -n0 -xf "${testdir}"/test3_eof3.tar.lz || test_failed $LINENO
+"${TARLZ}" -n0 -xf "${testdir}"/test3_eoa3.tar.lz || test_failed $LINENO
cmp cfoo foo || test_failed $LINENO $i
[ ! -e bar ] || test_failed $LINENO $i
[ ! -e baz ] || test_failed $LINENO $i
@@ -431,17 +439,15 @@ done
# test --list and --extract with global headers uncompressed
for i in gh1 gh2 gh3 gh4 ; do
- "${TARLZ}" -tf "${testdir}"/test3_${i}.tar > out ||
- test_failed $LINENO $i
- diff -u list3 out || test_failed $LINENO $i
- "${TARLZ}" -tvf "${testdir}"/test3_${i}.tar > out ||
- test_failed $LINENO $i
- diff -u vlist3 out || test_failed $LINENO $i
- "${TARLZ}" -xf "${testdir}"/test3_${i}.tar || test_failed $LINENO $i
- cmp cfoo foo || test_failed $LINENO $i
- cmp cbar bar || test_failed $LINENO $i
- cmp cbaz baz || test_failed $LINENO $i
- rm -f foo bar baz out || framework_failure
+ "${TARLZ}" -tf "${testdir}"/test3_${i}.tar > out || test_failed $LINENO $i
+ diff -u list3 out || test_failed $LINENO $i
+ "${TARLZ}" -tvf "${testdir}"/test3_${i}.tar > out || test_failed $LINENO $i
+ diff -u vlist3 out || test_failed $LINENO $i
+ "${TARLZ}" -xf "${testdir}"/test3_${i}.tar || test_failed $LINENO $i
+ cmp cfoo foo || test_failed $LINENO $i
+ cmp cbar bar || test_failed $LINENO $i
+ cmp cbaz baz || test_failed $LINENO $i
+ rm -f foo bar baz out || framework_failure
done
# test --list and --extract with empty lzip members, global headers and
@@ -495,7 +501,7 @@ cmp out.tar.lz aout.tar.lz || test_failed $LINENO
cmp "${in_tar_lz}" aout.tar.lz || test_failed $LINENO
"${TARLZ}" -A "${in_tar_lz}" "${test3_lz}" > aout.tar.lz || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
-cat "${eof_lz}" > aout.tar.lz || framework_failure
+cat "${eoa_lz}" > aout.tar.lz || framework_failure
"${TARLZ}" -Aqf aout.tar.lz "${in_tar}" # concatenate to empty archive
[ $? = 2 ] || test_failed $LINENO
"${TARLZ}" -Af aout.tar.lz "${in_tar_lz}" "${test3_lz}" || test_failed $LINENO
@@ -539,7 +545,7 @@ cmp out.tar aout.tar || test_failed $LINENO
cmp "${in_tar}" aout.tar || test_failed $LINENO
"${TARLZ}" -A "${in_tar}" "${test3}" > aout.tar || test_failed $LINENO
cmp out.tar aout.tar || test_failed $LINENO
-cat "${eof}" > aout.tar || framework_failure # concatenate to empty archive
+cat "${eoa}" > aout.tar || framework_failure # concatenate to empty archive
"${TARLZ}" -Aqf aout.tar "${in_tar_lz}"
[ $? = 2 ] || test_failed $LINENO
"${TARLZ}" -Af aout.tar "${in_tar}" "${test3}" || test_failed $LINENO
@@ -672,6 +678,42 @@ cmp cfoo foo || test_failed $LINENO
[ ! -e baz ] || test_failed $LINENO
rm -f out.tar foo bar baz || framework_failure
+# test --create --mtime
+dates='@-9223372036854775808 @-9223372036854775807
+ -2147481748-12-31T23:59:59 -1970-01-01T00:00:00
+ 0000-01-01T00:00:00 0000-01-01T00:00:01 0000-01-02T00:00:00
+ 1697-10-17T11:03:27 1697-10-17T11:03:28 1697-10-17T11:03:29
+ 1833-11-24T17:31:43 1833-11-24T17:31:44 1833-11-24T17:31:45
+ 1901-12-13T20:45:51 1901-12-13T20:45:52 1901-12-13T20:45:53
+ 1901-12-14T20:45:51
+ 1969-12-31T23:59:58 1969-12-31T23:59:59
+ 1970-01-01T00:00:00 1970-01-01T00:00:01 @0
+ 2038-01-18T03:14:07 2038-01-19T03:14:07 2038-01-19T03:14:08
+ 2106-02-07T06:28:15 2106-02-07T06:28:16
+ 2242-03-16T12:56:31 2242-03-16T12:56:32 @8589934591 @8589934592
+ 9999-12-31T23:59:58 9999-12-31T23:59:59
+ 2147483647-12-31T23:59:59 @9223372036854775807'
+touch -d 2022-01-05T12:22:13 bar || framework_failure
+for i in ${dates} @-8Ei '2017-10-01 09:00:00' '2017-10-1 9:0:0' \
+ '2017-10-01 09:00' '2017-10-01 09' 2017-10-01 ./bar ; do
+ touch foo || framework_failure
+ "${TARLZ}" --un -cf out.tar --mtime="$i" foo || test_failed $LINENO "$i"
+ "${TARLZ}" -q -df out.tar && test_failed $LINENO "$i"
+ "${TARLZ}" -xf out.tar || test_failed $LINENO "$i"
+ "${TARLZ}" -df out.tar --ignore-overflow || test_failed $LINENO "$i"
+done
+rm -f out.tar foo bar || framework_failure
+
+mkdir dir || framework_failure
+for i in ${dates} ; do
+ # Skip a time stamp $i if it's out of range for this platform,
+ # of if it uses a notation that this platform does not recognize.
+ touch -d $i dir/f$i >/dev/null 2>&1 || continue
+done
+"${TARLZ}" --uncompressed -cf out.tar dir || test_failed $LINENO
+"${TARLZ}" -df out.tar || test_failed $LINENO
+rm -rf out.tar dir || framework_failure
+
printf "\ntesting --diff..."
# test --diff
@@ -682,7 +724,7 @@ if cmp out.tar aout.tar > /dev/null ; then
printf "\nwarning: '--diff' test can't be run as root.\n"
else
for i in 0 2 6 ; do
- "${TARLZ}" -n$i -xf "${test3_lz}" || test_failed $LINENO
+ "${TARLZ}" -n$i -xf "${test3_lz}" || test_failed $LINENO $i
"${TARLZ}" -n$i -df "${test3_lz}" > out$i
[ $? = 1 ] || test_failed $LINENO $i
"${TARLZ}" -n$i -df "${test3_lz}" --ignore-ids || test_failed $LINENO $i
@@ -712,56 +754,68 @@ rm -f out.tar aout.tar foo bar baz || framework_failure
printf "\ntesting --delete..."
# test --delete
+cat "${in}" > out.tar || framework_failure # invalid tar
+"${TARLZ}" -q -f out.tar --delete foo
+[ $? = 2 ] || test_failed $LINENO
+rm -f out.tar || framework_failure
+cat "${in}" > out.tar.lz || framework_failure # invalid tar.lz
+"${TARLZ}" -q -f out.tar.lz --delete foo
+[ $? = 2 ] || test_failed $LINENO
+cat "${in_lz}" > out.tar.lz || framework_failure # invalid tar.lz
+"${TARLZ}" -q -f out.tar.lz --delete foo
+[ $? = 2 ] || test_failed $LINENO
+rm -f out.tar.lz || framework_failure
+
for e in "" .lz ; do
"${TARLZ}" -A "${in_tar}"$e "${test3}"$e > out.tar$e || test_failed $LINENO $e
"${TARLZ}" -f out.tar$e --delete test.txt || test_failed $LINENO $e
cmp "${test3}"$e out.tar$e || test_failed $LINENO $e
"${TARLZ}" -f out.tar$e --delete || test_failed $LINENO $e # delete nothing
cmp "${test3}"$e out.tar$e || test_failed $LINENO $e
- "${TARLZ}" -qf out.tar$e --delete nx_file
+ "${TARLZ}" -q -f out.tar$e --delete nx_file
[ $? = 1 ] || test_failed $LINENO $e
cmp "${test3}"$e out.tar$e || test_failed $LINENO $e
"${TARLZ}" -A "${in_tar}"$e "${test3dir}"$e > out.tar$e || test_failed $LINENO $e
- "${TARLZ}" -qf out.tar$e --delete test.txt || test_failed $LINENO $e
+ "${TARLZ}" -q -f out.tar$e --delete test.txt || test_failed $LINENO $e
cmp "${test3dir}"$e out.tar$e || test_failed $LINENO $e
"${TARLZ}" -A "${in_tar}"$e "${test3dir}"$e > out.tar$e || test_failed $LINENO $e
- "${TARLZ}" -qf out.tar$e --delete dir || test_failed $LINENO $e
+ "${TARLZ}" -q -f out.tar$e --delete dir || test_failed $LINENO $e
cmp "${in_tar}"$e out.tar$e || test_failed $LINENO $e
"${TARLZ}" -A "${in_tar}"$e "${test3dir}"$e > out.tar$e || test_failed $LINENO $e
- "${TARLZ}" -qf out.tar$e --del dir/foo dir/bar dir/baz || test_failed $LINENO $e
+ "${TARLZ}" -q -f out.tar$e --del dir/foo dir/bar dir/baz || test_failed $LINENO $e
cmp "${in_tar}"$e out.tar$e || test_failed $LINENO $e
"${TARLZ}" -A "${in_tar}"$e "${test3dir}"$e > out.tar$e || test_failed $LINENO $e
- "${TARLZ}" -qf out.tar$e --del dir/foo dir/baz || test_failed $LINENO $e
+ "${TARLZ}" -q -f out.tar$e --del dir/foo dir/baz || test_failed $LINENO $e
cmp "${in_tar}"$e out.tar$e > /dev/null && test_failed $LINENO $e
- "${TARLZ}" -qf out.tar$e --del dir/bar || test_failed $LINENO $e
+ "${TARLZ}" -q -f out.tar$e --del dir/bar || test_failed $LINENO $e
cmp "${in_tar}"$e out.tar$e || test_failed $LINENO $e
"${TARLZ}" -A "${in_tar}"$e "${test3}"$e > out.tar$e || test_failed $LINENO $e
"${TARLZ}" -f out.tar$e --delete foo bar baz || test_failed $LINENO $e
cmp "${in_tar}"$e out.tar$e || test_failed $LINENO $e
"${TARLZ}" -A "${in_tar}"$e "${test3}"$e > out.tar$e || test_failed $LINENO $e
"${TARLZ}" -f out.tar$e --del test.txt foo bar baz || test_failed $LINENO $e
- cmp "${eof}"$e out.tar$e || test_failed $LINENO $e
+ cmp "${eoa}"$e out.tar$e || test_failed $LINENO $e
"${TARLZ}" -A "${in_tar}"$e "${test3}"$e > out.tar$e || test_failed $LINENO $e
for i in test.txt foo bar baz ; do
"${TARLZ}" -f out.tar$e --delete $i || test_failed $LINENO "$e $i"
done
- cmp "${eof}"$e out.tar$e || test_failed $LINENO $e
+ cmp "${eoa}"$e out.tar$e || test_failed $LINENO $e
"${TARLZ}" -A "${in_tar}"$e "${test3}"$e > out.tar$e || test_failed $LINENO $e
for i in baz bar foo test.txt ; do
"${TARLZ}" -f out.tar$e --delete $i || test_failed $LINENO "$e $i"
done
- cmp "${eof}"$e out.tar$e || test_failed $LINENO $e
+ cmp "${eoa}"$e out.tar$e || test_failed $LINENO $e
"${TARLZ}" -A "${in_tar}"$e "${test3}"$e > out.tar$e || test_failed $LINENO $e
for i in foo bar test.txt baz ; do
"${TARLZ}" -f out.tar$e --delete $i || test_failed $LINENO "$e $i"
done
- cmp "${eof}"$e out.tar$e || test_failed $LINENO $e
+ cmp "${eoa}"$e out.tar$e || test_failed $LINENO $e
"${TARLZ}" -A "${in_tar}"$e "${t155}"$e "${test3}"$e > out.tar$e ||
test_failed $LINENO $e
"${TARLZ}" -f out.tar$e --del baz foo test.txt bar || test_failed $LINENO $e
cmp "${t155}"$e out.tar$e || test_failed $LINENO $e
"${TARLZ}" -f out.tar$e --delete link || test_failed $LINENO $e
- "${TARLZ}" -q -tf out.tar$e || test_failed $LINENO
+ "${TARLZ}" -q -tf out.tar$e || test_failed $LINENO $e
cmp "${t155}"$e out.tar$e > /dev/null && test_failed $LINENO $e
rm -f out.tar$e || framework_failure
done
@@ -775,8 +829,8 @@ cat "${in}" > test.txt || framework_failure
"${TARLZ}" -0 -rf out.tar.lz test.txt || test_failed $LINENO
rm -f foo bar baz test.txt || framework_failure
for i in foo bar baz ; do
- "${TARLZ}" -qf out.tar.lz --delete $i
- [ $? = 2 ] || test_failed $LINENO
+ "${TARLZ}" -q -f out.tar.lz --delete $i
+ [ $? = 2 ] || test_failed $LINENO $i
done
"${TARLZ}" -f out.tar.lz --delete test.txt || test_failed $LINENO
"${TARLZ}" -xf out.tar.lz || test_failed $LINENO
@@ -788,11 +842,11 @@ rm -f out.tar.lz foo bar baz test.txt || framework_failure
# test --delete with empty lzip member, global header
for i in 1 2 3 4 5 6 ; do
- cat "${testdir}"/test3_em${i}.tar.lz > out.tar.lz || framework_failure
- for j in foo bar baz ; do
- "${TARLZ}" -f out.tar.lz --delete $j || test_failed $LINENO "$i $j"
- done
- rm -f out.tar.lz || framework_failure
+ cat "${testdir}"/test3_em${i}.tar.lz > out.tar.lz || framework_failure
+ for j in foo bar baz ; do
+ "${TARLZ}" -f out.tar.lz --delete $j || test_failed $LINENO "$i $j"
+ done
+ rm -f out.tar.lz || framework_failure
done
cat "${testdir}"/test3_gh5.tar.lz > out.tar.lz || framework_failure
for i in foo bar baz ; do
@@ -882,7 +936,7 @@ cmp out.tar.lz aout.tar.lz || test_failed $LINENO
"${TARLZ}" --un -q -rf aout.tar.lz foo bar baz # wrong extension archive
[ $? = 2 ] || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
-cat "${eof_lz}" > aout.tar.lz || framework_failure # append to empty archive
+cat "${eoa_lz}" > aout.tar.lz || framework_failure # append to empty archive
"${TARLZ}" -0 -rf aout.tar.lz foo bar baz || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
"${TARLZ}" --un -q -rf aout.tar.lz foo bar baz # wrong extension empty archive
@@ -918,7 +972,7 @@ cmp out.tar aout.tar || test_failed $LINENO
"${TARLZ}" -0 -q -rf aout.tar foo bar baz # wrong extension archive
[ $? = 2 ] || test_failed $LINENO
cmp out.tar aout.tar || test_failed $LINENO
-cat "${eof}" > aout.tar || framework_failure # append to empty archive
+cat "${eoa}" > aout.tar || framework_failure # append to empty archive
"${TARLZ}" --un -rf aout.tar foo bar baz || test_failed $LINENO
cmp out.tar aout.tar || test_failed $LINENO
"${TARLZ}" -0 -q -rf aout.tar foo bar baz # wrong extension empty archive
@@ -937,18 +991,16 @@ for i in --asolid --bsolid --dsolid --solid -0 ; do
done
rm -f out.tar.lz aout.tar.lz || framework_failure
for i in --asolid --bsolid --dsolid -0 ; do
- for j in --asolid --bsolid --dsolid --solid -0 ; do
- "${TARLZ}" $i -0 -cf out.tar.lz foo ||
- test_failed $LINENO "$i $j"
- "${TARLZ}" $j -0 -rf out.tar.lz bar baz ||
- test_failed $LINENO "$i $j"
- rm -f foo bar baz || framework_failure
- "${TARLZ}" -xf out.tar.lz || test_failed $LINENO "$i $j"
- cmp cfoo foo || test_failed $LINENO "$i $j"
- cmp cbar bar || test_failed $LINENO "$i $j"
- cmp cbaz baz || test_failed $LINENO "$i $j"
- rm -f out.tar.lz || framework_failure
- done
+ for j in --asolid --bsolid --dsolid --solid -0 ; do
+ "${TARLZ}" $i -0 -cf out.tar.lz foo || test_failed $LINENO "$i $j"
+ "${TARLZ}" $j -0 -rf out.tar.lz bar baz || test_failed $LINENO "$i $j"
+ rm -f foo bar baz || framework_failure
+ "${TARLZ}" -xf out.tar.lz || test_failed $LINENO "$i $j"
+ cmp cfoo foo || test_failed $LINENO "$i $j"
+ cmp cbar bar || test_failed $LINENO "$i $j"
+ cmp cbaz baz || test_failed $LINENO "$i $j"
+ rm -f out.tar.lz || framework_failure
+ done
done
rm -f foo bar baz || framework_failure
@@ -1006,10 +1058,13 @@ if [ "${ln_works}" = yes ] ; then
"${TARLZ}" -0 -q -c ../tmp/dir1 | "${TARLZ}" -x || test_failed $LINENO
diff -ru tmp/dir1 dir1 || test_failed $LINENO
rm -rf tmp dir1 || framework_failure
+ # test -c -d -x on dangling (broken) symlinks with trailing slashes
"${TARLZ}" -xf "${testdir}"/ts_in_link.tar.lz || test_failed $LINENO
"${TARLZ}" -df "${testdir}"/ts_in_link.tar.lz --ignore-ids ||
test_failed $LINENO
- rm -f link1 link2 link3 link4 || framework_failure
+ "${TARLZ}" -0 -cf out.tar.lz link1 link2 link3 link4 || test_failed $LINENO
+ "${TARLZ}" -df out.tar.lz || test_failed $LINENO
+ rm -f out.tar.lz link1 link2 link3 link4 || framework_failure
fi
printf "\ntesting long names..."
@@ -1066,7 +1121,7 @@ cat out3.tar > out3z.tar || framework_failure
cat outz.tar.lz > out || test_failed $LINENO
cat out3z.tar.lz > out3 || test_failed $LINENO
rm -f out3z.tar.lz || framework_failure
-"${TARLZ}" -q -0 -z outz.tar out3z.tar
+"${TARLZ}" -q -0 -z outz.tar out3z.tar # outz.tar.lz exists
[ $? = 1 ] || test_failed $LINENO
cmp out outz.tar.lz || test_failed $LINENO
cmp out3 out3z.tar.lz || test_failed $LINENO
@@ -1108,24 +1163,40 @@ for i in --asolid --bsolid --dsolid ; do
cmp out3.tar.lz out3z.tar.lz || test_failed $LINENO $i
rm -f out outz.tar.lz out3z.tar.lz || framework_failure
done
-rm -f foo bar baz test.txt out.tar.lz out3.tar.lz out.tar outz.tar out3z.tar ||
- framework_failure
+# concatenate and compress
+"${TARLZ}" --un -cf foo.tar foo || test_failed $LINENO
+"${TARLZ}" --un -cf bar.tar bar || test_failed $LINENO
+"${TARLZ}" --un -cf baz.tar baz || test_failed $LINENO
+"${TARLZ}" -A foo.tar bar.tar baz.tar | "${TARLZ}" -0 -z -o foobarbaz.tar.lz ||
+ test_failed $LINENO
+cmp out3.tar.lz foobarbaz.tar.lz || test_failed $LINENO
+# compress and concatenate
+"${TARLZ}" -0 -z foo.tar bar.tar baz.tar || test_failed $LINENO
+"${TARLZ}" -A foo.tar.lz bar.tar.lz baz.tar.lz > foobarbaz.tar.lz ||
+ test_failed $LINENO
+"${TARLZ}" -0 -n0 --no-solid -c foo bar baz | cmp foobarbaz.tar.lz - ||
+ test_failed $LINENO
+rm -f foo bar baz test.txt out.tar.lz out.tar outz.tar foobarbaz.tar.lz \
+ out3.tar out3.tar.lz out3z.tar foo.tar bar.tar baz.tar \
+ foo.tar.lz bar.tar.lz baz.tar.lz || framework_failure
printf "\ntesting bad input..."
# test --extract ".."
mkdir dir1 || framework_failure
cd dir1 || framework_failure
-"${TARLZ}" -q -xf "${testdir}"/dotdot1.tar.lz || test_failed $LINENO
-[ ! -e ../dir ] || test_failed $LINENO
-"${TARLZ}" -q -xf "${testdir}"/dotdot2.tar.lz || test_failed $LINENO
-[ ! -e ../dir ] || test_failed $LINENO
-"${TARLZ}" -q -xf "${testdir}"/dotdot3.tar.lz || test_failed $LINENO
-[ ! -e dir ] || test_failed $LINENO
-"${TARLZ}" -q -xf "${testdir}"/dotdot4.tar.lz || test_failed $LINENO
-[ ! -e dir ] || test_failed $LINENO
-"${TARLZ}" -q -xf "${testdir}"/dotdot5.tar.lz || test_failed $LINENO
-[ ! -e dir ] || test_failed $LINENO
+for i in 0 2 ; do # try serial and parallel decoders
+ "${TARLZ}" -q -n$i -xf "${testdir}"/dotdot1.tar.lz || test_failed $LINENO $i
+ [ ! -e ../dir ] || test_failed $LINENO $i
+ "${TARLZ}" -q -n$i -xf "${testdir}"/dotdot2.tar.lz || test_failed $LINENO $i
+ [ ! -e ../dir ] || test_failed $LINENO $i
+ "${TARLZ}" -q -n$i -xf "${testdir}"/dotdot3.tar.lz || test_failed $LINENO $i
+ [ ! -e dir ] || test_failed $LINENO $i
+ "${TARLZ}" -q -n$i -xf "${testdir}"/dotdot4.tar.lz || test_failed $LINENO $i
+ [ ! -e dir ] || test_failed $LINENO $i
+ "${TARLZ}" -q -n$i -xf "${testdir}"/dotdot5.tar.lz || test_failed $LINENO $i
+ [ ! -e dir ] || test_failed $LINENO $i
+done
cd .. || framework_failure
rm -rf dir1 || framework_failure
@@ -1140,19 +1211,19 @@ rm -f truncated.tar || framework_failure
# test --delete with split 'bar' tar member
for i in 1 2 3 4 ; do
- cat "${testdir}"/test3_sm${i}.tar.lz > out.tar.lz || framework_failure
- for j in bar baz ; do
- "${TARLZ}" -q -f out.tar.lz --delete $j
- [ $? = 2 ] || test_failed $LINENO "$i $j"
- done
- cmp "${testdir}"/test3_sm${i}.tar.lz out.tar.lz || test_failed $LINENO $i
- "${TARLZ}" -q -f out.tar.lz --delete foo
- [ $? = 2 ] || test_failed $LINENO $i
- "${TARLZ}" -xf out.tar.lz || test_failed $LINENO
- [ ! -e foo ] || test_failed $LINENO
- cmp cbar bar || test_failed $LINENO
- cmp cbaz baz || test_failed $LINENO
- rm -f out.tar.lz foo bar baz || framework_failure
+ cat "${testdir}"/test3_sm${i}.tar.lz > out.tar.lz || framework_failure
+ for j in bar baz ; do
+ "${TARLZ}" -q -f out.tar.lz --delete $j
+ [ $? = 2 ] || test_failed $LINENO "$i $j"
+ done
+ cmp "${testdir}"/test3_sm${i}.tar.lz out.tar.lz || test_failed $LINENO $i
+ "${TARLZ}" -q -f out.tar.lz --delete foo
+ [ $? = 2 ] || test_failed $LINENO $i
+ "${TARLZ}" -xf out.tar.lz || test_failed $LINENO $i
+ [ ! -e foo ] || test_failed $LINENO $i
+ cmp cbar bar || test_failed $LINENO $i
+ cmp cbaz baz || test_failed $LINENO $i
+ rm -f out.tar.lz foo bar baz || framework_failure
done
# test --list and --extract format violations