Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (7 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

Location:
branches/3.3
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi-busybox/testsuite/tar.tests

    r3232 r3621  
    1616# testing "test name" "script" "expected result" "file input" "stdin"
    1717
     18testing "Empty file is not a tarball" '\
     19tar xvf - 2>&1; echo $?
     20' "\
     21tar: short read
     221
     23" \
     24"" ""
     25SKIP=
     26
     27optional 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.
     31testing "Empty file is not a tarball.tar.gz" '\
     32{ tar xvzf - 2>&1; echo $?; } | grep -Fv "invalid magic"
     33' "\
     34tar: short read
     351
     36" \
     37"" ""
     38SKIP=
     39
     40testing "Two zeroed blocks is a ('truncated') empty tarball" '\
     41dd if=/dev/zero bs=512 count=2 2>/dev/null | tar xvf - 2>&1; echo $?
     42' "\
     430
     44" \
     45"" ""
     46SKIP=
     47
     48testing "Twenty zeroed blocks is an empty tarball" '\
     49dd if=/dev/zero bs=512 count=20 2>/dev/null | tar xvf - 2>&1; echo $?
     50' "\
     510
     52" \
     53"" ""
     54SKIP=
     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.
    1865optional FEATURE_TAR_CREATE FEATURE_LS_SORTFILES
    1966testing "tar hardlinks and repeated files" '\
     
    2774tar cf test.tar input input_dir/ input_hard1 input_hard2 input_hard1 input_dir/ input
    2875tar tvf test.tar | sed "s/.*[0-9] input/input/"
     76rm -rf input_dir
    2977tar xf test.tar 2>&1
    3078echo Ok: $?
     
    157205# Had a bug where on extract autodetect first "switched off" -z
    158206# and then failed to recognize .tgz extension
    159 optional FEATURE_TAR_CREATE FEATURE_SEAMLESS_GZ
     207optional FEATURE_TAR_CREATE FEATURE_SEAMLESS_GZ GUNZIP
    160208testing "tar extract tgz" "\
    161209dd count=1 bs=1M if=/dev/zero of=F0 2>/dev/null
     
    209257SKIP=
    210258
     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:
     269optional UUDECODE FEATURE_TAR_AUTODETECT FEATURE_SEAMLESS_BZ2
     270testing "tar does not extract into symlinks" "\
     271>>/tmp/passwd && uudecode -o input && tar xf input 2>&1 && rm passwd; cat /tmp/passwd; echo \$?
     272" "\
     2730
     274" \
     275"" "\
     276begin-base64 644 attack.tar.bz2
     277QlpoOTFBWSZTWRVn/bIAAKt7hMqwAEBAAP2QAhB0Y96AAACACCAAlISgpqe0
     278po0DIaDynqAkpDRP1ANAhiYNSPR8VchKhAz0AK59+DA6FcMKBggOARIJdVHL
     279DGllrjs20ATUgR1HmccBX3EhoMnpMJaNyggmxgLDMz54lBnBTJO/1L1lbMS4
     280l4/V8LDoe90yiWJhOJvIypgEfxdyRThQkBVn/bI=
     281====
     282"
     283SKIP=
     284# And same with -k
     285optional UUDECODE FEATURE_TAR_AUTODETECT FEATURE_SEAMLESS_BZ2
     286testing "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" "\
     289tar: can't open 'passwd': File exists
     2900
     291" \
     292"" "\
     293begin-base64 644 attack.tar.bz2
     294QlpoOTFBWSZTWRVn/bIAAKt7hMqwAEBAAP2QAhB0Y96AAACACCAAlISgpqe0
     295po0DIaDynqAkpDRP1ANAhiYNSPR8VchKhAz0AK59+DA6FcMKBggOARIJdVHL
     296DGllrjs20ATUgR1HmccBX3EhoMnpMJaNyggmxgLDMz54lBnBTJO/1L1lbMS4
     297l4/V8LDoe90yiWJhOJvIypgEfxdyRThQkBVn/bI=
     298====
     299"
     300SKIP=
     301
    211302
    212303cd .. && rm -rf tar.tempdir || exit 1
Note: See TracChangeset for help on using the changeset viewer.