Lines Matching +full:- +full:- +full:dir

3 [ -f testing.sh ] && . testing.sh
10 TAR='tar c --owner root --group sys --mtime @1234567890'
23 # minimum) so look at first N 512-byte frames when analyzing header content.
24 tee save.dat | head -c $(($1*512)) | sha1sum | sed "s/ .*//"
38 "-rw-rw-r-- root/sys 0 2009-02-13 23:31 file\n" "" ""
40 # Two files from -T list
42 testing "-T newline" "$TAR -T input | LST" \
43 …"-rw-rw-r-- root/sys 0 2009-02-13 23:31 file1\n-rw-rw-r-- root/sys 0 2009-02-13 23:31 file2\n" "fi…
44 testing "-T null" "$TAR --null -T input | LST" \
45 …"-rw-rw-r-- root/sys 0 2009-02-13 23:31 file1\n-rw-rw-r-- root/sys 0 2009-02-13 23:31 file2\n" "fi…
50 # Note: testing both "tar c" and "tar -c" here.
51 testing "specify UID, fetch GID" "tar -c --owner nobody:65534 --mtime @0 file | LST" \
52 "-rw-rw-r-- nobody/$(stat -c %G file) 0 1970-01-01 00:00 file\n" "" ""
53 testing "fetch UID, specify GID" "tar c --group nobody:65534 --mtime @0 file | LST" \
54 "-rw-rw-r-- $(stat -c %U file)/nobody 0 1970-01-01 00:00 file\n" "" ""
57 testing "huge values" "tar c --owner 9999999 --group 8888888 --mtime @0 file | SUM 3" \
63 touch -t 198701231234.56 file
65 "tar c --owner root --group sys file | LST --full-time" \
66 "-rw-rw-r-- root/sys 0 1987-01-23 12:34:56 file\n" "" ""
69 "tar c --owner root --group sys --mode a+x file | LST --full-time" \
70 "-rwxrwxr-x root/sys 0 1987-01-23 12:34:56 file\n" "" ""
72 mkdir dir
73 testing "store dir" "$TAR dir | SUM 3" \
75 testing "pass dir" "$TAR dir | LST" \
76 "drwxrwxr-x root/sys 0 2009-02-13 23:31 dir/\n" "" ""
78 # note: does _not_ include dir entry in archive, just file
79 touch dir/file
80 testing "store file in dir" "$TAR dir/file | SUM 3" \
84 testing "store dir and dir/file" "$TAR dir | SUM 3" \
87 testing "pass dir/file" "$TAR dir | LST" \
88 …"drwxrwxr-x root/sys 0 2009-02-13 23:31 dir/\n-rw-rw-r-- root/sys 0 2009-02-13 23:31 dir/file\n" "…
90 echo boing > dir/that
91 testing "tar C" "$TAR -C dir that | SUM 3" \
94 ln dir/file dir/hardlink
95 testing "store hardlink" "$TAR dir/file dir/hardlink | SUM 3" \
98 skipnot mkfifo dir/fifo 2>/dev/null
99 testing "create dir/fifo" "$TAR dir/fifo | SUM 3" \
105 touch dir/${LONG:1:96} dir/${LONG:1:97}
106 testing "create long fname" "$TAR dir/${LONG:1:97} dir/${LONG:1:96} | SUM 3" \
113 ln -s ../name.././.. dir/link
114 testing "create symlink" "$TAR dir/link | SUM 3" \
117 ln dir/link dir/hlink
118 testing "create hardlink to symlink" "$TAR dir/link dir/hlink | SUM 3" \
121 ln -s dir/${LONG:1:96} dir/lshort
122 ln -s dir/${LONG:1:97} dir/llong
123 testing "create long symlink" "$TAR dir/lshort dir/llong | SUM 3" \
126 skipnot ln -s $LONG dir/${LONG:5} 2>/dev/null
127 testing "create long->long" "$TAR dir/${LONG:5} | SUM 7" \
131 ln -s file dir/linkok
132 testing "create symlink" "$TAR dir/linkok | SUM 3" \
138 [ "$(uname)" == "Darwin" ] && symlink_perms=lrwxrwxr-x
140 ln -s /dev/null dir/linknull
141 testing "pass absolute symlink" "$TAR dir/linknull | LST" \
142 "$symlink_perms root/sys 0 2009-02-13 23:31 dir/linknull -> /dev/null\n" "" ""
144 ln -s rel/broken dir/relbrok
145 testing "pass broken symlink" "$TAR dir/relbrok | LST" \
146 "$symlink_perms root/sys 0 2009-02-13 23:31 dir/relbrok -> rel/broken\n" "" ""
148 ln -s /does/not/exist dir/linkabsbrok
149 testing "pass broken absolute symlink" "$TAR dir/linkabsbrok | LST" \
150 "$symlink_perms root/sys 0 2009-02-13 23:31 dir/linkabsbrok -> /does/not/exist\n" \
157 "tar c --mtime @0 /dev/null 2>/dev/null | LST" \
158 "crw-rw-rw- $(stat -c %U/%G /dev/null) $nulldev 1970-01-01 00:00 dev/null\n" \
160 testing "--absolute-names" \
161 "tar c --mtime @0 --absolute-names /dev/null 2>/dev/null | LST" \
162 "crw-rw-rw- $(stat -c %U/%G /dev/null) $nulldev 1970-01-01 00:00 /dev/null\n"\
166 testing "autodetect gzip" 'LST -f "$FILES"/tar/tar.tgz' \
167 "drwxr-x--- enh/eng 0 2017-05-13 01:05 dir/\n-rw-r----- enh/eng 12 2017-05-13 01:05 dir/file\n" \
170 testing "manually specify bz2" 'LST -jf "$FILES"/tar/tar.tbz2' \
171 "drwxr-x--- enh/eng 0 2017-05-13 01:05 dir/\n-rw-r----- enh/eng 12 2017-05-13 01:05 dir/file\n" \
174 # -I
175 testing "-I gzip c" "$TAR -Igzip file | file - | grep -o 'gzip compressed'" \
177 testing "-I gzip t" 'LST -Igzip -f "$FILES"/tar/tar.tgz' \
178 "drwxr-x--- enh/eng 0 2017-05-13 01:05 dir/\n-rw-r----- enh/eng 12 2017-05-13 01:05 dir/file\n" \
181 skipnot mknod -m 660 dir/char c 12 34 2>/dev/null && chgrp sys dir/char
182 …ing "character special" "tar --mtime @0 -cf test.tar dir/char && rm -f dir/char && tar xf test.tar…
183 "crw-rw---- 1 root sys 12, 34 1970-01-01 00:00:00.000000000 +0000 dir/char\n"\
186 skipnot mknod -m 660 dir/block b 23 45 2>/dev/null && chgrp sys dir/block
187 …esting "block special" "tar --mtime @0 -cf test.tar dir/block && rm -f dir/block && tar xf test.ta…
188 "brw-rw---- 1 root sys 23, 45 1970-01-01 00:00:00.000000000 +0000 dir/block\n"\
191 skipnot chown nobody:nogroup dir/file 2>/dev/null
192 testing "ownership" "$TAR dir/file | SUM 3" \
195 mkdir -p dd/sub/blah &&
197 rm -rf dd/sub &&
198 skipnot ln -s ../.. dd/sub
200 "tar xf test.tar 2> /dev/null || echo yes ; [ ! -e dd/sub/blah ] && echo yes" \
205 testing "extract dir/file from tar" \
206 "tar xvCf dd $FILES/tar/tar.tar && stat -c '%A %Y %n' dd/dir dd/dir/file" \
207 "dir/\ndir/file\ndrwxr-x--- 1494637555 dd/dir\n-rw-r----- 1494637555 dd/dir/file\n" \
210 testing "extract dir/file from tgz (autodetect)" \
211 "tar xvCf dd $FILES/tar/tar.tgz && stat -c '%A %Y %n' dd/dir dd/dir/file" \
212 "dir/\ndir/file\ndrwxr-x--- 1494637555 dd/dir\n-rw-r----- 1494637555 dd/dir/file\n" \
215 toyonly testing "cat tgz | extract dir/file (autodetect)" \
216 "cat $FILES/tar/tar.tgz | tar xvC dd && stat -c '%A %Y %n' dd/dir dd/dir/file" \
217 "dir/\ndir/file\ndrwxr-x--- 1494637555 dd/dir\n-rw-r----- 1494637555 dd/dir/file\n" \
220 testing "extract dir/file from tbz2 (autodetect)" \
221 "tar xvCf dd $FILES/tar/tar.tbz2 && stat -c '%A %Y %n' dd/dir dd/dir/file" \
222 "dir/\ndir/file\ndrwxr-x--- 1494637555 dd/dir\n-rw-r----- 1494637555 dd/dir/file\n" \
225 toyonly testing "cat tbz | extract dir/file (autodetect)" \
226 "cat $FILES/tar/tar.tbz2 | tar xvC dd && stat -c '%A %Y %n' dd/dir dd/dir/file" \
227 "dir/\ndir/file\ndrwxr-x--- 1494637555 dd/dir\n-rw-r----- 1494637555 dd/dir/file\n" \
230 mkdir path && ln -s "$(which gzip)" "$(which tar)" path/ && [ -x path/gzip ] ||
232 toyonly testing "autodetect falls back to gzip -d when no zcat" \
233 "PATH=path; tar tf $FILES/tar/tar.tgz" "dir/\ndir/file\n" "" ""
234 rm -rf path
239 [ $(du blah.img | sed 's/[ \t].*//') -ne 4 ] && SKIP=999
240 rm -f blah.img
243 yes | head -n $((1<<18)) > bang
249 testing "sparse without overflow" "$TAR --sparse fweep | SUM 3" \
257 testing "sparse single overflow" "$TAR --sparse fweep | SUM 6" \
266 truncate -s 20m fweep2
267 testing "sparse double overflow" "$TAR --sparse fweep | SUM 7" \
270 tar c --sparse fweep > fweep.tar
272 testing "sparse extract" "tar xf fweep.tar && $TAR --sparse fweep | SUM 4" \
275 "tar tvf fweep.tar | grep -wq 13172736 && echo right size" "right size\n" \
279 tar c --sparse fweep2 > fweep2.tar
282 "tar xf fweep2.tar && $TAR --sparse fweep2 | SUM 4" \
287 'xf "$FILES"/tar/oldsparse.tgz && sha1sum hello-sparse.c | head -c 12' \
289 rm -f hello-sparse.c
293 mkdir -p links
297 testcmd 'links' '-cf test.tar links' '' '' ''
298 rm -rf links
302 testcmd 'links2' '-cf test.tar links' '' '' ''
303 rm -rf links
305 install -m 000 -d folder/skip/oof &&
306 testcmd 'exclude' '--exclude skip -cvf tar.tar folder && echo yes' \
308 rm -rf folder tar.tar
310 mkdir -p one/two; echo hello > one/two/three; tar czf test.tar one/two/three
312 testcmd 'replace dir with file' '-xf test.tar && cat one/two/three' \
314 rm -rf one test.tar
321 "drwxrwxr-x root/sys 0 2009-02-13 23:31 ..dotsdir/\n" "" ""
324 mkdir -p one/two/three/four/five
326 testing "--strip" "$TAR one | tar t --strip=2 --show-transformed | grep six" \
329 # toybox tar --xform depends on toybox sed
330 [ -z "$TEST_HOST" ] && ! sed --tarxform '' </dev/null 2>/dev/null && SKIP=99
333 ln -s tres uno/dos
336 LL() { LST --show-transformed-names $XX | sed 's/^.* 23:31 //'; }
337 TT() { $TAR --no-recursion uno uno/{dos,tres,quatro} "$@" | LL; }
339 "TT --xform 's/uno/one/S;s/dos/two/S;s/tres/three/S;s/quatro/four/S'" \
340 "one/\none/two -> tres\none/three\none/four link to one/three\n" "" ""
343 "TT --xform 's/uno/one/;flags=rh;s/dos/two/;s/tres/three/;s/quatro/four/'" \
344 "one/\none/two -> tres\none/three\none/four link to one/three\n" "" ""
347 "TT --xform 's/uno/one/;flags=rHhsS;s/dos/two/;s/tres/three/;s/quatro/four/'"\
348 "one/\none/two -> tres\none/three\none/four link to one/three\n" "" ""
351 "TT --xform 'flags=s;flags=rh;s/uno/one/;s/dos/two/;s/tres/three/;s/quatro/four/'" \
352 "one/\none/two -> tres\none/three\none/four link to one/three\n" "" ""
355 "TT --xform 'flags=rsH;s/uno/one/;s/dos/two/;s/tres/three/;s/quatro/four/'" \
356 "one/\none/two -> three\none/three\none/four link to uno/tres\n" "" ""
359 "TT --xform 'flags=rshR;s/uno/one/;s/dos/two/;s/tres/three/;s/quatro/four/'" \
360 "uno/\nuno/dos -> three\nuno/tres\nuno/quatro link to one/three\n" "" ""
362 testing "xform path" "$TAR one --xform=s@three/four/@zero@ | tar t | grep six" \
366 "$TAR --xform 's#^.+/##x' one/two/three/four/five | tar t" 'five/\nsix\n' '' ''
370 "XX='--xform s/uno/one/;s/dos/two/;s/tres/three/;s/quatro/four/' TT" \
371 'one/\none/two -> three\none/three\none/four link to one/three\n' '' ''
374 "XX='--xform s/uno/one/S;s/dos/two/S;s/tres/three/S;s/quatro/four/S' TT" \
375 "one/\none/two -> tres\none/three\none/four link to one/three\n" "" ""
378 "XX='--xform flags=rs;s/uno/one/;s/dos/two/;s/tres/three/;s/quatro/four/' TT"\
379 "one/\none/two -> three\none/three\none/four link to uno/tres\n" "" ""
382 "XX='--xform flags=sh;s/uno/one/;s/dos/two/;s/tres/three/;s/quatro/four/' TT"\
383 "uno/\nuno/dos -> three\nuno/tres\nuno/quatro link to one/three\n" "" ""
385 rm -rf uno
387 rm -rf one
389 testing '-P' "$TAR -P --no-recursion -C / /// .. | SUM 3" \
392 testing 'without -P' "$TAR --no-recursion -C / /// .. 2>/dev/null | SUM 3" \
395 # Wildcards: --exclude, include (create/extract * cmdline/recursive)
396 # --anchored, --wildcards, --wildcards-match-slash
397 # --no-* versions of each. Span coverage, switching on/off...
403 mkdir sub && cd sub && mkdir -p a da top/a top/da &&
405 $TAR -f ../sub.tar abcd dabc a da top && cd .. || exit 1
410 '$TAR -C sub --wildcards a.cd abcd dabc a da top 2>/dev/null | cmp - sub.tar' \
413 testing 'creation --exclude --no-wildcards'\
414 '$TAR -C sub --no-wildcards --exclude=d?bc abcd dabc | LL' \
418 testing 'creation --wildcards --exclude'\
419 '$TAR -C sub --wildcards --exclude=d?bc abcd dabc | LL' \
425 testing 'tsort' '$TAR -c sub2 --sort=name | tar t' \
432 skipnot [ $(id -u) -ne 0 ] # Root defaults to -p
434 'umask 0022 && rm -rf dir && mkdir dir && tar xf $FILES/tar/dir.tar && stat -c%A dir dir/file' \
435 'drwxr-xr-x\n-rwxr-xr-x\n' '' ''
437 …'umask 0022 && rm -rf dir && mkdir dir && umask 0 && tar xf $FILES/tar/dir.tar && stat -c%A dir di…
438 'drwxrwxrwx\n-rwxrwxrwx\n' '' ''
439 testing '-p overrides umask' \
440 'umask 0022 && rm -rf dir && mkdir dir && tar xpf $FILES/tar/dir.tar && stat -c%A dir dir/file' \
441 'drwxrwxrwx\n-rwxrwxrwx\n' '' ''
446 testing "what order are --xform, --strip, and --exclude processed in?"
447 testing "--xform vs ../ removal and adding / to dirs"
449 chmod 700 dir
450 tar cpf tar.tgz dir/file
451 #chmod 700 dir
453 #ls -ld dir/file
455 # restore ownership of file, dir, and symlink
461 # exclusion defaults to --no-anchored and --wildcards-match-slash
465 # add dir with no trailing slash
467 # extract dir/file without dir in tarball
469 # --owner --group --numeric-owner
471 # --owner 0 --group 0
475 # // exclusion defaults to --no-anchored and --wildcards-match-slash
477 # tar tv --owner --group --mtime
478 # extract file within dir date correct
484 rm -f save.dat