2 # Copyright 2009 by Denys Vlasenko
3 # Licensed under GPL v2, see file LICENSE for details.
7 mkdir tempdir && cd tempdir || exit 1
9 # testing "test name" "script" "expected result" "file input" "stdin"
11 testing "tar hardlinks and repeated files" "\
12 rm -rf input_* test.tar 2>/dev/null
14 ln input_hard1 input_hard2
17 tar cf test.tar input input_dir/ input_hard1 input_hard2 input_hard1 input_dir/ input
18 tar tvf test.tar | sed 's/.*[0-9] input/input/'
19 tar xf test.tar 2>&1 && echo Ok
25 input_hard2 -> input_hard1
26 input_hard1 -> input_hard1
34 optional FEATURE_TAR_LONG_OPTIONS
35 testing "tar --overwrite" "\
36 rm -rf input_* test.tar 2>/dev/null
38 tar cf test.tar input_hard
40 # --overwrite opens 'input_hard' without unlinking,
41 # thus 'input_hard' still linked to 'input' and we write 'Ok' into it
42 tar xf test.tar --overwrite 2>&1 && cat input
49 cd .. && rm -rf tempdir || exit 1