Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/testsuite/tar.tests
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/testsuite/tar.tests
r3232 r3621 16 16 # testing "test name" "script" "expected result" "file input" "stdin" 17 17 18 testing "Empty file is not a tarball" '\ 19 tar xvf - 2>&1; echo $? 20 ' "\ 21 tar: short read 22 1 23 " \ 24 "" "" 25 SKIP= 26 27 optional FEATURE_SEAMLESS_GZ GUNZIP 28 # In NOMMU case, "invalid magic" message comes from gunzip child process. 29 # Otherwise, it comes from tar. 30 # Need to fix output up to avoid false positive. 31 testing "Empty file is not a tarball.tar.gz" '\ 32 { tar xvzf - 2>&1; echo $?; } | grep -Fv "invalid magic" 33 ' "\ 34 tar: short read 35 1 36 " \ 37 "" "" 38 SKIP= 39 40 testing "Two zeroed blocks is a ('truncated') empty tarball" '\ 41 dd if=/dev/zero bs=512 count=2 2>/dev/null | tar xvf - 2>&1; echo $? 42 ' "\ 43 0 44 " \ 45 "" "" 46 SKIP= 47 48 testing "Twenty zeroed blocks is an empty tarball" '\ 49 dd if=/dev/zero bs=512 count=20 2>/dev/null | tar xvf - 2>&1; echo $? 50 ' "\ 51 0 52 " \ 53 "" "" 54 SKIP= 55 56 # "tar cf test.tar input input_dir/ input_hard1 input_hard2 input_hard1 input_dir/ input": 57 # GNU tar 1.26 records as hardlinks: 58 # input_hard2 -> input_hard1 59 # input_hard1 -> input_hard1 (!!!) 60 # input_dir/file -> input_dir/file 61 # input -> input 62 # As of 1.24.0, we don't record last two: for them, nlink==1 63 # and we check for "hardlink"ness only files with nlink!=1 64 # We also don't use "hrw-r--r--" notation for hardlinks in "tar tv" listing. 18 65 optional FEATURE_TAR_CREATE FEATURE_LS_SORTFILES 19 66 testing "tar hardlinks and repeated files" '\ … … 27 74 tar cf test.tar input input_dir/ input_hard1 input_hard2 input_hard1 input_dir/ input 28 75 tar tvf test.tar | sed "s/.*[0-9] input/input/" 76 rm -rf input_dir 29 77 tar xf test.tar 2>&1 30 78 echo Ok: $? … … 157 205 # Had a bug where on extract autodetect first "switched off" -z 158 206 # and then failed to recognize .tgz extension 159 optional FEATURE_TAR_CREATE FEATURE_SEAMLESS_GZ 207 optional FEATURE_TAR_CREATE FEATURE_SEAMLESS_GZ GUNZIP 160 208 testing "tar extract tgz" "\ 161 209 dd count=1 bs=1M if=/dev/zero of=F0 2>/dev/null … … 209 257 SKIP= 210 258 259 # attack.tar.bz2 has symlink pointing to a system file 260 # followed by a regular file with the same name 261 # containing "root::0:0::/root:/bin/sh": 262 # lrwxrwxrwx root/root passwd -> /tmp/passwd 263 # -rw-r--r-- root/root passwd 264 # naive tar implementation may end up creating the symlink 265 # and then writing into it. 266 # The correct implementation unlinks target before 267 # creating the second file. 268 # We test that /tmp/passwd remains empty: 269 optional UUDECODE FEATURE_TAR_AUTODETECT FEATURE_SEAMLESS_BZ2 270 testing "tar does not extract into symlinks" "\ 271 >>/tmp/passwd && uudecode -o input && tar xf input 2>&1 && rm passwd; cat /tmp/passwd; echo \$? 272 " "\ 273 0 274 " \ 275 "" "\ 276 begin-base64 644 attack.tar.bz2 277 QlpoOTFBWSZTWRVn/bIAAKt7hMqwAEBAAP2QAhB0Y96AAACACCAAlISgpqe0 278 po0DIaDynqAkpDRP1ANAhiYNSPR8VchKhAz0AK59+DA6FcMKBggOARIJdVHL 279 DGllrjs20ATUgR1HmccBX3EhoMnpMJaNyggmxgLDMz54lBnBTJO/1L1lbMS4 280 l4/V8LDoe90yiWJhOJvIypgEfxdyRThQkBVn/bI= 281 ==== 282 " 283 SKIP= 284 # And same with -k 285 optional UUDECODE FEATURE_TAR_AUTODETECT FEATURE_SEAMLESS_BZ2 286 testing "tar -k does not extract into symlinks" "\ 287 >>/tmp/passwd && uudecode -o input && tar xf input -k 2>&1 && rm passwd; cat /tmp/passwd; echo \$? 288 " "\ 289 tar: can't open 'passwd': File exists 290 0 291 " \ 292 "" "\ 293 begin-base64 644 attack.tar.bz2 294 QlpoOTFBWSZTWRVn/bIAAKt7hMqwAEBAAP2QAhB0Y96AAACACCAAlISgpqe0 295 po0DIaDynqAkpDRP1ANAhiYNSPR8VchKhAz0AK59+DA6FcMKBggOARIJdVHL 296 DGllrjs20ATUgR1HmccBX3EhoMnpMJaNyggmxgLDMz54lBnBTJO/1L1lbMS4 297 l4/V8LDoe90yiWJhOJvIypgEfxdyRThQkBVn/bI= 298 ==== 299 " 300 SKIP= 301 211 302 212 303 cd .. && rm -rf tar.tempdir || exit 1
Note:
See TracChangeset
for help on using the changeset viewer.