Merge r709,r710 from libarchive.googlecode.com: More work on

Windows support.
This commit is contained in:
Tim Kientzle 2009-03-08 06:07:35 +00:00
parent 36002e92e9
commit 66c8431841
3 changed files with 780 additions and 32 deletions

View File

@ -1,4 +1,5 @@
/*-
* Copyright (c) 2009 Michihiro NAKAJIMA
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
@ -30,6 +31,7 @@ DEFINE_TEST(test_patterns)
int fd, r;
const char *reffile2 = "test_patterns_2.tar";
const char *reffile3 = "test_patterns_3.tar";
const char *reffile4 = "test_patterns_4.tar";
const char *p;
/*
@ -101,4 +103,81 @@ DEFINE_TEST(test_patterns)
assertEmptyFile("tar3d.out");
assertEmptyFile("tar3d.err");
assertEqualInt(0, access("tmp/foo/baz/bar", F_OK));
/*
* Test 4 archive has some entries starting with windows drive letters
* such as 'c:\', '//./c:/' or '//?/c:/'.
*/
extract_reference_file(reffile4);
r = systemf("%s xf %s -C tmp > tar4.out 2> tar4.err",
testprog, reffile4);
assert(r != 0);
assertEmptyFile("tar4.out");
assertNonEmptyFile("tar4.err");
for (r = 1; r <= 54; r++) {
char file_a[] = "tmp/fileXX";
char file_b1[] = "tmp/server/share/fileXX";
char file_b2[] = "tmp/server\\share\\fileXX";
char file_c[] = "tmp/../fileXX";
char *filex;
int xsize;
switch (r) {
case 15: case 18:
/*
* Including server and share names.
* //?/UNC/server/share/file15
* //?/unc/server/share/file18
*/
filex = file_b1;
xsize = sizeof(file_b1);
break;
case 35: case 38: case 52:
/*
* Including server and share names.
* \\?\UNC\server\share\file35
* \\?\unc\server\share\file38
* \/?/uNc/server\share\file52
*/
filex = file_b2;
xsize = sizeof(file_b2);
break;
default:
filex = file_a;
xsize = sizeof(file_a);
break;
}
filex[xsize-3] = '0' + r / 10;
filex[xsize-2] = '0' + r % 10;
switch (r) {
case 5: case 6: case 17: case 20: case 25:
case 26: case 37: case 40: case 43: case 54:
/*
* Not extracted patterns.
* D:../file05
* c:../../file06
* //?/UNC/../file17
* //?/unc/../file20
* z:..\file25
* c:..\..\file26
* \\?\UNC\..\file37
* \\?\unc\..\file40
* c:../..\file43
* \/?\UnC\../file54
*/
assertEqualInt(-1, access(filex, F_OK));
filex = file_c;
xsize = sizeof(file_c);
filex[xsize-3] = '0' + r / 10;
filex[xsize-2] = '0' + r % 10;
assertEqualInt(-1, access(filex, F_OK));
break;
default:
/* Extracted patterns. */
assertEqualInt(0, access(filex, F_OK));
break;
}
}
}

View File

@ -0,0 +1,642 @@
$FreeBSD$
begin 644 test_patterns_4.tar
M+V9I;&4P,0``````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@`#`P,#`P,#`P,#`P
M(#$Q,34P-C<T-C0R(#`Q,#,S-@`@,```````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````!U<W1A<@`P,```````
M````````````````````````````````````````````````````````````
M```````````````````P,#`P,#`@`#`P,#`P,"``````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````````````````````O+BXO9FEL93`R````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````,#`P-C0T(``P,#$W-3$@`#`P
M,3<U,2``,#`P,#`P,#`P,#`@,3$Q-3`V-S0V-#(@,#$P-34R`"`P````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````'5S=&%R`#`P````````````````````````````````````````````
M`````````````````````````````````````````#`P,#`P,"``,#`P,#`P
M(```````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````"\N+B\N+B]F:6QE
M,#,`````````````````````````````````````````````````````````
M```````````````````````````````````````````````````````````P
M,#`V-#0@`#`P,3<U,2``,#`Q-S4Q(``P,#`P,#`P,#`P,"`Q,3$U,#8W-#8T
M,B`P,3`W-C8`(#``````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````=7-T87(`,#``````````````````````
M````````````````````````````````````````````````````````````
M````,#`P,#`P(``P,#`P,#`@````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````8SHO9FEL93`T````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@`#`P,#`P
M,#`P,#`P(#$Q,34P-C<T-C0R(#`Q,#4W-@`@,```````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````````````!U<W1A<@`P
M,```````````````````````````````````````````````````````````
M```````````````````````````P,#`P,#`@`#`P,#`P,"``````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````!$.BXN+V9I;&4P-0``````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````,#`P-C0T(``P,#$W
M-3$@`#`P,3<U,2``,#`P,#`P,#`P,#`@,3$Q-3`V-S0V-#(@,#$P-C<T`"`P
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````'5S=&%R`#`P````````````````````````````````````
M`````````````````````````````````````````````````#`P,#`P,"``
M,#`P,#`P(```````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````&,Z+BXO
M+BXO9FEL93`V````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````P,#`V-#0@`#`P,3<U,2``,#`Q-S4Q(``P,#`P,#`P,#`P,"`Q,3$U
M,#8W-#8T,B`P,3$Q-#<`(#``````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````=7-T87(`,#``````````````
M````````````````````````````````````````````````````````````
M````````````,#`P,#`P(``P,#`P,#`@````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````0SHO+BXO9FEL93`W````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@
M`#`P,#`P,#`P,#`P(#$Q,34P-C<T-C0R(#`Q,#<U-``@,```````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````````````````````!U
M<W1A<@`P,```````````````````````````````````````````````````
M```````````````````````````````````P,#`P,#`@`#`P,#`P,"``````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````!A.B\N+B\N+B]F:6QE,#@`
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````,#`P-C0T
M(``P,#$W-3$@`#`P,3<U,2``,#`P,#`P,#`P,#`@,3$Q-3`V-S0V-#(@,#$Q
M,C(V`"`P````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````'5S=&%R`#`P````````````````````````````
M`````````````````````````````````````````````````````````#`P
M,#`P,"``,#`P,#`P(```````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`"\O+B]C.B]F:6QE,#D`````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````````````P,#`V-#0@`#`P,3<U,2``,#`Q-S4Q(``P,#`P,#`P,#`P
M,"`Q,3$U,#8W-#8T,B`P,3$P-S8`(#``````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````=7-T87(`,#``````
M````````````````````````````````````````````````````````````
M````````````````````,#`P,#`P(``P,#`P,#`@````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````+R\N+T,Z+RXN+V9I;&4Q,```````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````#`P,#8T-"``,#`Q-S4Q(``P
M,#$W-3$@`#`P,#`P,#`P,#`P(#$Q,34P-C<T-C0R(#`Q,3(T,0`@,```````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````!U<W1A<@`P,```````````````````````````````````````````
M```````````````````````````````````````````P,#`P,#`@`#`P,#`P
M,"``````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````````````````````````````````````````````O+S\O8SHO9FEL
M93$Q````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M,#`P-C0T(``P,#$W-3$@`#`P,3<U,2``,#`P,#`P,#`P,#`@,3$Q-3`V-S0V
M-#(@,#$Q,3$P`"`P````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````'5S=&%R`#`P````````````````````
M````````````````````````````````````````````````````````````
M`````#`P,#`P,"``,#`P,#`P(```````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````"\O/R]#.B\N+B]F:6QE,3(`````````````````````````````
M````````````````````````````````````````````````````````````
M```````````````````````P,#`V-#0@`#`P,3<U,2``,#`Q-S4Q(``P,#`P
M,#`P,#`P,"`Q,3$U,#8W-#8T,B`P,3$R-C0`(#``````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````=7-T87(`
M,#``````````````````````````````````````````````````````````
M````````````````````````````,#`P,#`P(``P,#`P,#`@````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````+R\O+V,Z+V9I;&4Q,P``````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````#`P,#8T-"``,#`Q
M-S4Q(``P,#$W-3$@`#`P,#`P,#`P,#`P(#$Q,34P-C<T-C0R(#`Q,3`W,@`@
M,```````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````!U<W1A<@`P,```````````````````````````````````
M```````````````````````````````````````````````````P,#`P,#`@
M`#`P,#`P,"``````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````````````````````````````````````````````````````O+R\O
M0SHO+R\O+V9I;&4Q-```````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````,#`P-C0T(``P,#$W-3$@`#`P,3<U,2``,#`P,#`P,#`P,#`@,3$Q
M-3`V-S0V-#(@,#$Q,S(W`"`P````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````'5S=&%R`#`P````````````
M````````````````````````````````````````````````````````````
M`````````````#`P,#`P,"``,#`P,#`P(```````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````"\O/R]53D,O<V5R=F5R+W-H87)E+V9I;&4Q-0``````
M````````````````````````````````````````````````````````````
M```````````````````````````````P,#`V-#0@`#`P,3<U,2``,#`Q-S4Q
M(``P,#`P,#`P,#`P,"`Q,3$U,#8W-#8T,B`P,3,V,S4`(#``````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M=7-T87(`,#``````````````````````````````````````````````````
M````````````````````````````````````,#`P,#`P(``P,#`P,#`@````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````+R\_+U5.0R]F:6QE,38`
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````#`P,#8T
M-"``,#`Q-S4Q(``P,#$W-3$@`#`P,#`P,#`P,#`P(#$Q,34P-C<T-C0R(#`Q
M,3(R-@`@,```````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````!U<W1A<@`P,```````````````````````````
M```````````````````````````````````````````````````````````P
M,#`P,#`@`#`P,#`P,"``````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```O+S\O54Y#+RXN+V9I;&4Q-P``````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````,#`P-C0T(``P,#$W-3$@`#`P,3<U,2``,#`P,#`P,#`P
M,#`@,3$Q-3`V-S0V-#(@,#$Q-#0R`"`P````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````'5S=&%R`#`P````
M````````````````````````````````````````````````````````````
M`````````````````````#`P,#`P,"``,#`P,#`P(```````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````"\O/R]U;F,O<V5R=F5R+W-H87)E+V9I;&4Q
M.```````````````````````````````````````````````````````````
M```````````````````````````````````````P,#`V-#0@`#`P,3<U,2``
M,#`Q-S4Q(``P,#`P,#`P,#`P,"`Q,3$U,#8W-#8T,B`P,30P,#``(#``````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````=7-T87(`,#``````````````````````````````````````````
M````````````````````````````````````````````,#`P,#`P(``P,#`P
M,#`@````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````+R\_+W5N8R]F
M:6QE,3D`````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@`#`P,#`P,#`P,#`P(#$Q,34P-C<T
M-C0R(#`Q,3,W,0`@,```````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````!U<W1A<@`P,```````````````````
M````````````````````````````````````````````````````````````
M```````P,#`P,#`@`#`P,#`P,"``````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````````O+S\O=6YC+RXN+V9I;&4R,```````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````,#`P-C0T(``P,#$W-3$@`#`P,3<U,2``,#`P
M,#`P,#`P,#`@,3$Q-3`V-S0V-#(@,#$Q-3<T`"`P````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````'5S=&%R
M`#`P````````````````````````````````````````````````````````
M`````````````````````````````#`P,#`P,"``,#`P,#`P(```````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````%QF:6QE,C$`````````````````
M````````````````````````````````````````````````````````````
M```````````````````````````````````````````````P,#`V-#0@`#`P
M,3<U,2``,#`Q-S4Q(``P,#`P,#`P,#`P,"`Q,3$U,#8W-#8T,B`P,3`T,34`
M(#``````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````=7-T87(`,#``````````````````````````````````
M````````````````````````````````````````````````````,#`P,#`P
M(``P,#`P,#`@````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````7"XN
M7&9I;&4R,@``````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@`#`P,#`P,#`P,#`P(#$Q
M,34P-C<T-C0R(#`Q,#<P-@`@,```````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````!U<W1A<@`P,```````````
M````````````````````````````````````````````````````````````
M```````````````P,#`P,#`@`#`P,#`P,"``````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````!<+BY<+BY<9FEL93(S````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````,#`P-C0T(``P,#$W-3$@`#`P,3<U
M,2``,#`P,#`P,#`P,#`@,3$Q-3`V-S0V-#(@,#$Q,3<W`"`P````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`'5S=&%R`#`P````````````````````````````````````````````````
M`````````````````````````````````````#`P,#`P,"``,#`P,#`P(```
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````$,Z7&9I;&4R-```````
M````````````````````````````````````````````````````````````
M```````````````````````````````````````````````````````P,#`V
M-#0@`#`P,3<U,2``,#`Q-S4Q(``P,#`P,#`P,#`P,"`Q,3$U,#8W-#8T,B`P
M,3`V,34`(#``````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````=7-T87(`,#``````````````````````````
M````````````````````````````````````````````````````````````
M,#`P,#`P(``P,#`P,#`@````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````>CHN+EQF:6QE,C4`````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@`#`P,#`P,#`P
M,#`P(#$Q,34P-C<T-C0R(#`Q,3`T,0`@,```````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````````!U<W1A<@`P,```
M````````````````````````````````````````````````````````````
M```````````````````````P,#`P,#`@`#`P,#`P,"``````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````!C.BXN7"XN7&9I;&4R-@``````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````,#`P-C0T(``P,#$W-3$@
M`#`P,3<U,2``,#`P,#`P,#`P,#`@,3$Q-3`V-S0V-#(@,#$Q,S`S`"`P````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````'5S=&%R`#`P````````````````````````````````````````
M`````````````````````````````````````````````#`P,#`P,"``,#`P
M,#`P(```````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````%HZ7"XN7&9I
M;&4R-P``````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```P,#`V-#0@`#`P,3<U,2``,#`Q-S4Q(``P,#`P,#`P,#`P,"`Q,3$U,#8W
M-#8T,B`P,3$Q,S<`(#``````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````=7-T87(`,#``````````````````
M````````````````````````````````````````````````````````````
M````````,#`P,#`P(``P,#`P,#`@````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````0SI<+BY<+BY<9FEL93(X````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@`#`P
M,#`P,#`P,#`P(#$Q,34P-C<T-C0R(#`Q,30P,0`@,```````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````````````````!U<W1A
M<@`P,```````````````````````````````````````````````````````
M```````````````````````````````P,#`P,#`@`#`P,#`P,"``````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````!<7"Y<8SI<9FEL93(Y````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````,#`P-C0T(``P
M,#$W-3$@`#`P,3<U,2``,#`P,#`P,#`P,#`@,3$Q-3`V-S0V-#(@,#$Q,S8T
M`"`P````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````'5S=&%R`#`P````````````````````````````````
M`````````````````````````````````````````````````````#`P,#`P
M,"``,#`P,#`P(```````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````````%Q<
M+EQ#.EPN+EQF:6QE,S``````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````````P,#`V-#0@`#`P,3<U,2``,#`Q-S4Q(``P,#`P,#`P,#`P,"`Q
M,3$U,#8W-#8T,B`P,3$V,#0`(#``````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````=7-T87(`,#``````````
M````````````````````````````````````````````````````````````
M````````````````,#`P,#`P(``P,#`P,#`@````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````7%P_7&,Z7&9I;&4S,0``````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````#`P,#8T-"``,#`Q-S4Q(``P,#$W
M-3$@`#`P,#`P,#`P,#`P(#$Q,34P-C<T-C0R(#`Q,3,W-@`@,```````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``!U<W1A<@`P,```````````````````````````````````````````````
M```````````````````````````````````````P,#`P,#`@`#`P,#`P,"``
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````!<7#]<1#I<+BY<9FEL
M93,R````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````,#`P
M-C0T(``P,#$W-3$@`#`P,3<U,2``,#`P,#`P,#`P,#`@,3$Q-3`V-S0V-#(@
M,#$Q-C,P`"`P````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````'5S=&%R`#`P````````````````````````
M````````````````````````````````````````````````````````````
M`#`P,#`P,"``,#`P,#`P(```````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````%Q<7%QC.EQF:6QE,S,`````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````````````````P,#`V-#0@`#`P,3<U,2``,#`Q-S4Q(``P,#`P,#`P
M,#`P,"`Q,3$U,#8W-#8T,B`P,3$T,S4`(#``````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````=7-T87(`,#``
M````````````````````````````````````````````````````````````
M````````````````````````,#`P,#`P(``P,#`P,#`@````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````7%Q<7$,Z7%Q<7%QF:6QE,S0`````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````#`P,#8T-"``,#`Q-S4Q
M(``P,#$W-3$@`#`P,#`P,#`P,#`P(#$Q,34P-C<T-C0R(#`Q,C$U-@`@,```
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````!U<W1A<@`P,```````````````````````````````````````
M```````````````````````````````````````````````P,#`P,#`@`#`P
M,#`P,"``````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````````````!<7#]<54Y#
M7'-E<G9E<EQS:&%R95QF:6QE,S4`````````````````````````````````
M````````````````````````````````````````````````````````````
M````,#`P-C0T(``P,#$W-3$@`#`P,3<U,2``,#`P,#`P,#`P,#`@,3$Q-3`V
M-S0V-#(@,#$T,C4U`"`P````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````'5S=&%R`#`P````````````````
M````````````````````````````````````````````````````````````
M`````````#`P,#`P,"``,#`P,#`P(```````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````%Q</UQ53D-<9FEL93,V````````````````````````````
M````````````````````````````````````````````````````````````
M```````````````````````````P,#`V-#0@`#`P,3<U,2``,#`Q-S4Q(``P
M,#`P,#`P,#`P,"`Q,3$U,#8W-#8T,B`P,3$U,30`(#``````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````=7-T
M87(`,#``````````````````````````````````````````````````````
M````````````````````````````````,#`P,#`P(``P,#`P,#`@````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````7%P_7%5.0UPN+EQF:6QE,S<`
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````#`P,#8T-"``
M,#`Q-S4Q(``P,#$W-3$@`#`P,#`P,#`P,#`P(#$Q,34P-C<T-C0R(#`Q,C`P
M-0`@,```````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````!U<W1A<@`P,```````````````````````````````
M```````````````````````````````````````````````````````P,#`P
M,#`@`#`P,#`P,"``````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````````````````````!<
M7#]<=6YC7'-E<G9E<EQS:&%R95QF:6QE,S@`````````````````````````
M````````````````````````````````````````````````````````````
M````````````,#`P-C0T(``P,#$W-3$@`#`P,3<U,2``,#`P,#`P,#`P,#`@
M,3$Q-3`V-S0V-#(@,#$T-#(P`"`P````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````'5S=&%R`#`P````````
M````````````````````````````````````````````````````````````
M`````````````````#`P,#`P,"``,#`P,#`P(```````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````%Q</UQU;F-<9FEL93,Y````````````````````
M````````````````````````````````````````````````````````````
M```````````````````````````````````P,#`V-#0@`#`P,3<U,2``,#`Q
M-S4Q(``P,#`P,#`P,#`P,"`Q,3$U,#8W-#8T,B`P,3$V-3<`(#``````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````=7-T87(`,#``````````````````````````````````````````````
M````````````````````````````````````````,#`P,#`P(``P,#`P,#`@
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````7%P_7'5N8UPN+EQF
M:6QE-#``````````````````````````````````````````````````````
M`````````````````````````````````````````````````````````#`P
M,#8T-"``,#`Q-S4Q(``P,#$W-3$@`#`P,#`P,#`P,#`P(#$Q,34P-C<T-C0R
M(#`Q,C$S-P`@,```````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````!U<W1A<@`P,```````````````````````
M````````````````````````````````````````````````````````````
M```P,#`P,#`@`#`P,#`P,"``````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````!<+BXO9FEL930Q````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````,#`P-C0T(``P,#$W-3$@`#`P,3<U,2``,#`P,#`P
M,#`P,#`@,3$Q-3`V-S0V-#(@,#$P-C,R`"`P````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````'5S=&%R`#`P
M````````````````````````````````````````````````````````````
M`````````````````````````#`P,#`P,"``,#`P,#`P(```````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````%PN+B\N+EQF:6QE-#(`````````````
M````````````````````````````````````````````````````````````
M```````````````````````````````````````````P,#`V-#0@`#`P,3<U
M,2``,#`Q-S4Q(``P,#`P,#`P,#`P,"`Q,3$U,#8W-#8T,B`P,3$Q,C,`(#``
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````=7-T87(`,#``````````````````````````````````````
M````````````````````````````````````````````````,#`P,#`P(``P
M,#`P,#`@````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````8SHN+B\N
M+EQF:6QE-#,`````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@`#`P,#`P,#`P,#`P(#$Q,34P
M-C<T-C0R(#`Q,3(R-0`@,```````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````!U<W1A<@`P,```````````````
M````````````````````````````````````````````````````````````
M```````````P,#`P,#`@`#`P,#`P,"``````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````!#.B\N+EQF:6QE-#0`````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````,#`P-C0T(``P,#$W-3$@`#`P,3<U,2``
M,#`P,#`P,#`P,#`@,3$Q-3`V-S0V-#(@,#$Q,#,R`"`P````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````````'5S
M=&%R`#`P````````````````````````````````````````````````````
M`````````````````````````````````#`P,#`P,"``,#`P,#`P(```````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````$0Z7"XN+RXN7&9I;&4T-0``
M````````````````````````````````````````````````````````````
M```````````````````````````````````````````````````P,#`V-#0@
M`#`P,3<U,2``,#`Q-S4Q(``P,#`P,#`P,#`P,"`Q,3$U,#8W-#8T,B`P,3$S
M,C0`(#``````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````=7-T87(`,#``````````````````````````````
M````````````````````````````````````````````````````````,#`P
M,#`P(``P,#`P,#`@````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M7"\N+V,Z7&9I;&4T-@``````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@`#`P,#`P,#`P,#`P
M(#$Q,34P-C<T-C0R(#`Q,3(S,0`@,```````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````!U<W1A<@`P,```````
M````````````````````````````````````````````````````````````
M```````````````````P,#`P,#`@`#`P,#`P,"``````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````!<7"XO0SI<+BY<9FEL930W````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````,#`P-C0T(``P,#$W-3$@`#`P
M,3<U,2``,#`P,#`P,#`P,#`@,3$Q-3`V-S0V-#(@,#$Q-3,W`"`P````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````'5S=&%R`#`P````````````````````````````````````````````
M`````````````````````````````````````````#`P,#`P,"``,#`P,#`P
M(```````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````%PO/UQC.B]F:6QE
M-#@`````````````````````````````````````````````````````````
M```````````````````````````````````````````````````````````P
M,#`V-#0@`#`P,3<U,2``,#`Q-S4Q(``P,#`P,#`P,#`P,"`Q,3$U,#8W-#8T
M,B`P,3$R-30`(#``````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````=7-T87(`,#``````````````````````
M````````````````````````````````````````````````````````````
M````,#`P,#`P(``P,#`P,#`@````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````7%P_+T0Z+RXN7&9I;&4T.0``````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@`#`P,#`P
M,#`P,#`P(#$Q,34P-C<T-C0R(#`Q,34P-@`@,```````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````````````!U<W1A<@`P
M,```````````````````````````````````````````````````````````
M```````````````````````````P,#`P,#`@`#`P,#`P,"``````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````!<+R]<1#I<9FEL934P````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````,#`P-C0T(``P,#$W
M-3$@`#`P,3<U,2``,#`P,#`P,#`P,#`@,3$Q-3`V-S0V-#(@,#$Q,C0S`"`P
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````'5S=&%R`#`P````````````````````````````````````
M`````````````````````````````````````````````````#`P,#`P,"``
M,#`P,#`P(```````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````````````````````````````````````%Q<+R]C
M.EPO+UQ<9FEL934Q````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````P,#`V-#0@`#`P,3<U,2``,#`Q-S4Q(``P,#`P,#`P,#`P,"`Q,3$U
M,#8W-#8T,B`P,3$W,S$`(#``````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````=7-T87(`,#``````````````
M````````````````````````````````````````````````````````````
M````````````,#`P,#`P(``P,#`P,#`@````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````7"\_+W5.8R]S97)V97)<<VAA<F5<9FEL934R````````
M````````````````````````````````````````````````````````````
M`````````````````````````````#`P,#8T-"``,#`Q-S4Q(``P,#$W-3$@
M`#`P,#`P,#`P,#`P(#$Q,34P-C<T-C0R(#`Q-#$T-0`@,```````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````````````````````````!U
M<W1A<@`P,```````````````````````````````````````````````````
M```````````````````````````````````P,#`P,#`@`#`P,#`P,"``````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M``````````````````````````````````````!<7#\O54YC7&9I;&4U,P``
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````,#`P-C0T
M(``P,#$W-3$@`#`P,3<U,2``,#`P,#`P,#`P,#`@,3$Q-3`V-S0V-#(@,#$Q
M-#<V`"`P````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`````````````````````'5S=&%R`#`P````````````````````````````
M`````````````````````````````````````````````````````````#`P
M,#`P,"``,#`P,#`P(```````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M`%PO/UQ5;D-<+BXO9FEL934T````````````````````````````````````
M````````````````````````````````````````````````````````````
M```````````````P,#`V-#0@`#`P,3<U,2``,#`Q-S4Q(``P,#`P,#`P,#`P
M,"`Q,3$U,#8W-#8T,B`P,3$W,3(`(#``````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````=7-T87(`,#``````
M````````````````````````````````````````````````````````````
M````````````````````,#`P,#`P(``P,#`P,#`@````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
M````````````````````````````````````````````````````````````
'````````````
`
end

View File

@ -513,45 +513,72 @@ edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry)
}
}
/* Strip redundant leading '/' characters. */
while (name[0] == '/' && name[1] == '/')
name++;
/* By default, don't write or restore absolute pathnames. */
if (!bsdtar->option_absolute_paths) {
/* Strip Windows drive letters. */
if (((name[0] >= 'A' && name[0] <= 'Z')
|| (name[0] >= 'a' && name[0] <= 'z'))
&& name[1] == ':'
&& (name[2] == '/' || name[2] == '\\'))
const char *rp, *p = name;
int slashonly = 1;
/* Remove leading "//./" or "//?/" or "//?/UNC/"
* (absolute path prefixes used by Windows API) */
if ((p[0] == '/' || p[0] == '\\') &&
(p[1] == '/' || p[1] == '\\') &&
(p[2] == '.' || p[2] == '?') &&
(p[3] == '/' || p[3] == '\\'))
{
/* Generate a warning the first time this happens. */
if (!bsdtar->warned_lead_slash) {
bsdtar_warnc(bsdtar, 0,
"Removing leading drive letter from member names");
bsdtar->warned_lead_slash = 1;
if (p[2] == '?' &&
(p[4] == 'U' || p[4] == 'u') &&
(p[5] == 'N' || p[5] == 'n') &&
(p[6] == 'C' || p[6] == 'c') &&
(p[7] == '/' || p[7] == '\\'))
p += 8;
else
p += 4;
slashonly = 0;
}
do {
rp = p;
/* Remove leading drive letter from archives created
* on Windows. */
if (((p[0] >= 'a' && p[0] <= 'z') ||
(p[0] >= 'A' && p[0] <= 'Z')) &&
p[1] == ':') {
p += 2;
slashonly = 0;
}
name += 3;
while (*name == '/' || *name == '\\')
++name;
/* Special case: Stripping everything yields ".". */
if (*name == '\0')
name = ".";
/* Remove leading "/../", "//", etc. */
while (p[0] == '/' || p[0] == '\\') {
if (p[1] == '.' && p[2] == '.' &&
(p[3] == '/' || p[3] == '\\')) {
p += 3; /* Remove "/..", leave "/"
* for next pass. */
slashonly = 0;
} else
p += 1; /* Remove "/". */
}
} while (rp != p);
if (p != name && !bsdtar->warned_lead_slash) {
/* Generate a warning the first time this happens. */
if (slashonly)
bsdtar_warnc(bsdtar, 0,
"Removing leading '%c' from member names",
name[0]);
else
bsdtar_warnc(bsdtar, 0,
"Removing leading drive letter from "
"member names");
bsdtar->warned_lead_slash = 1;
}
/* Strip leading '/'. */
if (name[0] == '/') {
/* Generate a warning the first time this happens. */
if (!bsdtar->warned_lead_slash) {
bsdtar_warnc(bsdtar, 0,
"Removing leading '/' from member names");
bsdtar->warned_lead_slash = 1;
}
/* Special case: Stripping everything yields ".". */
if (*p == '\0')
name = ".";
else
name = p;
} else {
/* Strip redundant leading '/' characters. */
while (name[0] == '/' && name[1] == '/')
name++;
/* Special case: Stripping everything yields ".". */
if (*name == '\0')
name = ".";
}
}
/* Safely replace name in archive_entry. */