blob: d71a349102dc35f01c053289caaf268e5e5e0790 [file] [log] [blame]
Denys Vlasenkobf224752009-11-29 19:09:29 +01001#!/bin/sh
2# Copyright 2009 by Denys Vlasenko
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02003# Licensed under GPLv2, see file LICENSE in this source tree.
Denys Vlasenkobf224752009-11-29 19:09:29 +01004
5. ./testing.sh
6
Dan Fandrich775965d2010-08-10 23:33:57 -07007unset LANG
8unset LANGUAGE
9unset LC_COLLATE
10unset LC_ALL
11umask 022
12
Denys Vlasenkobf224752009-11-29 19:09:29 +010013# testing "test name" "script" "expected result" "file input" "stdin"
14
Denys Vlasenko0545e3b2013-11-19 17:17:48 +010015testing "Empty file is not a tarball" '\
16tar xvf - 2>&1; echo $?
17' "\
18tar: short read
191
20" \
21"" ""
22SKIP=
23
Denys Vlasenko0ad872b2016-06-20 01:40:19 +020024optional FEATURE_SEAMLESS_GZ GUNZIP
Denys Vlasenko198b02f2013-12-31 23:22:36 +010025# In NOMMU case, "invalid magic" message comes from gunzip child process.
26# Otherwise, it comes from tar.
27# Need to fix output up to avoid false positive.
Denys Vlasenkodd1d8ab2013-11-19 16:56:26 +010028testing "Empty file is not a tarball.tar.gz" '\
Denys Vlasenko198b02f2013-12-31 23:22:36 +010029{ tar xvzf - 2>&1; echo $?; } | grep -Fv "invalid magic"
Denys Vlasenko1cbc6422013-11-19 14:52:02 +010030' "\
Denys Vlasenko1cbc6422013-11-19 14:52:02 +010031tar: short read
321
33" \
34"" ""
35SKIP=
36
Denys Vlasenko0545e3b2013-11-19 17:17:48 +010037testing "Two zeroed blocks is a ('truncated') empty tarball" '\
Denys Vlasenko76258112013-12-31 23:25:46 +010038dd if=/dev/zero bs=512 count=2 2>/dev/null | tar xvf - 2>&1; echo $?
Denys Vlasenko0545e3b2013-11-19 17:17:48 +010039' "\
400
41" \
42"" ""
43SKIP=
44
45testing "Twenty zeroed blocks is an empty tarball" '\
46dd if=/dev/zero bs=512 count=20 2>/dev/null | tar xvf - 2>&1; echo $?
47' "\
480
49" \
50"" ""
51SKIP=
52
Denys Vlasenkob920a382017-07-24 17:20:13 +020053mkdir tar.tempdir && cd tar.tempdir || exit 1
Denys Vlasenko6c563e32015-10-22 01:07:13 +020054# "tar cf test.tar input input_dir/ input_hard1 input_hard2 input_hard1 input_dir/ input":
55# GNU tar 1.26 records as hardlinks:
56# input_hard2 -> input_hard1
57# input_hard1 -> input_hard1 (!!!)
58# input_dir/file -> input_dir/file
59# input -> input
60# As of 1.24.0, we don't record last two: for them, nlink==1
61# and we check for "hardlink"ness only files with nlink!=1
62# We also don't use "hrw-r--r--" notation for hardlinks in "tar tv" listing.
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020063optional FEATURE_TAR_CREATE FEATURE_LS_SORTFILES
Denys Vlasenko02365a62010-04-09 10:52:52 +020064testing "tar hardlinks and repeated files" '\
Denys Vlasenko425ad9c2009-12-16 22:46:01 +010065>input_hard1
Denys Vlasenkobf224752009-11-29 19:09:29 +010066ln input_hard1 input_hard2
67mkdir input_dir
68>input_dir/file
Denys Vlasenko02365a62010-04-09 10:52:52 +020069chmod -R 644 *
70chmod 755 input_dir
Denys Vlasenkobf224752009-11-29 19:09:29 +010071tar cf test.tar input input_dir/ input_hard1 input_hard2 input_hard1 input_dir/ input
Denys Vlasenko02365a62010-04-09 10:52:52 +020072tar tvf test.tar | sed "s/.*[0-9] input/input/"
Denys Vlasenko6c563e32015-10-22 01:07:13 +020073rm -rf input_dir
Denys Vlasenko02365a62010-04-09 10:52:52 +020074tar xf test.tar 2>&1
75echo Ok: $?
76ls -l . input_dir/* | grep input_ | sed "s/\\(^[^ ]*\\) .* input/\\1 input/"
77' "\
Denys Vlasenko425ad9c2009-12-16 22:46:01 +010078input
Denys Vlasenkobf224752009-11-29 19:09:29 +010079input_dir/
80input_dir/file
81input_hard1
82input_hard2 -> input_hard1
83input_hard1 -> input_hard1
84input_dir/
85input_dir/file
86input
Denys Vlasenko02365a62010-04-09 10:52:52 +020087Ok: 0
88-rw-r--r-- input_dir/file
89drwxr-xr-x input_dir
90-rw-r--r-- input_hard1
91-rw-r--r-- input_hard2
92" \
93"" ""
Denys Vlasenkoe3d90a92010-05-10 05:53:16 +020094SKIP=
Denys Vlasenkob920a382017-07-24 17:20:13 +020095cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
Denys Vlasenko02365a62010-04-09 10:52:52 +020096
Denys Vlasenkob920a382017-07-24 17:20:13 +020097mkdir tar.tempdir && cd tar.tempdir || exit 1
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020098optional FEATURE_TAR_CREATE FEATURE_LS_SORTFILES
Denys Vlasenko02365a62010-04-09 10:52:52 +020099testing "tar hardlinks mode" '\
Denys Vlasenko02365a62010-04-09 10:52:52 +0200100>input_hard1
101chmod 741 input_hard1
102ln input_hard1 input_hard2
103mkdir input_dir
Denys Vlasenko02365a62010-04-09 10:52:52 +0200104ln input_hard1 input_dir
105ln input_hard2 input_dir
Dan Fandricheb2bf5b2010-09-02 18:38:00 -0700106chmod 550 input_dir
Denys Vlasenko0d7cb4c2010-09-03 17:22:56 +0200107# On some filesystems, input_dir/input_hard2 is returned by readdir
108# BEFORE input_dir/input_hard1! Thats why we cant just "tar cf ... input_*":
109tar cf test.tar input_dir/input_hard* input_hard*
Denys Vlasenko02365a62010-04-09 10:52:52 +0200110tar tvf test.tar | sed "s/.*[0-9] input/input/"
Dan Fandricheb2bf5b2010-09-02 18:38:00 -0700111chmod 770 input_dir
112rm -rf input_*
Denys Vlasenko02365a62010-04-09 10:52:52 +0200113tar xf test.tar 2>&1
114echo Ok: $?
Denys Vlasenko0d7cb4c2010-09-03 17:22:56 +0200115ls -l . input_dir/* | grep "input.*hard" | sed "s/\\(^[^ ]*\\) .* input/\\1 input/"
Denys Vlasenko02365a62010-04-09 10:52:52 +0200116' "\
Denys Vlasenko02365a62010-04-09 10:52:52 +0200117input_dir/input_hard1
118input_dir/input_hard2 -> input_dir/input_hard1
119input_hard1 -> input_dir/input_hard1
120input_hard2 -> input_dir/input_hard1
121Ok: 0
122-rwxr----x input_dir/input_hard1
123-rwxr----x input_dir/input_hard2
Denys Vlasenko02365a62010-04-09 10:52:52 +0200124-rwxr----x input_hard1
125-rwxr----x input_hard2
Denys Vlasenkobf224752009-11-29 19:09:29 +0100126" \
127"" ""
Denys Vlasenkoe3d90a92010-05-10 05:53:16 +0200128SKIP=
Denys Vlasenkob920a382017-07-24 17:20:13 +0200129cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
Denys Vlasenkobf224752009-11-29 19:09:29 +0100130
Denys Vlasenkob920a382017-07-24 17:20:13 +0200131mkdir tar.tempdir && cd tar.tempdir || exit 1
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +0200132optional FEATURE_TAR_CREATE FEATURE_LS_SORTFILES
Denys Vlasenkoe69ad872010-04-09 14:11:45 +0200133testing "tar symlinks mode" '\
Denys Vlasenkoe69ad872010-04-09 14:11:45 +0200134>input_file
135chmod 741 input_file
136ln -s input_file input_soft
137mkdir input_dir
Denys Vlasenkoe69ad872010-04-09 14:11:45 +0200138ln input_file input_dir
139ln input_soft input_dir
Dan Fandricheb2bf5b2010-09-02 18:38:00 -0700140chmod 550 input_dir
Dan Fandrich80d80ba2010-09-11 00:28:50 -0700141tar cf test.tar input_dir/* input_[fs]*
Denys Vlasenkoe82cf332010-05-12 15:59:32 +0200142tar tvf test.tar | sed "s/.*[0-9] input/input/" | sort
Dan Fandricheb2bf5b2010-09-02 18:38:00 -0700143chmod 770 input_dir
144rm -rf input_*
Denys Vlasenkoe69ad872010-04-09 14:11:45 +0200145tar xf test.tar 2>&1
146echo Ok: $?
Dan Fandrich80d80ba2010-09-11 00:28:50 -0700147ls -l . input_dir/* | grep "input_[fs]" | sed "s/\\(^[^ ]*\\) .* input/\\1 input/"
Denys Vlasenkoe69ad872010-04-09 14:11:45 +0200148' "\
Denys Vlasenkoe69ad872010-04-09 14:11:45 +0200149input_dir/input_file
150input_dir/input_soft -> input_file
151input_file -> input_dir/input_file
152input_soft -> input_dir/input_soft
153Ok: 0
154-rwxr----x input_dir/input_file
155lrwxrwxrwx input_file
Denys Vlasenkoe69ad872010-04-09 14:11:45 +0200156-rwxr----x input_file
157lrwxrwxrwx input_file
158" \
159"" ""
Denys Vlasenkoe3d90a92010-05-10 05:53:16 +0200160SKIP=
Denys Vlasenkob920a382017-07-24 17:20:13 +0200161cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
Denys Vlasenkoe69ad872010-04-09 14:11:45 +0200162
Denys Vlasenkob920a382017-07-24 17:20:13 +0200163mkdir tar.tempdir && cd tar.tempdir || exit 1
Denys Vlasenkoda138242010-05-11 12:02:48 +0200164optional FEATURE_TAR_CREATE FEATURE_TAR_LONG_OPTIONS
Denys Vlasenko8a936cf2009-12-16 23:18:59 +0100165testing "tar --overwrite" "\
Denys Vlasenko8a936cf2009-12-16 23:18:59 +0100166ln input input_hard
167tar cf test.tar input_hard
168echo WRONG >input
169# --overwrite opens 'input_hard' without unlinking,
170# thus 'input_hard' still linked to 'input' and we write 'Ok' into it
171tar xf test.tar --overwrite 2>&1 && cat input
172" "\
173Ok
174" \
175"Ok\n" ""
Chris Metcalf208d35d2010-04-02 09:57:27 +0200176SKIP=
Denys Vlasenkob920a382017-07-24 17:20:13 +0200177cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
Denys Vlasenko8a936cf2009-12-16 23:18:59 +0100178
Denys Vlasenkob920a382017-07-24 17:20:13 +0200179mkdir tar.tempdir && cd tar.tempdir || exit 1
Dan Fandrich80d80ba2010-09-11 00:28:50 -0700180test x"$SKIP_KNOWN_BUGS" = x"" && {
Dan Fandrich8d789e42010-09-05 16:16:46 +0200181# Needs to be run under non-root for meaningful test
182optional FEATURE_TAR_CREATE
183testing "tar writing into read-only dir" '\
Dan Fandrich8d789e42010-09-05 16:16:46 +0200184mkdir input_dir
185>input_dir/input_file
186chmod 550 input_dir
187tar cf test.tar input_dir
188tar tvf test.tar | sed "s/.*[0-9] input/input/"
189chmod 770 input_dir
190rm -rf input_*
191tar xf test.tar 2>&1
192echo Ok: $?
193ls -l input_dir/* . | grep input_ | sed "s/\\(^[^ ]*\\) .* input/\\1 input/"
194chmod 770 input_dir
195' "\
196input_dir/
197input_dir/input_file
198Ok: 0
199-rw-r--r-- input_dir/input_file
200dr-xr-x--- input_dir
201" \
202"" ""
203SKIP=
Dan Fandrich80d80ba2010-09-11 00:28:50 -0700204}
Denys Vlasenkob920a382017-07-24 17:20:13 +0200205cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
Dan Fandrich80d80ba2010-09-11 00:28:50 -0700206
Denys Vlasenkob920a382017-07-24 17:20:13 +0200207mkdir tar.tempdir && cd tar.tempdir || exit 1
Denys Vlasenkob8ab4b02011-02-06 20:02:15 +0100208# Had a bug where on extract autodetect first "switched off" -z
Denys Vlasenkoaef441c2011-02-06 20:01:11 +0100209# and then failed to recognize .tgz extension
Denys Vlasenkoecf25cb2016-06-20 11:04:04 +0200210optional FEATURE_TAR_CREATE FEATURE_SEAMLESS_GZ GUNZIP
Denys Vlasenkoaef441c2011-02-06 20:01:11 +0100211testing "tar extract tgz" "\
212dd count=1 bs=1M if=/dev/zero of=F0 2>/dev/null
213tar -czf F0.tgz F0
214rm F0
215tar -xzvf F0.tgz && echo Ok
216rm F0 || echo BAD
217" "\
218F0
219Ok
220" \
221"" ""
Denys Vlasenkob47b3ce2011-08-10 00:51:29 +0200222SKIP=
Denys Vlasenkob920a382017-07-24 17:20:13 +0200223cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
Denys Vlasenkoaef441c2011-02-06 20:01:11 +0100224
Denys Vlasenkob920a382017-07-24 17:20:13 +0200225mkdir tar.tempdir && cd tar.tempdir || exit 1
Denys Vlasenkobb8d7db2012-03-06 16:57:01 +0100226# Do we detect XZ-compressed data (even w/o .tar.xz or txz extension)?
227# (the uuencoded hello_world.txz contains one empty file named "hello_world")
228optional UUDECODE FEATURE_TAR_AUTODETECT FEATURE_SEAMLESS_XZ
229testing "tar extract txz" "\
230uudecode -o input && tar tf input && echo Ok
231" "\
232hello_world
233Ok
234" \
235"" "\
236begin-base64 644 hello_world.txz
237/Td6WFoAAATm1rRGAgAhARYAAAB0L+Wj4AX/AEldADQZSe6ODIZQ3rSQ8kAJ
238SnMPTX+XWGKW3Yu/Rwqg4Ik5wqgQKgVH97J8yA8IvZ4ahaCQogUNHRkXibr2
239Q615wcb2G7fJU49AhWAAAAAAUA8gu9DyXfAAAWWADAAAAB5FXGCxxGf7AgAA
240AAAEWVo=
241====
242"
243SKIP=
Denys Vlasenkob920a382017-07-24 17:20:13 +0200244cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
Denys Vlasenkobb8d7db2012-03-06 16:57:01 +0100245
Denys Vlasenkob920a382017-07-24 17:20:13 +0200246mkdir tar.tempdir && cd tar.tempdir || exit 1
Denys Vlasenko5e29e262011-03-01 17:21:07 +0100247# On extract, everything up to and including last ".." component is stripped
Denys Vlasenkob47b3ce2011-08-10 00:51:29 +0200248optional FEATURE_TAR_CREATE
Denys Vlasenko5e29e262011-03-01 17:21:07 +0100249testing "tar strips /../ on extract" "\
250rm -rf input_* test.tar 2>/dev/null
251mkdir input_dir
252echo Ok >input_dir/file
253tar cf test.tar ./../tar.tempdir/input_dir/../input_dir 2>&1
254rm -rf input_* 2>/dev/null
255tar -vxf test.tar 2>&1
256cat input_dir/file 2>&1
257" "\
Denys Vlasenkob80acf52011-03-02 01:21:02 +0100258tar: removing leading './../tar.tempdir/input_dir/../' from member names
Denys Vlasenko5e29e262011-03-01 17:21:07 +0100259input_dir/
260input_dir/file
261Ok
262" \
263"" ""
Denys Vlasenkob47b3ce2011-08-10 00:51:29 +0200264SKIP=
Denys Vlasenkob920a382017-07-24 17:20:13 +0200265cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
Denys Vlasenko5e29e262011-03-01 17:21:07 +0100266
Denys Vlasenkob920a382017-07-24 17:20:13 +0200267mkdir tar.tempdir && cd tar.tempdir || exit 1
Denys Vlasenkoa9607482015-10-22 16:37:01 +0200268# attack.tar.bz2 has symlink pointing to a system file
269# followed by a regular file with the same name
270# containing "root::0:0::/root:/bin/sh":
271# lrwxrwxrwx root/root passwd -> /tmp/passwd
272# -rw-r--r-- root/root passwd
273# naive tar implementation may end up creating the symlink
274# and then writing into it.
275# The correct implementation unlinks target before
276# creating the second file.
277# We test that /tmp/passwd remains empty:
Denys Vlasenkobb0bf282016-06-19 21:54:04 +0200278optional UUDECODE FEATURE_TAR_AUTODETECT FEATURE_SEAMLESS_BZ2
Denys Vlasenkoa9607482015-10-22 16:37:01 +0200279testing "tar does not extract into symlinks" "\
280>>/tmp/passwd && uudecode -o input && tar xf input 2>&1 && rm passwd; cat /tmp/passwd; echo \$?
281" "\
Denys Vlasenkoa84db182018-02-20 15:57:45 +0100282tar: can't create symlink 'passwd' to '/tmp/passwd'
Denys Vlasenkoa9607482015-10-22 16:37:01 +02002830
284" \
285"" "\
286begin-base64 644 attack.tar.bz2
287QlpoOTFBWSZTWRVn/bIAAKt7hMqwAEBAAP2QAhB0Y96AAACACCAAlISgpqe0
288po0DIaDynqAkpDRP1ANAhiYNSPR8VchKhAz0AK59+DA6FcMKBggOARIJdVHL
289DGllrjs20ATUgR1HmccBX3EhoMnpMJaNyggmxgLDMz54lBnBTJO/1L1lbMS4
290l4/V8LDoe90yiWJhOJvIypgEfxdyRThQkBVn/bI=
291====
292"
293SKIP=
Denys Vlasenkob920a382017-07-24 17:20:13 +0200294cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
295
296mkdir tar.tempdir && cd tar.tempdir || exit 1
Denys Vlasenkoa9607482015-10-22 16:37:01 +0200297# And same with -k
Denys Vlasenkobb0bf282016-06-19 21:54:04 +0200298optional UUDECODE FEATURE_TAR_AUTODETECT FEATURE_SEAMLESS_BZ2
Denys Vlasenkoa9607482015-10-22 16:37:01 +0200299testing "tar -k does not extract into symlinks" "\
300>>/tmp/passwd && uudecode -o input && tar xf input -k 2>&1 && rm passwd; cat /tmp/passwd; echo \$?
301" "\
Denys Vlasenkoa84db182018-02-20 15:57:45 +0100302tar: can't create symlink 'passwd' to '/tmp/passwd'
Denys Vlasenkoa9607482015-10-22 16:37:01 +02003030
304" \
305"" "\
306begin-base64 644 attack.tar.bz2
307QlpoOTFBWSZTWRVn/bIAAKt7hMqwAEBAAP2QAhB0Y96AAACACCAAlISgpqe0
308po0DIaDynqAkpDRP1ANAhiYNSPR8VchKhAz0AK59+DA6FcMKBggOARIJdVHL
309DGllrjs20ATUgR1HmccBX3EhoMnpMJaNyggmxgLDMz54lBnBTJO/1L1lbMS4
310l4/V8LDoe90yiWJhOJvIypgEfxdyRThQkBVn/bI=
311====
312"
313SKIP=
Denys Vlasenkob920a382017-07-24 17:20:13 +0200314cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
Denys Vlasenkoa9607482015-10-22 16:37:01 +0200315
Denys Vlasenkob920a382017-07-24 17:20:13 +0200316mkdir tar.tempdir && cd tar.tempdir || exit 1
Denys Vlasenkodf25df72016-12-12 14:33:53 +0100317optional UNICODE_SUPPORT FEATURE_TAR_GNU_EXTENSIONS FEATURE_SEAMLESS_BZ2 FEATURE_TAR_AUTODETECT
Denys Vlasenko9655f952016-11-11 17:56:45 +0100318testing "Pax-encoded UTF8 names and symlinks" '\
319tar xvf ../tar.utf8.tar.bz2 2>&1; echo $?
320export LANG=en_US.UTF-8
Denys Vlasenko76de3252016-12-12 19:17:12 +0100321ls -l etc/ssl/certs/* | sed "s:.*etc/:etc/:" | sort
Denys Vlasenko9655f952016-11-11 17:56:45 +0100322unset LANG
323rm -rf etc usr
324' "\
325etc/ssl/certs/3b2716e5.0
326etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
327etc/ssl/certs/f80cc7f6.0
328usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.crt
3290
330etc/ssl/certs/3b2716e5.0 -> EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
Denys Vlasenkoa84db182018-02-20 15:57:45 +0100331etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem -> /usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.crt
Denys Vlasenko9655f952016-11-11 17:56:45 +0100332etc/ssl/certs/f80cc7f6.0 -> EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
333" \
334"" ""
335SKIP=
Denys Vlasenkob920a382017-07-24 17:20:13 +0200336cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
Denys Vlasenko9655f952016-11-11 17:56:45 +0100337
Denys Vlasenkob920a382017-07-24 17:20:13 +0200338mkdir tar.tempdir && cd tar.tempdir || exit 1
Denys Vlasenko57388232018-06-27 10:01:49 +0200339optional FEATURE_SEAMLESS_BZ2 FEATURE_TAR_AUTODETECT LS
Denys Vlasenkob920a382017-07-24 17:20:13 +0200340testing "Symlink attack: create symlink and then write through it" '\
341exec 2>&1
342uudecode -o input && tar xvf input; echo $?
343ls /tmp/bb_test_evilfile
344ls bb_test_evilfile
345ls symlink/bb_test_evilfile
346' "\
347anything.txt
348symlink
349symlink/bb_test_evilfile
Denys Vlasenkoa84db182018-02-20 15:57:45 +0100350tar: can't create symlink 'symlink' to '/tmp'
3511
Denys Vlasenkob920a382017-07-24 17:20:13 +0200352ls: /tmp/bb_test_evilfile: No such file or directory
353ls: bb_test_evilfile: No such file or directory
354symlink/bb_test_evilfile
355" \
356"" "\
357begin-base64 644 tar_symlink_attack.tar.bz2
358QlpoOTFBWSZTWZgs7bQAALT/hMmQAFBAAf+AEMAGJPPv32AAAIAIMAC5thlR
359omAjAmCMADQT1BqNE0AEwAAjAEwElTKeo9NTR6h6gaeoA0DQNLVdwZZ5iNTk
360AQwCAV6S00QFJYhrlfFkVCEDEGtgNVqYrI0uK3ggnt30gqk4e1TTQm5QIAKa
361SJqzRGSFLMmOloHSAcvLiFxxRiQtQZF+qPxbo173ZDISOAoNoPN4PQPhBhKS
362n8fYaKlioCTzL2oXYczyUUIP4u5IpwoSEwWdtoA=
363====
364"
365SKIP=
366cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
Denys Vlasenkobf224752009-11-29 19:09:29 +0100367
Harald van Dijk8c24af92018-05-22 17:34:31 +0200368mkdir tar.tempdir && cd tar.tempdir || exit 1
Denys Vlasenko332a1912018-06-27 14:35:56 +0200369optional FEATURE_TAR_CREATE
Harald van Dijk8c24af92018-05-22 17:34:31 +0200370testing "Symlinks and hardlinks coexist" '\
371mkdir dir
372>dir/a
373ln -s ../dir/a dir/b
374ln dir/b dir/c
375mkdir new
376tar cf - dir/* | tar -C new -xvf - 2>&1
377' "\
378dir/a
379dir/b
380dir/c
381" \
382"" ""
Denys Vlasenko332a1912018-06-27 14:35:56 +0200383SKIP=
Harald van Dijk8c24af92018-05-22 17:34:31 +0200384cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
385
Denys Vlasenkobf224752009-11-29 19:09:29 +0100386exit $FAILCOUNT