summaryrefslogtreecommitdiffstats
path: root/testsuite/check.sh
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/check.sh')
-rwxr-xr-xtestsuite/check.sh362
1 files changed, 308 insertions, 54 deletions
diff --git a/testsuite/check.sh b/testsuite/check.sh
index 29330cf..00a56cd 100755
--- a/testsuite/check.sh
+++ b/testsuite/check.sh
@@ -36,6 +36,7 @@ inbad1="${testdir}"/test_bad1.txt
inbad2="${testdir}"/test_bad2.txt
test3="${testdir}"/test3.tar
test3_lz="${testdir}"/test3.tar.lz
+test3dir="${testdir}"/test3_dir.tar
test3dir_lz="${testdir}"/test3_dir.tar.lz
test3dot_lz="${testdir}"/test3_dot.tar.lz
tarint1_lz="${testdir}"/tar_in_tlz1.tar.lz
@@ -67,13 +68,14 @@ lzlib_1_11() { [ ${lwarn} = 0 ] &&
# Description of test files for tarlz:
# test.txt.tar.lz: 1 member (test.txt).
# t155.tar[.lz]: directory + links + file + eof, all with 155 char names
+# t155_fv?.tar[.lz]: like t155.tar but with 3 kinds of format violations
# 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/)
# test_bad1.tar.lz: truncated at offset 6000 (of 7495)
# test_bad2.tar.lz: byte at offset 6000 changed from 0x56 to 0x46
-# test3.tar: 3 members (foo bar baz) + 2 zeroed 512-byte blocks
-# test3_dir.tar.lz: like test3.tar.lz but members /dir/foo /dir/bar /dir/baz
+# test3.tar[.lz]: 3 members (foo bar baz) + 2 zeroed 512-byte blocks
+# test3_dir.tar[.lz] like test3.tar but members /dir/foo /dir/bar /dir/baz
# test3_dot.tar.lz: 3 times 3 members ./foo ././bar ./././baz
# the 3 central members with filename in extended header
# test3_bad1.tar: byte at offset 259 changed from 't' to '0' (magic)
@@ -88,11 +90,19 @@ lzlib_1_11() { [ ${lwarn} = 0 ] &&
# 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_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_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_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
# ug32chars.tar.lz: 1 member (foo) with 32-character owner and group names
@@ -172,6 +182,15 @@ rm -f test.txt || framework_failure
cmp "${in}" test.txt || test_failed $LINENO
rm -f test.txt || framework_failure
+# test3 reference files for diff
+"${TARLZ}" -tf "${test3}" > list3 || test_failed $LINENO
+"${TARLZ}" -tvf "${test3}" > vlist3 || test_failed $LINENO
+"${TARLZ}" -tf "${test3_lz}" > out || test_failed $LINENO
+diff -u list3 out || test_failed $LINENO
+"${TARLZ}" -tvf "${test3_lz}" > out || test_failed $LINENO
+diff -u vlist3 out || test_failed $LINENO
+rm -f out || framework_failure
+
# test3 reference files for cmp
cat "${testdir}"/rfoo > cfoo || framework_failure
cat "${testdir}"/rbar > cbar || framework_failure
@@ -182,7 +201,10 @@ 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}" -q -tf "${test3_lz}" ./foo ./bar ./baz || test_failed $LINENO
+"${TARLZ}" -tvf "${test3_lz}" ./foo ./bar ./baz > out 2> /dev/null ||
+ test_failed $LINENO
+diff -u vlist3 out || test_failed $LINENO
+rm -f out || framework_failure
"${TARLZ}" -q -xf "${test3_lz}" ./foo ./bar ./baz || test_failed $LINENO
cmp cfoo foo || test_failed $LINENO
cmp cbar bar || test_failed $LINENO
@@ -209,17 +231,27 @@ 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}" -q -xf "${test3dir_lz}" --missing-crc || test_failed $LINENO
-cmp cfoo dir/foo || test_failed $LINENO
-cmp cbar dir/bar || test_failed $LINENO
-cmp cbaz dir/baz || test_failed $LINENO
-rm -rf dir || framework_failure
-"${TARLZ}" -q -tf "${test3dir_lz}" dir/foo dir/bar dir/baz || test_failed $LINENO
-"${TARLZ}" -q -xf "${test3dir_lz}" dir/foo dir/bar dir/baz || test_failed $LINENO
-cmp cfoo dir/foo || test_failed $LINENO
-cmp cbar dir/bar || test_failed $LINENO
-cmp cbaz dir/baz || test_failed $LINENO
-rm -rf dir || framework_failure
+
+for i in "${test3dir}" "${test3dir_lz}" ; do
+ "${TARLZ}" -q -tf "$i" --missing-crc || test_failed $LINENO "$i"
+ "${TARLZ}" -q -xf "$i" --missing-crc || test_failed $LINENO "$i"
+ cmp cfoo dir/foo || test_failed $LINENO "$i"
+ cmp cbar dir/bar || test_failed $LINENO "$i"
+ cmp cbaz dir/baz || test_failed $LINENO "$i"
+ rm -rf dir || framework_failure
+ "${TARLZ}" -q -tf "$i" dir || test_failed $LINENO "$i"
+ "${TARLZ}" -q -xf "$i" dir || test_failed $LINENO "$i"
+ cmp cfoo dir/foo || test_failed $LINENO "$i"
+ cmp cbar dir/bar || test_failed $LINENO "$i"
+ cmp cbaz dir/baz || test_failed $LINENO "$i"
+ rm -rf dir || framework_failure
+ "${TARLZ}" -q -tf "$i" dir/foo dir/baz || test_failed $LINENO "$i"
+ "${TARLZ}" -q -xf "$i" dir/foo dir/baz || test_failed $LINENO "$i"
+ cmp cfoo dir/foo || test_failed $LINENO "$i"
+ [ ! -e dir/bar ] || test_failed $LINENO "$i"
+ cmp cbaz dir/baz || test_failed $LINENO "$i"
+ rm -rf dir || framework_failure
+done
# --exclude
"${TARLZ}" -xf "${test3}" --exclude='f*o' --exclude=baz || test_failed $LINENO
@@ -237,63 +269,115 @@ cmp cfoo dir/foo || test_failed $LINENO
[ ! -e dir/bar ] || test_failed $LINENO
cmp cbaz dir/baz || test_failed $LINENO
rm -rf dir || framework_failure
+"${TARLZ}" -q -xf "${test3dir_lz}" --exclude=dir/bar || test_failed $LINENO
+cmp cfoo dir/foo || test_failed $LINENO
+[ ! -e dir/bar ] || test_failed $LINENO
+cmp cbaz dir/baz || test_failed $LINENO
+rm -rf dir || framework_failure
"${TARLZ}" -q -xf "${test3dir_lz}" --exclude=dir || test_failed $LINENO
[ ! -e dir ] || test_failed $LINENO
rm -rf dir || framework_failure
+"${TARLZ}" -q -xf "${test3dir_lz}" --exclude='dir/*' || test_failed $LINENO
+[ ! -e dir ] || test_failed $LINENO
+rm -rf dir || framework_failure
+"${TARLZ}" -q -xf "${test3dir_lz}" --exclude='[bf][ao][orz]' ||
+ test_failed $LINENO
+[ ! -e dir ] || test_failed $LINENO
+rm -rf dir || framework_failure
"${TARLZ}" -q -xf "${test3dir_lz}" --exclude='*o' dir/foo || test_failed $LINENO
[ ! -e dir ] || test_failed $LINENO
rm -rf dir || framework_failure
# eof
-"${TARLZ}" -q -tf "${testdir}"/test3_eof1.tar.lz
+"${TARLZ}" -tvf "${testdir}"/test3_eof1.tar > out 2> /dev/null
[ $? = 2 ] || test_failed $LINENO
-"${TARLZ}" -q -tf "${testdir}"/test3_eof2.tar.lz || test_failed $LINENO
-"${TARLZ}" -q -tf "${testdir}"/test3_eof3.tar.lz || test_failed $LINENO
-"${TARLZ}" -q -n0 -tf "${testdir}"/test3_eof1.tar.lz
+diff -u vlist3 out || test_failed $LINENO
+"${TARLZ}" -tvf "${testdir}"/test3_eof2.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
[ $? = 2 ] || test_failed $LINENO
-"${TARLZ}" -q -n0 -tf "${testdir}"/test3_eof2.tar.lz || test_failed $LINENO
-"${TARLZ}" -q -n0 -tf "${testdir}"/test3_eof3.tar.lz || 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
+ [ $? = 2 ] || test_failed $LINENO $i
+ diff -u vlist3 out || test_failed $LINENO
+ "${TARLZ}" -n$i -tvf "${testdir}"/test3_eof2.tar.lz > out ||
+ test_failed $LINENO $i
+ diff -u vlist3 out || test_failed $LINENO
+ "${TARLZ}" -q -n$i -tf "${testdir}"/test3_eof3.tar.lz ||
+ test_failed $LINENO $i
+ "${TARLZ}" -n$i -tvf "${testdir}"/test3_eof4.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
+ [ $? = 2 ] || test_failed $LINENO $i
+ diff -u vlist3 out || test_failed $LINENO
+done
+rm -f out || framework_failure
#
-"${TARLZ}" -q -xf "${testdir}"/test3_eof1.tar.lz
+"${TARLZ}" -q -xf "${testdir}"/test3_eof1.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.lz || test_failed $LINENO
+"${TARLZ}" -xf "${testdir}"/test3_eof2.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.lz || test_failed $LINENO
+"${TARLZ}" -xf "${testdir}"/test3_eof3.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 -n0 -xf "${testdir}"/test3_eof1.tar.lz
+"${TARLZ}" -q -xf "${testdir}"/test3_eof4.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}" -n0 -xf "${testdir}"/test3_eof2.tar.lz || 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}" -n0 -xf "${testdir}"/test3_eof3.tar.lz || 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
+#
+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}" -n$i -xf "${testdir}"/test3_eof3.tar.lz ||
+ test_failed $LINENO $i
+ cmp cfoo foo || test_failed $LINENO $i
+ [ ! -e bar ] || test_failed $LINENO $i
+ [ ! -e 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
+done
# test --list and --extract tar in tar.lz
for i in "${tarint1_lz}" "${tarint2_lz}" ; do
for j in 0 2 6 ; do
- "${TARLZ}" -tf "$i" --threads=$j > out$j ||
+ "${TARLZ}" -tf "$i" -n$j > out$j ||
test_failed $LINENO "$i $j"
- "${TARLZ}" -tvf "$i" --threads=$j > outv$j ||
+ "${TARLZ}" -tvf "$i" -n$j > outv$j ||
test_failed $LINENO "$i $j"
done
diff -u out0 out2 || test_failed $LINENO $i
@@ -309,23 +393,35 @@ for i in "${tarint1_lz}" "${tarint2_lz}" ; do
rm -f test.txt.tar test3.tar || framework_failure
done
-# test --list and --extract with empty lzip members
-for i in 1 2 3 4 5 6 ; do
+# 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
+done
+
+# test --list and --extract with empty lzip members, global headers and
+# extended tar members split among lzip members
+for i in em1 em2 em3 em4 em5 em6 gh1 gh2 gh3 gh4 gh5 gh6 sm1 sm2 sm3 sm4 ; do
for j in 0 2 6 ; do
- "${TARLZ}" -tf "${testdir}"/test3_em${i}.tar.lz --threads=$j \
- > out$j || test_failed $LINENO "$i $j"
- "${TARLZ}" -tvf "${testdir}"/test3_em${i}.tar.lz --threads=$j \
- > outv$j || test_failed $LINENO "$i $j"
+ "${TARLZ}" -tf "${testdir}"/test3_${i}.tar.lz -n$j > out ||
+ test_failed $LINENO "$i $j"
+ diff -u list3 out || test_failed $LINENO "$i $j"
+ "${TARLZ}" -tvf "${testdir}"/test3_${i}.tar.lz -n$j > out ||
+ test_failed $LINENO "$i $j"
+ diff -u vlist3 out || test_failed $LINENO "$i $j"
done
- diff -u out0 out2 || test_failed $LINENO $i
- diff -u out0 out6 || test_failed $LINENO $i
- diff -u out2 out6 || test_failed $LINENO $i
- diff -u outv0 outv2 || test_failed $LINENO $i
- diff -u outv0 outv6 || test_failed $LINENO $i
- diff -u outv2 outv6 || test_failed $LINENO $i
- rm -f out0 out2 out6 outv0 outv2 outv6 || framework_failure
+ rm -f out || framework_failure
for j in 0 2 6 ; do
- "${TARLZ}" -xf "${testdir}"/test3_em${i}.tar.lz --threads=$j ||
+ "${TARLZ}" -xf "${testdir}"/test3_${i}.tar.lz -n$j ||
test_failed $LINENO "$i $j"
cmp cfoo foo || test_failed $LINENO "$i $j"
cmp cbar bar || test_failed $LINENO "$i $j"
@@ -334,7 +430,7 @@ for i in 1 2 3 4 5 6 ; do
done
done
-# test --concatenate
+# test --concatenate compressed
cat "${in}" > out.tar.lz || framework_failure # invalid tar.lz
"${TARLZ}" -Aqf out.tar.lz "${test3_lz}"
[ $? = 2 ] || test_failed $LINENO
@@ -378,7 +474,7 @@ touch aout.tar.lz || framework_failure # --exclude
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
rm -f out.tar.lz aout.tar.lz || framework_failure
-# --uncompressed
+# test --concatenate uncompressed
cat "${in}" > out.tar || framework_failure # invalid tar
"${TARLZ}" -Aqf out.tar "${test3}"
[ $? = 2 ] || test_failed $LINENO
@@ -535,6 +631,98 @@ cmp cfoo foo || test_failed $LINENO
[ ! -e baz ] || test_failed $LINENO
rm -f out.tar foo bar baz || framework_failure
+# test --delete
+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
+ [ $? = 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ "${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
+ "${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
+ "${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
+ "${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
+ cmp "${t155}"$e out.tar$e > /dev/null && test_failed $LINENO $e
+ rm -f out.tar$e || framework_failure
+done
+
+# test --delete individual member after collective member
+cat cfoo > foo || framework_failure
+cat cbar > bar || framework_failure
+cat cbaz > baz || framework_failure
+cat "${in}" > test.txt || framework_failure
+"${TARLZ}" -0 -cf out.tar.lz foo bar baz --asolid || test_failed $LINENO
+"${TARLZ}" -0 -rf out.tar.lz test.txt || test_failed $LINENO
+rm -f foo bar baz test.txt || framework_failure
+"${TARLZ}" -f out.tar.lz --delete test.txt || test_failed $LINENO
+"${TARLZ}" -xf out.tar.lz || test_failed $LINENO
+cmp cfoo foo || test_failed $LINENO
+cmp cbar bar || test_failed $LINENO
+cmp cbaz baz || test_failed $LINENO
+[ ! -e test.txt ] || test_failed $LINENO
+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
+done
+cat "${testdir}"/test3_gh5.tar.lz > out.tar.lz || framework_failure
+for i in foo bar baz ; do
+ "${TARLZ}" -f out.tar.lz --delete $i || test_failed $LINENO $i
+done
+rm -f out.tar.lz || framework_failure
+for i in 1 2 3 4 ; do
+ cat "${testdir}"/test3_gh${i}.tar > out.tar || framework_failure
+ for j in foo bar baz ; do
+ "${TARLZ}" -f out.tar --delete $j || test_failed $LINENO "$i $j"
+ done
+ rm -f out.tar || framework_failure
+done
+
# test --dereference
touch dummy_file || framework_failure
if ln dummy_file dummy_link 2> /dev/null &&
@@ -612,7 +800,8 @@ cmp out.tar.lz aout.tar.lz || test_failed $LINENO
[ $? = 2 ] || test_failed $LINENO
cmp out.tar.lz aout.tar.lz || test_failed $LINENO
rm -f out.tar.lz aout.tar.lz || framework_failure
-#
+
+# --uncompressed
"${TARLZ}" --un -cf out.tar foo bar baz || test_failed $LINENO
"${TARLZ}" --un -cf aout.tar foo || test_failed $LINENO
"${TARLZ}" --un -rf aout.tar foo bar baz --exclude foo || test_failed $LINENO
@@ -686,6 +875,15 @@ else
"${TARLZ}" -df "${test3_lz}" --ignore-ids || test_failed $LINENO
"${TARLZ}" -df "${test3_lz}" --exclude '*' || test_failed $LINENO
"${TARLZ}" -df "${in_tar_lz}" --exclude '*' || test_failed $LINENO
+ rm -f bar || framework_failure
+ "${TARLZ}" -df "${test3_lz}" foo baz --ignore-ids || test_failed $LINENO
+ "${TARLZ}" -df "${test3_lz}" --exclude bar --ignore-ids ||
+ test_failed $LINENO
+ rm -f foo baz || framework_failure
+ "${TARLZ}" -q -xf "${test3dir_lz}" || test_failed $LINENO
+ "${TARLZ}" -q -df "${test3dir_lz}" --ignore-ids || test_failed $LINENO
+ "${TARLZ}" -q -df "${test3dir_lz}" dir --ignore-ids || test_failed $LINENO
+ rm -rf dir || framework_failure
fi
rm -f out.tar aout.tar foo bar baz || framework_failure
@@ -786,6 +984,8 @@ rm -f foo || framework_failure
printf "\ntesting bad input..."
+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
@@ -796,6 +996,8 @@ printf "\ntesting bad input..."
[ ! -e dir ] || test_failed $LINENO
"${TARLZ}" -q -xf "${testdir}"/dotdot5.tar.lz || test_failed $LINENO
[ ! -e dir ] || test_failed $LINENO
+cd .. || framework_failure
+rm -rf dir1 || framework_failure
dd if="${in_tar}" of=truncated.tar bs=1000 count=1 2> /dev/null
"${TARLZ}" -q -tf truncated.tar > /dev/null
@@ -805,6 +1007,58 @@ dd if="${in_tar}" of=truncated.tar bs=1000 count=1 2> /dev/null
[ ! -e test.txt ] || test_failed $LINENO
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
+done
+
+# test format violations
+if [ "${ln_works}" = yes ] ; then
+ mkdir dir1 || framework_failure
+ "${TARLZ}" -C dir1 -xf "${t155}" || test_failed $LINENO
+fi
+for i in 1 2 3 ; do
+ "${TARLZ}" -q -tf "${testdir}"/t155_fv${i}.tar
+ [ $? = 2 ] || test_failed $LINENO $i
+ "${TARLZ}" -q -tf "${testdir}"/t155_fv${i}.tar --permissive ||
+ test_failed $LINENO $i
+ if [ "${ln_works}" = yes ] ; then
+ mkdir dir2 || framework_failure
+ "${TARLZ}" -C dir2 -xf "${testdir}"/t155_fv${i}.tar --permissive ||
+ test_failed $LINENO $i
+ diff -ru dir1 dir2 || test_failed $LINENO $i
+ rm -rf dir2 || framework_failure
+ fi
+done
+for i in 1 2 3 4 5 6 ; do
+ "${TARLZ}" -q -tf "${testdir}"/t155_fv${i}.tar.lz
+ [ $? = 2 ] || test_failed $LINENO $i
+ "${TARLZ}" -q -tf "${testdir}"/t155_fv${i}.tar.lz --permissive ||
+ test_failed $LINENO $i
+ if [ "${ln_works}" = yes ] ; then
+ mkdir dir2 || framework_failure
+ "${TARLZ}" -C dir2 -xf "${testdir}"/t155_fv${i}.tar.lz --permissive ||
+ test_failed $LINENO $i
+ diff -ru dir1 dir2 || test_failed $LINENO $i
+ rm -rf dir2 || framework_failure
+ fi
+done
+if [ "${ln_works}" = yes ] ; then
+ rm -rf dir1 || framework_failure
+fi
+
# test compressed and --keep-damaged
rm -f test.txt || framework_failure
for i in "${inbad1}" "${inbad2}" ; do