Compare commits
265 Commits
release_1_
...
origin
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
970f999818 | ||
|
|
cd39b5a1b7 | ||
|
|
7f6e6e6a3e | ||
|
|
99e3a2604f | ||
|
|
b4ec8aedf9 | ||
|
|
5354888e40 | ||
|
|
57bfbbde90 | ||
|
|
7b69ee5a24 | ||
|
|
1428b7f176 | ||
|
|
6901594ac4 | ||
|
|
c78356feda | ||
|
|
60c00c18b5 | ||
|
|
c1b55e02b1 | ||
|
|
15abf5c4d9 | ||
|
|
1353511226 | ||
|
|
85c7909497 | ||
|
|
db83069aea | ||
|
|
dbbffde583 | ||
|
|
1d79c6734c | ||
|
|
3af9cc0f15 | ||
|
|
c9a7297a8a | ||
|
|
985637ab5a | ||
|
|
1024343a2b | ||
|
|
1efa1f3b43 | ||
|
|
5f1a4f9f12 | ||
|
|
969d2b986b | ||
|
|
d5f2066cac | ||
|
|
79ce0e6789 | ||
|
|
6a052fd5a3 | ||
|
|
8aa729b90e | ||
|
|
057dd26a60 | ||
|
|
b94eed6d03 | ||
|
|
192860abb8 | ||
|
|
c2d2e806a1 | ||
|
|
2a89f7a0a8 | ||
|
|
71d2a66f42 | ||
|
|
e496c1b529 | ||
|
|
6667fa7fb8 | ||
|
|
a16ad3112e | ||
|
|
7efe3850f6 | ||
|
|
d0694ee604 | ||
|
|
37f0faf1c0 | ||
|
|
b893aee6d2 | ||
|
|
f60d655908 | ||
|
|
549481a0a7 | ||
|
|
e08afc2002 | ||
|
|
338591a486 | ||
|
|
c0e0d06e69 | ||
|
|
6e85425618 | ||
|
|
336519aa4f | ||
|
|
5f4d99491d | ||
|
|
48d83be336 | ||
|
|
60d351cc5a | ||
|
|
e33be3d0a1 | ||
|
|
32562b9412 | ||
|
|
dfd87ba1d0 | ||
|
|
5d4a682a55 | ||
|
|
8e3a2a520d | ||
|
|
745832a280 | ||
|
|
458efab23b | ||
|
|
23dcaa117f | ||
|
|
5099ddf6cc | ||
|
|
8476145508 | ||
|
|
362492fe70 | ||
|
|
7111008659 | ||
|
|
ec4741d732 | ||
|
|
bed7de0271 | ||
|
|
eaaadcfd36 | ||
|
|
a8830fbb86 | ||
|
|
848659f1c6 | ||
|
|
17cbd4862c | ||
|
|
64ded9e702 | ||
|
|
ccd0a527e4 | ||
|
|
3f869877a4 | ||
|
|
8c528937a9 | ||
|
|
460f4ec146 | ||
|
|
eb59c14a1f | ||
|
|
3c4f4ca423 | ||
|
|
506b4db5d0 | ||
|
|
5bfb6c5f9d | ||
|
|
3725b5606f | ||
|
|
d1a7eebc30 | ||
|
|
dfe280dcca | ||
|
|
620a136e74 | ||
|
|
3fb5d67b28 | ||
|
|
c30a794679 | ||
|
|
00bb0d8f5c | ||
|
|
af3e05b6af | ||
|
|
6060d613d1 | ||
|
|
3f12066739 | ||
|
|
3b74fbfc3b | ||
|
|
14d39a2c14 | ||
|
|
7b57922073 | ||
|
|
05c6da4c62 | ||
|
|
4ece30109d | ||
|
|
55f1eadbf2 | ||
|
|
9b22262fc6 | ||
|
|
2de140fa95 | ||
|
|
6f6864df13 | ||
|
|
519a7c0c75 | ||
|
|
1ef212d0fb | ||
|
|
333780b227 | ||
|
|
2c56ca0e7f | ||
|
|
63f8de655b | ||
|
|
2743e1ba5b | ||
|
|
40ece6bf4d | ||
|
|
63e835f5c0 | ||
|
|
efe6609cd9 | ||
|
|
b0d5935cb0 | ||
|
|
a1b1b7cc8a | ||
|
|
8940247418 | ||
|
|
0dacafbbb0 | ||
|
|
e3e50c987b | ||
|
|
923f0cda43 | ||
|
|
c485b7984d | ||
|
|
d769b724f4 | ||
|
|
a0eb52da3f | ||
|
|
87ac3207fb | ||
|
|
c634f2c6f1 | ||
|
|
5416153391 | ||
|
|
5bb69a88d8 | ||
|
|
0a848ff669 | ||
|
|
7c0b81cbb9 | ||
|
|
862770bf91 | ||
|
|
89d682d0b9 | ||
|
|
764174dc1d | ||
|
|
5ab30f709a | ||
|
|
e2b8c8fa9f | ||
|
|
42250f5010 | ||
|
|
62571aa7c3 | ||
|
|
32f7047037 | ||
|
|
a69be0adce | ||
|
|
1fb35e7374 | ||
|
|
7e69b14775 | ||
|
|
625c45d304 | ||
|
|
3fe0f0d7f8 | ||
|
|
c3d4fee823 | ||
|
|
a0fb51e136 | ||
|
|
ac8690fc4e | ||
|
|
395df04927 | ||
|
|
89a91c7b44 | ||
|
|
5635a428ab | ||
|
|
8b5f10a6c4 | ||
|
|
6e98015774 | ||
|
|
bd13e18a63 | ||
|
|
01cf5c5315 | ||
|
|
0dd814fac2 | ||
|
|
b27b516b68 | ||
|
|
c7f69c265b | ||
|
|
bc00f45420 | ||
|
|
57304e8b0a | ||
|
|
d3f04456e8 | ||
|
|
d78083e82c | ||
|
|
c8d4ceccc1 | ||
|
|
6287d3045f | ||
|
|
9d3142805b | ||
|
|
05eddc1a58 | ||
|
|
78bfbb5661 | ||
|
|
fe576585e6 | ||
|
|
080a6b2ac5 | ||
|
|
f236f33643 | ||
|
|
a4ffcfb875 | ||
|
|
967fcb9318 | ||
|
|
12b3a5d5b1 | ||
|
|
eeb610da48 | ||
|
|
749e20e6fa | ||
|
|
56f6556f94 | ||
|
|
43c5343194 | ||
|
|
250db35f17 | ||
|
|
6f929b2c89 | ||
|
|
64cddf2fbc | ||
|
|
ccdbafb276 | ||
|
|
bd222d606a | ||
|
|
94fb06f5db | ||
|
|
74d217db74 | ||
|
|
17ef61b2fd | ||
|
|
f32828d577 | ||
|
|
e67e085421 | ||
|
|
ca856c2585 | ||
|
|
18641602c1 | ||
|
|
8bdbc08a89 | ||
|
|
a5d5cc599f | ||
|
|
761895d43c | ||
|
|
5d4f057e31 | ||
|
|
7c0ba663c8 | ||
|
|
51118be241 | ||
|
|
69f5d77383 | ||
|
|
d989864712 | ||
|
|
983d328ff2 | ||
|
|
586c684815 | ||
|
|
bbf7dec45e | ||
|
|
40f79286ab | ||
|
|
ebc522d521 | ||
|
|
ad85f632c6 | ||
|
|
062b37115f | ||
|
|
6261c58ae8 | ||
|
|
427bda01a3 | ||
|
|
1d26fff0f3 | ||
|
|
bb6b92e37d | ||
|
|
8ca4064a8c | ||
|
|
5c890a6003 | ||
|
|
3705fd6452 | ||
|
|
bde442ba15 | ||
|
|
c9a8f1bc33 | ||
|
|
66e9b9cd6c | ||
|
|
b9588c4722 | ||
|
|
9a41b3b3db | ||
|
|
990e7d4437 | ||
|
|
173d3229e3 | ||
|
|
2d261da8f9 | ||
|
|
99527fa17b | ||
|
|
868ee74028 | ||
|
|
8c90bf0414 | ||
|
|
892cdea8a1 | ||
|
|
00763876f1 | ||
|
|
1a1cfaafa6 | ||
|
|
445d95be07 | ||
|
|
6fe55234c9 | ||
|
|
e24d8574a8 | ||
|
|
4da5205ed6 | ||
|
|
8241687465 | ||
|
|
8e3f3adf98 | ||
|
|
e5ef01710a | ||
|
|
e70e63612a | ||
|
|
28b26242c7 | ||
|
|
6b279a6f8c | ||
|
|
079f2d6807 | ||
|
|
b09417ca8d | ||
|
|
b15e3f1bbd | ||
|
|
1616b1d1b4 | ||
|
|
f23bc997fd | ||
|
|
8ec119a27f | ||
|
|
e35d05b1d2 | ||
|
|
cdb77dcd7b | ||
|
|
9bf87b195e | ||
|
|
643e3f2441 | ||
|
|
6e75833cb7 | ||
|
|
908d78d208 | ||
|
|
192f55e2a0 | ||
|
|
9d99fd13cd | ||
|
|
07902e9f9a | ||
|
|
0c94a109b9 | ||
|
|
27094c4fc3 | ||
|
|
5aca761e1b | ||
|
|
cc82db7f2d | ||
|
|
137ebf41fd | ||
|
|
49ea4c5057 | ||
|
|
409bddf38c | ||
|
|
c930802f31 | ||
|
|
ca14885884 | ||
|
|
01d6188297 | ||
|
|
759c5208c5 | ||
|
|
8457e06b99 | ||
|
|
8719c4f680 | ||
|
|
574022ab78 | ||
|
|
304d8b9f0c | ||
|
|
6712656eb2 | ||
|
|
415d9c9e15 | ||
|
|
1a8141ab8a | ||
|
|
023c766600 | ||
|
|
fdb46aa2e2 | ||
|
|
2504e7d3ae | ||
|
|
b0765e257c | ||
|
|
73d4c40a87 | ||
|
|
7aed52718f |
@@ -3,7 +3,6 @@
|
||||
*.tar
|
||||
.bootstrap
|
||||
ABOUT-NLS
|
||||
COPYING
|
||||
INSTALL
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -13,5 +12,7 @@ build-aux
|
||||
config.*
|
||||
configure
|
||||
gnulib
|
||||
m4
|
||||
rmt
|
||||
stamp-h1
|
||||
tar-[0-9]*
|
||||
|
||||
41
AUTHORS
41
AUTHORS
@@ -1,34 +1,15 @@
|
||||
Authors of GNU tar.
|
||||
|
||||
The following contributions warranted legal paper exchanges with the
|
||||
Free Software Foundation. Also see files ChangeLog and THANKS.
|
||||
Public domain tar was written by John Gilmore, with contributions from
|
||||
Henry Spencer, Fred Fish, Ian Darwin, Geoff Collyer, Stan Barber, Guy
|
||||
Harris, Dave Brower, Richard Todd, Michael Rendell, Stu Heiss, and
|
||||
Rich Salz.
|
||||
|
||||
TAR Sergey Poznyakoff 2003-10
|
||||
Assigns his past and future changes.
|
||||
The FSF version, named GNU tar, was derived from public domain tar by
|
||||
Jay Fenlason and Joy Kendall. Amy Gorin and Melissa Weisshaus
|
||||
contributed to the manual. GNU tar has been maintained in turn by
|
||||
Thomas Bushnell BSG, François Pinard, Paul Eggert, and Sergey
|
||||
Poznyakoff.
|
||||
|
||||
TAR Paul Eggert 2000-10
|
||||
Assigns his past and future changes.
|
||||
|
||||
TAR Jay Fenlason
|
||||
Assigns his changes.
|
||||
|
||||
TAR Richard E Salz 1993-03-11
|
||||
Disclaims changes to getdate.y.
|
||||
|
||||
TAR MANUAL (?) Amy Gorin (US 1963) 1995-01-10
|
||||
Assigns the Tar Manual.
|
||||
|
||||
TAR Francois Pinard Canada 1949 1996-02-01
|
||||
Assigns past and future changes.
|
||||
|
||||
TAR Melissa Weisshaus US 1966 1997-04-09
|
||||
Assigns changes to the manual and future changes.
|
||||
melissa@gnu.ai.mit.edu
|
||||
|
||||
TAR Thomas Michael Innis Bushnell US 1967 1997-04-09
|
||||
Assigns changes.
|
||||
thomas@gnu.ai.mit.edu
|
||||
|
||||
TAR Thomas Michael Innis Bushnell US 1967 1997-04-09
|
||||
Assigns changes to manual.
|
||||
thomas@gnu.ai.mit.edu
|
||||
Many others have contributed to GNU tar; please see the files THANKS
|
||||
and ChangeLog.
|
||||
|
||||
676
COPYING
Normal file
676
COPYING
Normal file
@@ -0,0 +1,676 @@
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||
|
||||
884
ChangeLog
884
ChangeLog
@@ -1,3 +1,851 @@
|
||||
2008-11-30 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/xheader.c: Remove duplicate inclusion of fnmatch.h. Reported
|
||||
by Jim Meyering.
|
||||
|
||||
2008-11-25 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
Do not try to drain the input pipe before closing the
|
||||
archive.
|
||||
|
||||
* src/buffer.c (close_archive): Remove call to
|
||||
sys_drain_input_pipe. Pass hit_eof as the second
|
||||
argument to sys_wait_for_child.
|
||||
* src/common.h (sys_drain_input_pipe): Remove
|
||||
(sys_wait_for_child): Declare second argument.
|
||||
* src/system.c (sys_drain_input_pipe): Remove.
|
||||
(sys_wait_for_child): Take two arguments. The second one helps to
|
||||
decide whether to tolerate child termination on SIGPIPE.
|
||||
|
||||
2008-11-03 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/buffer.c (_write_volume_label): Fix typo, which prevented
|
||||
`-V label -M' from working.
|
||||
|
||||
2008-10-30 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* NEWS, configure.ac: Version 1.20.91
|
||||
* doc/tar.texi: Document transformation scope flags.
|
||||
* src/common.h (transform_symlinks_option): Remove in favor of
|
||||
transformation scope flags.
|
||||
(XFORM_REGFILE, XFORM_LINK, XFORM_SYMLINK, XFORM_ALL): New macros.
|
||||
(transform_name, transform_member_name, transform_name_fp): Take
|
||||
an additional argument, specifying scope flags.
|
||||
* src/create.c: Reflect changes to transform_name.
|
||||
* src/extract.c (extract_link, extract_symlink): Remove calls to
|
||||
transform_member_name. It is done in read_header.
|
||||
* src/list.c (decode_xform): Reflect change in data type of 2nd
|
||||
argument.
|
||||
(transform_member_name): 2nd arg is int.
|
||||
(decode_header): Transform file name and link target names.
|
||||
* src/tar.c: Remove --transform-symlinks.
|
||||
* src/transform.c (struct transform): New member `flags'.
|
||||
(transform_flags): New variable.
|
||||
(parse_transform_expr): Parse transformation scope flags. Allow to
|
||||
set global flags using `flags=' syntax.
|
||||
(_transform_name_to_obstack, transform_name_fp)
|
||||
(transform_name): Take an additional argument, specifying scope
|
||||
flags.
|
||||
|
||||
2008-10-19 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* THANKS: Add Ed Leaver.
|
||||
* src/buffer.c (short_read): Remove !read_full_records condition,
|
||||
which was always false on a first record and thus disabled record
|
||||
size autodetection. Thanks Ed Leaver for the patch.
|
||||
(_gnu_flush_read): Handle blocking_factor == 1.
|
||||
* tests/sparsemv.at: Reflect changes to buffer.c.
|
||||
* tests/sparsemvp.at: Likewise.
|
||||
* tests/volsize.at: Likewise.
|
||||
* NEWS: Update.
|
||||
|
||||
2008-10-16 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/common.h (transform_symlinks_option): New global.
|
||||
* src/create.c (dump_file0): Transform symlink targets only if
|
||||
explicitly required. Thanks Cyril Strejc for reporting the
|
||||
problem.
|
||||
* src/tar.c (parse_opt): New options --transform-symlinks and
|
||||
--no-transform-symlinks. New alias --xform to the --transform
|
||||
option.
|
||||
* doc/tar.texi: Document --transform-symlinks
|
||||
* NEWS: Update.
|
||||
* THANKS: Update.
|
||||
|
||||
* src/names.c (name_gather): Use xzalloc.
|
||||
* src/buffer.c (short_read): Move record size detection before
|
||||
the loop.
|
||||
|
||||
2008-10-07 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/tar.c (options): Add --lzop option.
|
||||
|
||||
2008-10-05 Xavier Hienne <xavier.hienne@free.fr> (tiny change)
|
||||
|
||||
* src/checkpoint.c (checkpoint_compile_action): Add missing
|
||||
`else'.
|
||||
|
||||
2008-09-24 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* NEWS: Update.
|
||||
* doc/tar.texi: Update.
|
||||
* src/tar.c: New option --no-null.
|
||||
|
||||
2008-09-23 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/common.h (filename_terminator): Remove global.
|
||||
* src/tar.c (filename_terminator): New static.
|
||||
* src/names.c (name_next_elt): Do not depend on
|
||||
filename_terminator, this was a leftover from 1.13.
|
||||
|
||||
2008-09-18 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* doc/tar.texi: Remove incorrect example.
|
||||
|
||||
2008-09-07 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/incremen.c (dumpdir_create0): Eliminate gcc warning.
|
||||
(attach_directory): Bugfix - add missing return statement.
|
||||
* THANKS: Add Enric Hernandez
|
||||
|
||||
2008-07-31 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/incremen.c (struct directory): New member `next'. Change
|
||||
type of `name'.
|
||||
(dirhead, dirtail): New statics.
|
||||
(make_directory): Reflect changes to struct directory.
|
||||
(free_directory, attach_directory): New functions.
|
||||
(dirlist_replace_prefix): New function.
|
||||
(note_directory): Use attach_directory, instead of make_directory,
|
||||
(find_directory, find_directory_meta): Use free_directory.
|
||||
(procdir): Replace directory prefixes in directory list to avoid
|
||||
marking subdirectories as renamed after renaming their parent
|
||||
directory.
|
||||
(append_incremental_renames): Iterate over directory list, not
|
||||
hash table, to preserve logical ordering of renames.
|
||||
* tests/rename04.at, tests/rename05.at: New test cases.
|
||||
* tests/Makefile.am, tests/testsuite.at: Add rename04.at and
|
||||
rename05.at.
|
||||
* tests/atlocal.in (decho): New function.
|
||||
* tests/multiv06.at: Use decho instead of echo2.
|
||||
* tests/incremental.at: Raise wait interval to 2 seconds.
|
||||
|
||||
2008-07-24 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/tar.c (decode_options): Do not allow volume length less
|
||||
than record size.
|
||||
* src/buffer.c (_gnu_flush_write): Compensate for the effect
|
||||
of eventual flush_archive occurring in the middle of buffer
|
||||
move.
|
||||
Increment records_written only if _flush_write was able to write
|
||||
something.
|
||||
* tests/multiv06.at: New testcase.
|
||||
* tests/Makefile.am, test/testsuite.at: Add tests/multiv06.at
|
||||
|
||||
2008-06-26 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* configure.ac, NEWS: Version 1.20.90
|
||||
* doc/tar.texi: Document -J, --no-auto-compress, etc.
|
||||
* src/buffer.c (ct_tar): New constant.
|
||||
(magic): Add lzop support. Proposed by Kevin Day
|
||||
<thekevinday@gmail.com>.
|
||||
(check_compressed_archive): Do not use autodetect if the
|
||||
compression program was specified explicitly.
|
||||
Fall back to analyzing archive name, if the autodetection fails.
|
||||
* src/suffix.c: Add .lzo
|
||||
* src/tar.c: New options --lzop and --no-auto-compress.
|
||||
New short option -J (alias for --lzma).
|
||||
|
||||
* src/buffer.c (try_new_volume): Print more information with error
|
||||
diagnostics.
|
||||
(_gnu_flush_write): Improve error checking. Adjust
|
||||
real_s_sizeleft before calling new_volume to avoid creating
|
||||
malformed multivolume headers.
|
||||
* tests/delete05.at, tests/gzip.at, tests/ignfail.at,
|
||||
tests/longv7.at, tests/lustar01.at, tests/lustar02.at,
|
||||
tests/shortfile.at: Update to match new diagnostic wording
|
||||
(see 2008-05-06).
|
||||
|
||||
* NEWS: Update.
|
||||
|
||||
2008-06-14 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* doc/tar.texi (exclude): Document support for new VCS.
|
||||
* THANKS: Update.
|
||||
* NEWS: Update.
|
||||
* tests/multiv05.at: Fix typos.
|
||||
* tests/volsize.at: Remove a TZ dependency.
|
||||
|
||||
2008-06-14 Dan Drake <dan@dandrake.org> (tiny change)
|
||||
|
||||
* src/tar.c (exclude_vcs_files): Support for Bazaar, Mercurial and
|
||||
Darcs.
|
||||
|
||||
2008-05-06 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/tar.c (main): Reword the "delayed error" message. New
|
||||
wording proposed by Karl Berry.
|
||||
|
||||
2008-02-20 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* configure.ac: Raise version number to 1.20
|
||||
* src/compare.c (diff_dumpdir): const.
|
||||
* src/common.h (dumpdir_t,dumpdir_iter_t): New data types.
|
||||
(dumpdir_create0,dumpdir_create,dumpdir_free,dumpdir_locate)
|
||||
(dumpdir_first,dumpdir_next): New functions.
|
||||
* src/incremen.c (dumpdir_create0,dumpdir_create,dumpdir_free)
|
||||
(dumpdir_first,dumpdir_next): New functions.
|
||||
(dumpdir_locate): Rewrite using binary search.
|
||||
(struct directory): Change members char *contents, *icontents to
|
||||
struct dumpdir *dump, *idump. All references updated.
|
||||
(note_directory): Last arg is const.
|
||||
* src/names.c (add_hierarchy_to_namelist): buffer is const.
|
||||
* tests/incr03.at, tests/incr04.at, tests/rename02.at,
|
||||
tests/rename03.at: Insert calls to sleep between creation of files
|
||||
and adding them to the archive.
|
||||
|
||||
2008-03-31 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/create.c (dump_file0): Count links only for actually dumped
|
||||
files.
|
||||
|
||||
2008-03-27 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* NEWS: Document --no-check-device and --check-device.
|
||||
* doc/rendition.texi: Change the way FIXME-*refs are handled in
|
||||
!PROOF.
|
||||
* doc/intern.texi, doc/tar.texi: Update.
|
||||
* doc/untabify.el: New file.
|
||||
* doc/Makefile.am (EXTRA_DIST): Add untabify.el
|
||||
(untabify, final, check-format, check-refs, check-fixmes)
|
||||
(check-unrevised, all-check-docs, check-docs): New rules.
|
||||
|
||||
* src/common.h (check_device_option): New global.
|
||||
* src/incremen.c (procdir): Use boolean and instead of bitwise
|
||||
one. Patch by Jean-Louis Martineau.
|
||||
Compare device numbers only if check_device_option is set.
|
||||
* src/tar.c: New command line options --no-check-device and
|
||||
--check-device. Proposed by Jean-Louis Martineau.
|
||||
(parse_opt): Hanlde new options.
|
||||
(decode_options): Initialize check_device_option to true.
|
||||
|
||||
* THANKS: Update
|
||||
|
||||
2008-03-06 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* bootstrap: Use rsync to get translations.
|
||||
* doc/tar.texi: Minor change.
|
||||
* lib/.cvsignore: Update
|
||||
* po/.cvsignore: Update
|
||||
* src/system.c: Remove include setenv.h.
|
||||
* tests/atlocal.in (STAR_DATA_URL): Update.
|
||||
* tests/star/README: Update URL.
|
||||
|
||||
2008-02-09 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* doc/tar.texi: Fix a typo. Reported by Denis Excoffier.
|
||||
|
||||
2008-02-08 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* NEWS: Update.
|
||||
* configure.ac: Version 1.19.90
|
||||
* po/POTFILES.in: Add missing files.
|
||||
* src/compare.c (verify_volume): Honor --ignore-zeros.
|
||||
Proposed by Jan-Benedict Glaw.
|
||||
* tests/shortfile.at (AT_KEYWORDS): Add shortfile0.
|
||||
|
||||
2008-02-07 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* NEWS: Update.
|
||||
* src/create.c (dump_file0): Apply transform_name to symlink
|
||||
targets.
|
||||
|
||||
2008-02-04 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/transform.c: Support multiple --transform options. Support
|
||||
semicolon-separated lists of replace expressions.
|
||||
* NEWS, tar.texi: Document changes to the --transform option.
|
||||
|
||||
2008-01-30 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* doc/tar.texi: Update Back-Cover text to reflect new GNU wording.
|
||||
|
||||
2007-12-17 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Exit with nonzero status if a close fails on an archive.
|
||||
Problem (and initial trivial fix)
|
||||
* src/buffer.c (close_archive, new_volume): close_error, not
|
||||
close_warn.
|
||||
|
||||
2007-12-05 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/buffer.c (check_compressed_archive): Do not bail out if the
|
||||
file is too short, set boolean flag, passed as an argument
|
||||
instead. This fixes a bug introduced on 2007-08-24. See also
|
||||
tests/shortupd.at.
|
||||
|
||||
* tests/Makefile.am, tests/testsuite.at: Add shortupd.at.
|
||||
* tests/shortupd.at: New test.
|
||||
|
||||
2007-11-12 Jim Meyering <meyering@redhat.com>
|
||||
|
||||
Don't read from name[-1].
|
||||
* src/incremen.c (make_directory): Handle namelen == 0, since
|
||||
find_directory_meta calls make_directory ("").
|
||||
|
||||
2007-11-07 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* bootstrap (checkout): Use URL of the gnulib CVS mirror.
|
||||
* gnulib.modules: Add fseeko and snprintf.
|
||||
|
||||
2007-10-31 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/checkpoint.c: New actions: bell and ttyout
|
||||
* src/system.c (sys_exec_info_script)
|
||||
(sys_exec_checkpoint_script): pass the current blocking factor in
|
||||
TAR_BLOCKING_FACTOR environment variable.
|
||||
* doc/tar.texi: Update
|
||||
* NEWS: Update
|
||||
|
||||
2007-10-30 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* doc/Makefile.am: Use texi2html and the CVS version of gendocs.sh
|
||||
to create HTML versions of the manual.
|
||||
* doc/gendocs_template: Likewise.
|
||||
* doc/tar.texi: Document --hard-dereference and
|
||||
--checkpoint-action options. Improve documentation of
|
||||
--check-links.
|
||||
|
||||
2007-10-29 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* NEWS: Update
|
||||
* configure.ac: Version 1.19.1
|
||||
* po/POTFILES.in: Add src/checkpoint.c
|
||||
* src/Makefile.am (tar_SOURCES): add checkpoint.c
|
||||
* src/checkpoint.c: New file - checkpoint handling.
|
||||
* src/buffer.c (checkpoint, do_checkpoint): Remove.
|
||||
(_flush_write, simple_flush_read, _gnu_flush_read): Use
|
||||
checkpoint_run.
|
||||
* src/common.h (enum checkpoint_style): Remove.
|
||||
(checkpoint_style): Remove.
|
||||
(DEFAULT_CHECKPOINT): New define.
|
||||
(hard_dereference_option): New variable.
|
||||
(sys_exec_checkpoint_script): New declaration.
|
||||
* src/create.c (file_count_links): do nothing if
|
||||
hard_dereference_option is set.
|
||||
* src/system.c (sys_exec_checkpoint_script): New function.
|
||||
(sys_exec_info_script): Restore SIGPIPE handler.
|
||||
* src/tar.c: (parse_opt): New options --hard-dereference,
|
||||
--checkpoint-action.
|
||||
(decode_options): Call checkpoint_finish_compile.
|
||||
|
||||
* src/system.c (sys_exec_info_script): Initialize buf. Problem
|
||||
reported by Bengt-Arne Fjellner.
|
||||
|
||||
2007-10-18 Jim Meyering <jim@meyering.net>
|
||||
|
||||
Avoid compiler warnings.
|
||||
* src/list.c (read_header_primitive): Define two locals, to
|
||||
avoid incorrect "may be used uninitialized" warnings.
|
||||
* src/incremen.c (procdir): Remove decl of unused local, "len".
|
||||
|
||||
2007-10-18 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* doc/tar.texi (gzip): Remove compression patent
|
||||
warning. According to Brett Smith, the patent is
|
||||
expired.
|
||||
|
||||
2007-10-17 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/suffix.c: New file. Compress format detection by archive
|
||||
suffix (when creating). Suggested by Jean-Pierre Demailly.
|
||||
* src/Makefile.am: Add suffix.c
|
||||
* src/buffer.c (magic): Add an entry for new lzma format. Proposed
|
||||
by Lasse Collin.
|
||||
* src/common.h (set_comression_program_by_suffix): New prototype.
|
||||
* src/tar.c: New options --auto-compress (-a) and --lzma
|
||||
* THANKS: Add Lasse Collin and Jean-Pierre Demailly.
|
||||
* NEWS: Update
|
||||
* doc/tar.texi: Update
|
||||
|
||||
2007-10-12 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* src/utf8.c (string_ascii_p): Recode to avoid bogus GCC 4.2.1
|
||||
warning about "comparison is always true due to limited range of
|
||||
data type" when char is unsigned.
|
||||
|
||||
2007-10-11 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Adjust to recent gnulib changes.
|
||||
* configure.ac: Dont' check for strerror, since gnulib now does this.
|
||||
* .cvsignore: Add m4, tar-[0-9]*.
|
||||
* lib/.cvsignore: Adjust to various gnulib file name changes.
|
||||
Add .deps, rmt-command.h.
|
||||
|
||||
2007-10-10 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* configure.ac, NEWS: Raise version number to 1.19
|
||||
* tests/star/README: Update
|
||||
|
||||
2007-10-05 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/create.c (dump_regular_file): Fix file padding in case of
|
||||
truncation to zero size.
|
||||
* NEWS: Update
|
||||
|
||||
2007-10-04 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* tests/T-null.at: Use AT_DATA for sample output.
|
||||
|
||||
2007-10-03 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/incremen.c (try_purge_directory): Ensure that arguments to T
|
||||
and R are safe.
|
||||
|
||||
2007-09-29 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/incremen.c (obstack_code_rename): Apply safer_name_suffix to
|
||||
name arguments before storing them in T and R records. Reported by
|
||||
Nicholas Cole.
|
||||
|
||||
2007-09-27 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* configure.ac: Raise version number to 1.18.90
|
||||
* NEWS: Likewise
|
||||
|
||||
* doc/snapshot.texi: Document version 2.
|
||||
* doc/dumpdir.texi: Update.
|
||||
|
||||
Implement --exclude-tag* and --exclude-cache* options for listed
|
||||
incremental archives.
|
||||
New option --exclude-vcs to exclude VCS-specific files and
|
||||
directories.
|
||||
|
||||
* NEWS: Update
|
||||
* doc/tar.texi: Document --exclude-vcs option
|
||||
* src/common.h (exclusion_tag_warning, check_exclusion_tags): New
|
||||
prototypes.
|
||||
* src/create.c (exclusion_tag_warning, check_exclusion_tags):
|
||||
Remove static qualifier.
|
||||
(check_exclusion_tags): account for dirname without terminating
|
||||
slash.
|
||||
(dump_dir0): exclusion_tag_all is handled elsewhere.
|
||||
* src/incremen.c (struct directory): New member tagfile
|
||||
(make_directory): Initialize tagfile to NULL
|
||||
(procdir): New argument: entry
|
||||
Hanlde exclusion tags.
|
||||
(makedumpdir): Take into account directory->tagfile.
|
||||
(scan_directory): Hanlde exclusion tags.
|
||||
* src/tar.c: New option --exclude-vcs
|
||||
(exclude_vcs_files): New function
|
||||
|
||||
2007-09-14 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* AUTHORS: Remove unnecessary information. Just list the
|
||||
principal authors.
|
||||
* THANKS: Remove info duplicated from AUTHORS.
|
||||
|
||||
2007-08-25 Jim Meyering <jim@meyering.net>
|
||||
|
||||
Don't include <getline.h>. No longer needed.
|
||||
* src/incremen.c: Don't include <getline.h>. No longer needed.
|
||||
* src/buffer.c: Likewise.
|
||||
* src/system.c: Likewise.
|
||||
* src/tar.c: Likewise.
|
||||
|
||||
Avoid shadowing and unused-variable warnings.
|
||||
* src/create.c (check_exclusion_tags): Remove declaration of unused
|
||||
local, "ret".
|
||||
* src/compare.c (diff_dumpdir): Rename stat->stat_data to avoid
|
||||
shadowing the syscall.
|
||||
* src/buffer.c (do_checkpoint): Don't shadow the write syscall.
|
||||
(try_new_volume): Avoid shadowing "access".
|
||||
* src/tar.c (decode_options): Rename index->idx to avoid shadowing.
|
||||
(find_argp_option): Rename option->o to avoid shadowing.
|
||||
* src/incremen.c (scan_directory): Rename local, dir_name->dir,
|
||||
to avoid shadowing the function.
|
||||
(get_directory_contents): Likewise.
|
||||
* src/system.c (global_pid): Rename from "pid", to avoid being
|
||||
shadowed by locals.
|
||||
* src/extract.c (apply_nonancestor_delayed_set_stat):
|
||||
Rename st->sb to avoid shadowing another local.
|
||||
|
||||
2007-08-24 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* configure.ac, NEWS: Raise version number to 1.18.1
|
||||
|
||||
* src/buffer.c (check_compressed_archive): Detect files smaller
|
||||
than 512 bytes.
|
||||
* tests/shortfile.at: New test case for the above change.
|
||||
* tests/testsuite.at, tests/Makefile.am: Add shortfile.at
|
||||
|
||||
2007-08-19 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* bootstrap: Gnulib initialization destroyed paxutils m4 files.
|
||||
Initialize paxutils structure after that of gnulib.
|
||||
|
||||
2007-08-12 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/names.c (contains_dot_dot): Fix double-dot recognition in
|
||||
case of duplicate /. Patch by Dmitry V. Levin.
|
||||
|
||||
* bootstrap (symlink_to_gnulib): Make sure the target directory
|
||||
exists and create it if it does not.
|
||||
|
||||
* doc/tar.texi: Fix a typo.
|
||||
|
||||
2007-06-28 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* bootstrap: Update for the change of the TP URL
|
||||
|
||||
2007-06-27 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
Relicense under GPLv3
|
||||
|
||||
2007-06-21 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* tests/testsuite.at (AT_TAR_MKHIER): Skip test if genfile is
|
||||
unable to create the file
|
||||
* tests/lustar01.at: Likewise
|
||||
|
||||
2007-06-21 Eric Blake <ebb9@byu.net>
|
||||
|
||||
Resolve testsuite failures 40-42 on cygwin.
|
||||
* tests/testsuite.at (AT_TAR_MKHIER): Skip tests when long
|
||||
file names cannot be created.
|
||||
|
||||
2007-06-16 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* doc/Makefile.am (tar_TEXINFOS): Add tar-snapshot-edit.texi
|
||||
* doc/tar-snapshot-edit.texi: New file
|
||||
* doc/tar.texi (Fixing Snapshot Files): New appendix
|
||||
|
||||
* scripts/tar-snapshot-edit: New file
|
||||
* tests/extrac07.at: Add back write permissions on dir
|
||||
|
||||
2007-06-09 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* tests/exclude.at: Sort the output.
|
||||
|
||||
2007-06-08 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* configure.ac, NEWS: Raise version number to 1.17
|
||||
|
||||
* doc/tar.texi, doc/intern.texi: Replace: s/filename/file name/;
|
||||
s/(ASCII|ID|BSD)/@acronym{&}/;s/"[^"]+"/``&''/
|
||||
Use `path' only when it refers to search paths, use
|
||||
`file name' otherwise.
|
||||
Fix various errors (based on patch by Benno Schulenberg)
|
||||
|
||||
* doc/tar.texi (Operation Summary): Restore alphabetical order of
|
||||
the options.
|
||||
|
||||
2007-06-02 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
Fix bug, introduced on 2007-03-30.
|
||||
|
||||
* src/common.h (xform_type): New data type
|
||||
(transform_member_name): Last argument is of xform_type type
|
||||
All callers updated
|
||||
|
||||
* src/extract.c: Update calls to transform_member_name
|
||||
* src/list.c (decode_xform): Exempt symbolic links from component
|
||||
stripping and name suffix normalization.
|
||||
|
||||
* tests/extrac07.at: Update
|
||||
|
||||
2007-05-30 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/xheader.c (decx): Unknown pax keywords produce a warning,
|
||||
not error.
|
||||
|
||||
2007-05-29 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* src/misc.c (set_file_atime): Use gl_futimens, not futimens,
|
||||
due to gnulib change.
|
||||
|
||||
2007-05-19 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/common.h (buffer_write_global_xheader): New function
|
||||
(struct xheader): Move definition to tar.h
|
||||
(extended_header): Remove global
|
||||
(xheader_init): New function
|
||||
(xheader_decode_global,xheader_store,xheader_read)
|
||||
(xheader_write_global,xheader_write,xheader_string_begin)
|
||||
(xheader_string_add,xheader_string_end): Take xhdr as first
|
||||
argument.
|
||||
* src/tar.h (struct xheader): New definition
|
||||
(struct tar_stat_info): New member xhdr (extended header).
|
||||
|
||||
* src/xheader.c (xheader_init): New function
|
||||
(xheader_decode_global,xheader_store,xheader_read)
|
||||
(xheader_write_global,xheader_write,xheader_string_begin)
|
||||
(xheader_string_add,xheader_string_end): Take xhdr as first
|
||||
argument.
|
||||
|
||||
* src/buffer.c (buffer_write_global_xheader): New function
|
||||
Update to use new xheader calls.
|
||||
|
||||
* src/compare.c, src/create.c, src/delete.c, src/list.c,
|
||||
src/sparse.c, src/tar.c, src/update.c: Global extended_header
|
||||
removed, use new xheader calls instead.
|
||||
|
||||
* tests/T-null.at: Minor fix
|
||||
* tests/atlocal.in (tarball_prereq): Discard eventual md5sum
|
||||
output.
|
||||
|
||||
2007-05-18 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/create.c (dump_file0): Original ctime cannot be used as a
|
||||
directory change indicator if --remove-files is given.
|
||||
|
||||
2007-04-12 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Adjust to latest Gnulib.
|
||||
* lib/.cvsignore: Add dirfd.c, dirfd.h, float+.h, mbscasecmp.c,
|
||||
stdio.h, stdio_.h, stdlib.h, stdlib_.h, time.h, time_.h, unistd.h.
|
||||
Remove exit.h, getcwd.h, mempcpy.h, memrchr.h, mkdtemp.h, stpcpy.h,
|
||||
strcase.h, strchrnul.h, strdup.h, strndup.h, strnlen.h, time_r.h,
|
||||
vsnprintf.h.
|
||||
* m4/.cvsignore: Remove localedir.h. Sort.
|
||||
|
||||
2007-04-03 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* src/common.h (closeopen): Remove decl.
|
||||
* src/misc.c: Don't include <sys/time.h>, <sys/resource.h>; no longer
|
||||
needed.
|
||||
(get_max_open_files, closeopen): Remove. All callers removed.
|
||||
(chdir_dir): Use a different technique, which doesn't rely on closing
|
||||
all open files.
|
||||
* src/tar.c (main): Don't call closeopen.
|
||||
|
||||
2007-04-04 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* NEWS: Update
|
||||
* doc/tar.texi: Update
|
||||
* src/system.c (sys_exec_info_script): Store the
|
||||
inter-communication fd in the environment variable TAR_FD
|
||||
|
||||
2007-04-03 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/tar.c (main): Move closeopen after decode_options to
|
||||
allow shell process substitution to work.
|
||||
* tests/extrac07.at: Expect a warning on stderr.
|
||||
|
||||
2007-03-30 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/common.h (transform_name_fp): Change signature
|
||||
(transform_member_name): New function
|
||||
* src/extract.c (extract_link, extract_symlink): Use
|
||||
transform_member_name instead of safer_name_suffix so that
|
||||
--transform and --strip-components affect links as well.
|
||||
* src/list.c (transform_member_name): New function
|
||||
(decode_header): Use transform_member_name
|
||||
* src/names.c (all_names_found): Remove check for matching_flags.
|
||||
* NEWS: Update
|
||||
|
||||
* TODO: Update
|
||||
* bootstrap (slurp): Remove any occurrences of $bt from the
|
||||
generated gnulib.mk
|
||||
* src/incremen.c: Do not include mkdtemp.h
|
||||
|
||||
2007-01-26 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Adjust to recent gnulib changes.
|
||||
* lib/.cvsignore: Add fchownat.c, rmt-command.h, strerror.c, string.h,
|
||||
string_.h, sys, sys_time_.h, unistd_.h, wchar_.h, wctype_.h.
|
||||
Remove localedir.h, size_max.h, xsize.h.
|
||||
* src/xheader.c: Don't include stpcpy.h; no longer needed, now that
|
||||
gnulib string.h defines stpcpy on all platforms.
|
||||
|
||||
2007-01-23 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* doc/tar.texi: Document --exclude-caches* and --exclude-tag*
|
||||
options.
|
||||
* src/common.h (exclude_caches_option): Remove
|
||||
(enum exclusion_tag_type): New data type
|
||||
(add_exclude_tag): Rename to add_exclusion_tag
|
||||
(cachedir_file_p): New prototype
|
||||
* src/create.c (struct exclude_tag): rename to exclusion_tag
|
||||
(check_exclusion_tags): New function
|
||||
(cachedir_file_p): New function (from check_cache_directory)
|
||||
(dump_dir0,dump_file0): Use check_exclusion_tags
|
||||
* src/tar.c: New options --exclude-caches-all,
|
||||
--exclude-caches-under, --exclude-tag-all, --exclude-tag-under
|
||||
* tests/exclude.at: New file
|
||||
* tests/Makefile.am (TESTSUITE_AT): Add exclude.at
|
||||
* tests/testsuite.at: Add exclude.at
|
||||
|
||||
2007-01-19 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* gnulib.modules: Require strerror
|
||||
* doc/gendocs_template: Fix typos
|
||||
* scripts/xsparse.c (expand_sparse): use ftruncate to handle the
|
||||
trailing hole
|
||||
* src/sparse.c (sparse_skip_file,pax_dump_header_1)
|
||||
(pax_decode_header): Keep track of the number of bytes
|
||||
written.
|
||||
* configure.ac: Version 1.16.2
|
||||
* NEWS: Update
|
||||
|
||||
2007-01-04 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/compare.c (diff_dumpdir): Compare directory contents using
|
||||
dumpdir_cmp. Do not free dumpdir_buffer, it will leave the
|
||||
incremental directory table in the inconsistent state and trigger
|
||||
full dump.
|
||||
(read_and_process): Process dumpdirs no matter what the archive
|
||||
format.
|
||||
* src/incremen.c (list_dumpdir): Minor fixes.
|
||||
|
||||
* src/compare.c (read_and_process): Fix type of "size"
|
||||
|
||||
2006-12-13 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* tests/T-null.at: Skip the test if genfile is not able to create
|
||||
the filename with an embedded newline.
|
||||
|
||||
2006-12-12 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
Port to Forte Developer 7 C 5.4 and C99.
|
||||
* src/common.h (add_exclude_tag): Add decl; C99 requires this
|
||||
and Forte warns about it.
|
||||
* src/incremen.c: Include <mkdtemp.h> for mkdtemp prototype,
|
||||
for same reason.
|
||||
* src/misc.c (get_max_open_files): Rewrite to avoid code that
|
||||
Forte C complains about as being unreachable.
|
||||
* src/xheader.c (mtime_code): Rewrite to avoid Forte error
|
||||
reported by Trond Hasle Amundsen.
|
||||
|
||||
* src/incremen.c (compare_dirnames): Rewrite to avoid casts.
|
||||
* src/utf8.c (string_ascii_p): Likewise.
|
||||
* src/xheader.c (mtime_coder, volume_size_coder, volume_offset_coder):
|
||||
Likewise.
|
||||
|
||||
2006-12-08 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* bootstrap: Add paxutils files to dot_ignore.
|
||||
|
||||
* configure.ac: Raise version number to 1.16.1
|
||||
* bootstrap (slurp): Create .(cvs|git)ignore if not present
|
||||
* po/.cvsignore, m4/.cvsignore: Remove automatically generated
|
||||
files.
|
||||
|
||||
2006-12-07 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* NEWS: Update
|
||||
* Makefile.am (distclean-local): Fixed
|
||||
* doc/tar.texi: Update documentation of --exclude-tag
|
||||
* src/create.c (dump_dir0): Move checks for exclude tags to
|
||||
dump_file0.
|
||||
(dump_dir): Move calls to ensure_slash to dump_file0
|
||||
* src/extract.c (extract_file): Call skip_member if open fails.
|
||||
Patch proposed by Jan-Benedict Glaw <jbglaw@lug-owl.de>
|
||||
* tests/truncate.at: Use genfile instead of dd, because on some
|
||||
systems /dev/zero is not available.
|
||||
|
||||
2006-12-04 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* NEWS: Fix some race conditions with tar -x --same-owner.
|
||||
* src/extract.c (ARCHIVED_PERMSTATS): Add a comment saying that
|
||||
S_IRWXG | S_IRWXO might be masked out.
|
||||
(set_mode): Set the mode if some bits were masked out originally.
|
||||
(set_stat): Don't chmod before chown, as that might temporarily
|
||||
grant permissions that we don't want to grant. The chmod was
|
||||
there only to work around broken hosts, so add a comment advising
|
||||
users not to use those broken hosts instead.
|
||||
(repair_delayed_set_stat, extract_dir):
|
||||
Remember to mask out current umask before inverting permissions.
|
||||
(extract_dir): If the owner might change, or if the mode has
|
||||
special bits, create the directory 700 at first, but restore it later.
|
||||
(open_output_file): New arg mode; all uses changed.
|
||||
(extract_file, extract_node, extract_fifo): If the owner might
|
||||
change, omit group and other bits at first, but restore them after
|
||||
changing the owner.
|
||||
|
||||
2006-12-04 Jim Meyering <jim@meyering.net>
|
||||
|
||||
* doc/tar.texi (Long Options): Remove doubled word.
|
||||
|
||||
2006-11-30 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/xheader.c (xheader_read): Remove unused variable
|
||||
|
||||
* po/POTFILES.in: Remove src/mangle.c
|
||||
|
||||
* bootstrap: Implement --update-po and .bootstrap
|
||||
|
||||
* src/create.c (dump_dir0): Implement --exclude-tag option
|
||||
* src/tar.c: Likewise
|
||||
* doc/tar.texi (exclude): Document --exclude-tag
|
||||
|
||||
2006-11-29 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* NEWS: Remove support for mangled names.
|
||||
* doc/tar.texi (verbose tutorial): Likewise.
|
||||
* src/Makefile.am (tar_SOURCES): Remove mangle.c.
|
||||
* src/common.h (extract_mangle): Remove decl.
|
||||
* src/extract.c (extract_mangle_wrapper): Remove.
|
||||
(prepare_to_extract): Remove support for mangled names.
|
||||
* src/list.c (read_and, print_header): Likewise.
|
||||
* src/mangle.c: Remove.
|
||||
* src/tar.h (GNUTYPE_NAMES): Remove.
|
||||
|
||||
Port to latest gnulib. There were a lot of changes, so the
|
||||
simplest way to get this up and running was to switch to coreutils
|
||||
bootstrap procedure. I noticed one feature missing after this
|
||||
merge: the ability to update a single .po file. I can add that
|
||||
later if need be.
|
||||
* README-cvs, bootstrap.conf: New files.
|
||||
* lib/.cvsignore: Remove Makefile.am, printf-parse.c, vasnprintf.c.
|
||||
Add fstatat.c, gnulib.mk, openat-proc.c, same-inode.h, stat_.h,
|
||||
tempname.c, tempname.h, uinttostr.c.
|
||||
* lib/printf-parse.c, lib/vasnprintf.c: New files, from coreutils,
|
||||
to override gnulib, so that we don't need xsize.h.
|
||||
* bootstrap: Replace with coreutils bootstrap, except add support
|
||||
for paxutils.
|
||||
* configure.ac (gl_USE_SYSTEM_EXTENSIONS): Remove, as gl_EARLY now
|
||||
does this.
|
||||
(gl_EARLY, gl_INIT): Add.
|
||||
(tar_GNULIB): Remove.
|
||||
* gnulib.modules: Add configmake.
|
||||
* lib/Makefile.tmpl: Remove, replacing with....
|
||||
* lib/Makefile.am: New file.
|
||||
* src/Makefile.am (tar.o): Remove dependency: Automake does this
|
||||
for us.
|
||||
* src/tar.c: Include <configmake.h> and <rmt-command.h>, not
|
||||
<localedir.h>.
|
||||
|
||||
2006-11-13 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/xheader.c (mtime_coder): Treat non-null data as a pointer to
|
||||
struct timespec, overriding st->mtime
|
||||
* src/create.c (start_header): Pass mtime as a call-specific data
|
||||
to xheader_store.
|
||||
|
||||
* tests/truncate.at: Do not use 'k' modifier in dd options.
|
||||
* tests/append02.at: Do not depend on command timing.
|
||||
|
||||
2006-11-01 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/tar.c (enum read_file_list_state.file_list_skip): New value
|
||||
(read_name_from_file): Skip zero-length entries
|
||||
|
||||
* tests/T-empty.at: New test case
|
||||
* tests/T-null.at: New test case
|
||||
* tests/extrac07.at: New test case
|
||||
* tests/Makefile.am: Add new test cases.
|
||||
* tests/testsuite.at: Add new test cases.
|
||||
* tests/extrac02.at: Add more keywords
|
||||
* tests/extrac04.at: Likewise
|
||||
* tests/extrac06.at: Likewise
|
||||
* tests/shortrec.at: Do not assume tar's default archive is stdout
|
||||
|
||||
2006-10-31 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* src/extract.c, src/xheader.c: Call last_component instead of
|
||||
base_name. The latter returns a malloced string since 2006-03-11.
|
||||
|
||||
2006-10-21 Sergey Poznyakoff <gray@gnu.org.ua>
|
||||
|
||||
* NEWS, configure.ac: Version 1.16
|
||||
@@ -7925,29 +8773,31 @@
|
||||
time_from_oct, uid_from_oct, uintmax_from_oct): New decls.
|
||||
(print_for_mkdir): 2nd arg is now mode_t.
|
||||
|
||||
See ChangeLog.1 for earlier changes.
|
||||
-----
|
||||
|
||||
See ChangeLog.1 for earlier changes.
|
||||
|
||||
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006
|
||||
Free Software Foundation, Inc.
|
||||
-----
|
||||
|
||||
This file is part of GNU tar.
|
||||
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
GNU tar is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
any later version.
|
||||
This file is part of GNU tar.
|
||||
|
||||
GNU tar is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
GNU tar is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU tar; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
GNU tar is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GNU tar; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
|
||||
Local Variables:
|
||||
mode: change-log
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Main Makefile for GNU tar.
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2003 Free
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2003, 2007 Free
|
||||
# Software Foundation, Inc.
|
||||
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2, or (at your option)
|
||||
## the Free Software Foundation; either version 3, or (at your option)
|
||||
## any later version.
|
||||
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
@@ -28,4 +28,4 @@ dist-hook:
|
||||
GZIP=$(GZIP_ENV) gzip -c > $(distdir).cpio.gz
|
||||
|
||||
distclean-local:
|
||||
-rm -f $(PACKAGE)-$(VERSION).cpio.gz
|
||||
-rm -f $(distdir).cpio.gz
|
||||
|
||||
253
NEWS
253
NEWS
@@ -1,5 +1,228 @@
|
||||
GNU tar NEWS - User visible changes.
|
||||
GNU tar NEWS - User visible changes. 2008-12-27
|
||||
Please send GNU tar bug reports to <bug-tar@gnu.org>
|
||||
|
||||
|
||||
version 1.21 - Sergey Poznyakoff, 2008-12-27
|
||||
|
||||
* New short option -J
|
||||
|
||||
A shortcut for --lzma.
|
||||
|
||||
* New option --lzop
|
||||
|
||||
* New option --no-auto-compress
|
||||
|
||||
Cancels the effect of previous --auto-compress (-a) option.
|
||||
|
||||
* New option --no-null
|
||||
|
||||
Cancels the effect of previous --null option.
|
||||
|
||||
* Compressed format recognition
|
||||
|
||||
If tar is unable to determine archive compression format, it falls
|
||||
back to using archive suffix to determine it.
|
||||
|
||||
* VCS support.
|
||||
|
||||
Using --exclude-vcs handles also files used internally by Bazaar,
|
||||
Mercurial and Darcs.
|
||||
|
||||
* Transformation scope flags
|
||||
|
||||
Name transformation expressions understand additional flags that
|
||||
control type of archive members affected by them. The flags are:
|
||||
|
||||
- r
|
||||
Apply transformation to regular archive members.
|
||||
|
||||
- s
|
||||
Apply transformation to symbolic link targets.
|
||||
|
||||
- h
|
||||
Apply transformation to hard link targets.
|
||||
|
||||
Corresponding upper-case letters negate the meaning, so that
|
||||
`H' means ``do not apply transformation to hard link targets.''
|
||||
|
||||
The scope flags are listed in the third part of an `s' expression,
|
||||
e.g.:
|
||||
|
||||
tar --transform 's|^|/usr/local/|S'
|
||||
|
||||
Default is `rsh', which means that transformations are applied to
|
||||
both regular archive members and to the targets of symbolic and hard
|
||||
links. If several transform expressions are used, the default flags
|
||||
can be changed using `flags=' statement before the expressions, e.g.:
|
||||
|
||||
tar --transform 'flags=S;s|^|/usr/local/|S'
|
||||
|
||||
* Bugfixes
|
||||
|
||||
** The --null option disabled handling of tar options in list files. This
|
||||
is fixed.
|
||||
** Fixed record size autodetection. If detected record size differs from
|
||||
the expected value (either default, or set on the command line), tar
|
||||
always prints a warning if verbosity level is set to 1 or greater,
|
||||
i.e. if either -t or -v option is given.
|
||||
|
||||
|
||||
|
||||
version 1.20 - Sergey Poznyakoff, 2008-04-14
|
||||
|
||||
* New option --auto-compress (-a)
|
||||
|
||||
With --create, selects compression algorithm basing on the suffix
|
||||
of the archive file name.
|
||||
|
||||
* New option --lzma
|
||||
|
||||
Selects LZMA compression algorithm
|
||||
|
||||
* New option --hard-dereference
|
||||
|
||||
During archive creation, dereferences hard links and stores the files
|
||||
they refer to, instead of creating usual hard link members (type '1').
|
||||
|
||||
* New option --checkpoint-action
|
||||
|
||||
This action allows to specify an action to be executed upon hitting a
|
||||
checkpoint. Recognized actions are: dot, echo (the default),
|
||||
echo=string, ttyout=string, exec=cmdline, and sleep=value. Any number
|
||||
of `--checkpoint-action' options can be specified, the actions will be
|
||||
executed in order of their appearance in the command line. See
|
||||
chapter 3.8 "Checkpoints" for a complete description.
|
||||
|
||||
* New options --no-check-device, --check-device.
|
||||
|
||||
The `--no-check-device' option disables comparing device numbers during
|
||||
preparatory stage of an incremental dump. This allows to avoid
|
||||
creating full dumps if the device numbers change (e.g. when using an
|
||||
LVM snapshot).
|
||||
|
||||
The `--check-device' option enables comparing device numbers. This is
|
||||
the default. This option is provided to undo the effect of the previous
|
||||
`--no-check-device' option, e.g. if it was set in TAR_OPTIONS
|
||||
environment variable.
|
||||
|
||||
* The --transform option.
|
||||
|
||||
Any number of `--transform' options can be given in the command line.
|
||||
The specified transformations will be applied in turn.
|
||||
|
||||
The argument to `--transform' option can be a list of replace
|
||||
expressions, separated by a semicolon (as in `sed').
|
||||
|
||||
Filename transformations are applied to symbolic link targets
|
||||
during both creation and extraction. Tar 1.19 used them only
|
||||
during extraction.
|
||||
|
||||
For a detailed description, see chapter 6.7 "Modifying File and Member
|
||||
Names".
|
||||
|
||||
* Info (end-of-volume) scripts
|
||||
|
||||
The value of the blocking factor is made available to info and
|
||||
checkpoint scripts via environment variable TAR_BLOCKING_FACTOR.
|
||||
|
||||
* Incremental archives
|
||||
|
||||
Improved (sped up) extracting from incremental archives.
|
||||
|
||||
* Bugfixes.
|
||||
** Fix bug introduced in version 1.19: tar refused to update non-existing
|
||||
archives.
|
||||
|
||||
|
||||
version 1.19 - Sergey Poznyakoff, 2007-10-10
|
||||
|
||||
* New option --exclude-vcs
|
||||
|
||||
Excludes directories and files, created by several widely used version
|
||||
control systems, e.g. "CVS/", ".svn/", etc.
|
||||
|
||||
* --exclude-tag and --exclude-cache options
|
||||
|
||||
The following options now work with incremental archives as well:
|
||||
|
||||
--exclude-caches
|
||||
--exclude-caches-all
|
||||
--exclude-tag
|
||||
--exclude-tag-all
|
||||
--exclude-tag-under
|
||||
|
||||
* Fix handling of renamed files in listed incremental archives.
|
||||
|
||||
Previous versions always stored absolute file names in rename
|
||||
records, even if -P was not used. This is fixed: rename records
|
||||
contain file names processed in accordance with the command line
|
||||
settings.
|
||||
|
||||
* Fix --version output.
|
||||
|
||||
* Recognition of broken archives.
|
||||
|
||||
When supplied an archive smaller than 512 bytes in reading mode (-x,
|
||||
-t), the previous version of tar silently ignored it, exiting with
|
||||
code 0. It is fixed. Tar now issues the following diagnostic message:
|
||||
'This does not look like a tar archive', and exits with code 2.
|
||||
|
||||
* Fix double-dot recognition in archive member names in case of duplicate '/.'.
|
||||
|
||||
* Fix file padding in case of truncation of the input file to zero size.
|
||||
|
||||
|
||||
version 1.18 - Sergey Poznyakoff, 2007-06-29
|
||||
|
||||
* Licensed under the GPLv3
|
||||
|
||||
* Fixed several bugs in the testsuite
|
||||
|
||||
|
||||
version 1.17 - Sergey Poznyakoff, 2007-06-08
|
||||
|
||||
* Fix archivation of sparse files in posix mode. Previous versions padded
|
||||
sparse members with spurious zero blocks.
|
||||
|
||||
* Fix operation of --verify --listed-incremental. Version 1.16.1 produced
|
||||
a full dump when both options were given.
|
||||
|
||||
* Fix --occurrence. In previous versions it continued scanning the archive
|
||||
even though all requested members has already been extracted.
|
||||
|
||||
* Scope of --transform and --strip-components options.
|
||||
|
||||
In addition to affecting regular archive members, the --transform
|
||||
option affects hard and soft link targets and the --strip-components
|
||||
option affects hard link targets as well.
|
||||
|
||||
* End-of-volume script can send the new volume name to tar by writing
|
||||
it to the file descriptor stored in the environment variable `TAR_FD'.
|
||||
|
||||
|
||||
version 1.16.1 - Sergey Poznyakoff, 2006-12-09
|
||||
|
||||
* New option --exclude-tag allows to specify "exclusion tag files", i.e.
|
||||
files whose presence in a directory means that the directory should not
|
||||
be archived.
|
||||
|
||||
* The --exclude-cache option excludes directories that contain the
|
||||
CACHEDIR.TAG file from being archived. Previous versions excluded
|
||||
directory contents only, while the directories themselves were
|
||||
still added to the archive.
|
||||
|
||||
* Support for reading ustar type 'N' header logical records has been removed.
|
||||
This GNU extension was generated only by very old versions of GNU 'tar'.
|
||||
Unfortunately its implementation had security holes; see
|
||||
<http://archives.neohapsis.com/archives/fulldisclosure/2006-11/0344.html>.
|
||||
We don't expect that any tar archives in practical use have type 'N'
|
||||
records, but if you have one and you trust its contents, you can
|
||||
decode it with GNU tar 1.16 or earlier.
|
||||
|
||||
* Race conditions have been fixed that in some cases briefly allowed
|
||||
files extracted by 'tar -x --same-owner' (or plain 'tar -x', when
|
||||
running as root) to be accessed by users that they shouldn't have been.
|
||||
|
||||
|
||||
version 1.16 - Sergey Poznyakoff, 2006-10-21
|
||||
|
||||
@@ -8,7 +231,7 @@ changed while being read. Previous versions exited with code 2 (fatal
|
||||
error), and only if some files were truncated while being archived.
|
||||
|
||||
* New option --mtime allows to set modification times for all archive
|
||||
members during creation.
|
||||
members during creation.
|
||||
|
||||
* Bug fixes
|
||||
** Avoid running off file descriptors when using multiple -C options.
|
||||
@@ -34,14 +257,14 @@ no longer uses globbing by default. For example, the above invocation
|
||||
is now interpreted as a request to extract from the archive the file
|
||||
named '*.c'.
|
||||
|
||||
To treat member names as globbing patterns, use --wildcards option.
|
||||
To treat member names as globbing patterns, use --wildcards option.
|
||||
If you wish tar to mimic the behavior of versions up to 1.15.90,
|
||||
add --wildcards to the value of the environment variable TAR_OPTIONS.
|
||||
|
||||
The exact way in which tar interprets member names is controlled by the
|
||||
following command line options:
|
||||
|
||||
--wildcards use wildcards
|
||||
--wildcards use wildcards
|
||||
--anchored patterns match file name start
|
||||
--ignore-case ignore case
|
||||
--wildcards-match-slash wildcards match `/'
|
||||
@@ -49,7 +272,7 @@ following command line options:
|
||||
Each of these options has a '--no-' counterpart that disables its
|
||||
effect (e.g. --no-wildcards).
|
||||
|
||||
These options affect both the interpretation of member names from
|
||||
These options affect both the interpretation of member names from
|
||||
command line and that of the exclusion patterns (given with --exclude
|
||||
and --exclude-from options). The defaults are:
|
||||
|
||||
@@ -65,7 +288,7 @@ case-sensitive matching for the rest of command line, one could write:
|
||||
|
||||
** Short option -l is now an alias of --check-links option, which complies
|
||||
with UNIX98. This ends the transition period started with version 1.14.
|
||||
|
||||
|
||||
* New features
|
||||
|
||||
** New option --transform allows to transform file names before storing them
|
||||
@@ -80,19 +303,19 @@ will add 'prefix/' to all file names stored in foo.tar.
|
||||
versions it worked only with --extract.
|
||||
|
||||
** New option --show-transformed-names enables display of transformed file
|
||||
or archive. It generalizes --show-stored-names option, introduced in
|
||||
1.15.90. In particular, when creating an archive in verbose mode, it lists
|
||||
or archive. It generalizes --show-stored-names option, introduced in
|
||||
1.15.90. In particular, when creating an archive in verbose mode, it lists
|
||||
member names as stored in the archive, i.e., with any eventual prefixes
|
||||
removed and file name transformations applied. The option is useful,
|
||||
for example, while comparing `tar cv' and `tar tv' outputs.
|
||||
|
||||
** New incremental snapshot file format keeps information about file names
|
||||
** New incremental snapshot file format keeps information about file names
|
||||
as well as that about directories.
|
||||
|
||||
** The --checkpoint option takes an optional argument specifying the number
|
||||
of records between the two successive checkpoints. Optional dot
|
||||
starting the argument intructs tar to print dots instead of textual
|
||||
checkpoints.
|
||||
checkpoints.
|
||||
|
||||
** The --totals option can be used with any tar operation (previous versions
|
||||
understood it only with --create). If an argument to this option is
|
||||
@@ -184,7 +407,7 @@ Consequently, the file pointer was set off and the next member
|
||||
was not processed correctly.
|
||||
** Previous version created invalid archives when files shrink
|
||||
during reading.
|
||||
** Compare mode (tar d) hanged when trying to compare file contents.
|
||||
** Compare mode (tar d) hung when trying to compare file contents.
|
||||
** Previous versions in certain cases failed to restore directory
|
||||
modification times.
|
||||
** When creating an archive, do not attempt to store files whose
|
||||
@@ -841,13 +1064,13 @@ Versions 1.07 back to 1.00 by Jay Fenlason.
|
||||
|
||||
|
||||
Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003,
|
||||
2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU tar.
|
||||
|
||||
GNU tar is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU tar is distributed in the hope that it will be useful,
|
||||
@@ -863,4 +1086,8 @@ Boston, MA 02110-1301, USA.
|
||||
Local variables:
|
||||
mode: outline
|
||||
paragraph-separate: "[ ]*$"
|
||||
eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
time-stamp-start: "changes. "
|
||||
time-stamp-format: "%:y-%02m-%02d"
|
||||
time-stamp-end: "\n"
|
||||
end:
|
||||
|
||||
6
PORTS
6
PORTS
@@ -145,13 +145,13 @@ See the end of file for copying conditions.
|
||||
|
||||
* Copyright notice
|
||||
|
||||
Copyright (C) 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2001, 2003, 2004, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU tar.
|
||||
|
||||
GNU tar is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU tar is distributed in the hope that it will be useful,
|
||||
@@ -170,4 +170,4 @@ mode: outline
|
||||
paragraph-separate: "[ ]*$"
|
||||
version-control: never
|
||||
End:
|
||||
|
||||
|
||||
|
||||
4
README
4
README
@@ -223,13 +223,13 @@ and share your findings by writing to <bug-tar@gnu.org>.
|
||||
* Copying
|
||||
|
||||
Copyright (C) 1990, 1991, 1992, 1994, 1997, 1998, 1999, 2000,
|
||||
2001, 2003, 2004 Free Software Foundation, Inc.
|
||||
2001, 2003, 2004, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU tar.
|
||||
|
||||
GNU tar is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU tar is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -62,13 +62,13 @@ some other value.
|
||||
|
||||
|
||||
|
||||
Copyright (C) 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU tar.
|
||||
|
||||
GNU tar is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU tar is distributed in the hope that it will be useful,
|
||||
|
||||
70
README-cvs
Normal file
70
README-cvs
Normal file
@@ -0,0 +1,70 @@
|
||||
-*- outline -*-
|
||||
|
||||
These notes intend to help people working on the CVS version of
|
||||
this package.
|
||||
|
||||
* Requirements
|
||||
|
||||
Only the sources are installed in the CVS repository (to ease the
|
||||
maintenance, merges etc.), therefore you will have to get the latest
|
||||
stable versions of the maintainer tools we depend upon, including:
|
||||
|
||||
- Automake <http://www.gnu.org/software/automake/>
|
||||
- Autoconf <http://www.gnu.org/software/autoconf/>
|
||||
- Bison <http://www.gnu.org/software/bison/>
|
||||
- Gettext <http://www.gnu.org/software/gettext/>
|
||||
- Gzip <http://www.gnu.org/software/gzip/>
|
||||
- Tar <http://www.gnu.org/software/tar/>
|
||||
- Wget <http://www.gnu.org/software/wget/>
|
||||
|
||||
As of this writing, the latest stable version of Gzip is 1.2.4 but we
|
||||
suggest using test version 1.3.5 (or later, if one becomes available).
|
||||
|
||||
Valgrind <http://valgrind.org/> is also highly recommended, if
|
||||
Valgrind supports your architecture.
|
||||
|
||||
Only building the initial full source tree will be a bit painful,
|
||||
later, a plain `cvs update -P && make' should be sufficient.
|
||||
|
||||
* First CVS checkout
|
||||
|
||||
Obviously, if you are reading these notes, you did manage to check out
|
||||
this package from CVS. The next step is to get other files needed to
|
||||
build, which are extracted from other source packages:
|
||||
|
||||
$ ./bootstrap
|
||||
|
||||
And there you are! Just
|
||||
|
||||
$ ./configure
|
||||
$ make
|
||||
$ make check
|
||||
|
||||
At this point, there should be no difference between your local copy,
|
||||
and the CVS master copy:
|
||||
|
||||
$ cvs diff
|
||||
|
||||
should output no difference.
|
||||
|
||||
Enjoy!
|
||||
|
||||
-----
|
||||
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA.
|
||||
18
THANKS
18
THANKS
@@ -1,11 +1,6 @@
|
||||
GNU tar THANKS file
|
||||
|
||||
Public domain tar was written by John Gilmore, with contributions
|
||||
from Henry Spencer, Fred Fish, Ian Darwin, Geoff Collyer, Stan Barber,
|
||||
Guy Harris, Dave Brower, Richard Todd, Michael Rendell, Stu Heiss and
|
||||
Rich $alz. The FSF version, named GNU tar, was derived from PDTAR by
|
||||
Jay Fenlason and Joy Kendall, and was maintained in turn by François
|
||||
Pinard, Paul Eggert and Sergey Poznyakoff.
|
||||
Please see the AUTHORS file for the list of principal authors.
|
||||
|
||||
Many people further contributed to GNU tar by reporting problems,
|
||||
suggesting various improvements or submitting actual code. Here is a
|
||||
@@ -107,9 +102,11 @@ Clinton Carr clint@netcom.com
|
||||
Conrad Hughes chughes@maths.tcd.ie
|
||||
Constantin Belous const@cris.net
|
||||
Coranth Gryphon gryphon@bur.visidyne.com
|
||||
Cyril Strejc strejc@unicontrols.cz
|
||||
Dale R. Worley worley@world.std.com
|
||||
Dale Wiles wiles@geordi.calspan.com
|
||||
Dan Bloch dan@transarc.com
|
||||
Dan Drake dan@dandrake.org
|
||||
Dan Reish dreish@izzy.net
|
||||
Daniel Hagerty hag@gnu.org
|
||||
Daniel Quinlan quinlan@pathname.com
|
||||
@@ -150,12 +147,14 @@ Drew Sullivan drew@sni.ca
|
||||
Drew Trieger trieger@woodstock.abbott.com
|
||||
Dunstan Vavasour dev@cegelecproj.co.uk
|
||||
Ed Childs echilds@bgs.com
|
||||
Ed Leaver ewleaver@comcast.net
|
||||
Edgar Taube et@immd8.informatik.uni-erlangen.de
|
||||
Eduardo Kortright eduardo@cs.ua.edu
|
||||
Eduardo V. de Rivas eddie@asterion.com
|
||||
Edward Welbourne eddy@gen.cam.ac.uk
|
||||
Elmar Heeb heeb@itp.ethz.ch
|
||||
Elmer Fittery elmerf@ptw.com
|
||||
Enric Hernandez ehernandez@notariado.org
|
||||
Eric Backus ericb@lsid.hp.com
|
||||
Eric Benson eb@amazon.com
|
||||
Eric Blake ebb9@byu.net
|
||||
@@ -222,10 +221,12 @@ Janne Snabb snabb@niksula.hut.fi
|
||||
Jason R. Mastaler jason@webmaster.net
|
||||
Jason Armistead Jason.Armistead@otis.com
|
||||
Jay Fenlason hack@gnu.org
|
||||
Jean-Louis Martineau martineau@zmanda.com
|
||||
Jean-Michel Soenen soenen@lectra.fr
|
||||
Jean-Ph. Martin-Flatin syj@ecmwf.int
|
||||
Jean-loup Gailly jloup@chorus.fr
|
||||
Jean-Loup Gailly jloup@chorus.fr
|
||||
Jeff Moskow jeff@rtr.com
|
||||
Jean-Ph. Martin-Flatin syj@ecmwf.int
|
||||
Jean-Pierre Demailly Jean-Pierre.Demailly@ujf-grenoble.fr
|
||||
Jeff Prothero jsp@betz.biostr.washington.edu
|
||||
Jeff Siegel js@hornet.att.com
|
||||
Jeff Sorensen sorenj@alumni.rpi.edu
|
||||
@@ -295,6 +296,7 @@ Konno Hiroharu konno@pac.co.jp
|
||||
Kurt Jaeger pi@lf.net
|
||||
Larry Creech lcreech@lonestar.rcclub.org
|
||||
Larry Schwimmer rosebud@cyclone.stanford.edu
|
||||
Lasse Collin lasse.collin@tukaani.org
|
||||
Laurent Caillat-Vallet caillat@noe.lyon.cemagref.fr
|
||||
Laurent Sainte-Marthe smarthe@genethon.fr
|
||||
Leland Lucius llucius@tiny.net
|
||||
|
||||
10
TODO
10
TODO
@@ -1,5 +1,7 @@
|
||||
Suggestions for improving GNU tar.
|
||||
|
||||
* <45BEC0DB.8040903@unix-beratung.de>
|
||||
|
||||
* Incorporate fixes from major distributions, e.g., Debian GNU/Linux.
|
||||
|
||||
* Add support for restoring file time stamps to sub-second resolution,
|
||||
@@ -10,10 +12,6 @@ Suggestions for improving GNU tar.
|
||||
|
||||
* --append should bail out if the two archives are of different types.
|
||||
|
||||
* Add support for GNU private keywords in POSIX 1003.1-2001 headers,
|
||||
so that the GNU extensions (--incremental, --label and
|
||||
--multi-volume) may be used with POSIX archives.
|
||||
|
||||
* Add support for a 'pax' command that conforms to POSIX 1003.1-2001.
|
||||
This would unify paxutils with tar.
|
||||
|
||||
@@ -47,13 +45,13 @@ so that the GNU extensions (--incremental, --label and
|
||||
|
||||
* Copyright notice
|
||||
|
||||
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU tar.
|
||||
|
||||
GNU tar is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
GNU tar is distributed in the hope that it will be useful,
|
||||
|
||||
795
bootstrap
795
bootstrap
@@ -2,11 +2,11 @@
|
||||
|
||||
# Bootstrap this package from CVS.
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -21,10 +21,8 @@
|
||||
|
||||
# Written by Paul Eggert and Sergey Poznyakoff.
|
||||
|
||||
package=tar
|
||||
|
||||
# Translation Project URL, for the registry of all projects.
|
||||
TP_URL='http://www.iro.umontreal.ca/translation/registry.cgi?domain='
|
||||
nl='
|
||||
'
|
||||
|
||||
# Ensure file names are sorted consistently across platforms.
|
||||
# Also, ensure diagnostics are in English, e.g., "wget --help" below.
|
||||
@@ -32,217 +30,289 @@ LC_ALL=C
|
||||
export LC_ALL
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
usage: $0 [--gnulib-srcdir=DIR][--paxutils-srcdir=DIR][--cvs-auth=AUTH-METHOD][--cvs-user=USERNAME][--no-po]
|
||||
Options are:
|
||||
--paxutils-srcdir=DIRNAME Specify the local directory where paxutils
|
||||
sources reside. Use this if you already
|
||||
have paxutils sources on your machine, and
|
||||
do not want to waste your bandwidth dowloading
|
||||
them again.
|
||||
--gnulib-srcdir=DIRNAME Specify the local directory where gnulib
|
||||
sources reside. Use this if you already
|
||||
have gnulib sources on your machine, and
|
||||
do not want to waste your bandwidth dowloading
|
||||
them again.
|
||||
--cvs-auth=METHOD Set the CVS access method used for downloading
|
||||
gnulib files. METHOD is one of the keywords
|
||||
accepted by cvs -d option (see info cvs
|
||||
repository).
|
||||
--cvs-user=USERNAME Set the CVS username to be used when accessing
|
||||
the gnulib repository.
|
||||
--no-po Do not download po files.
|
||||
--update-po[=LANG] Update po file(s) and exit.
|
||||
echo >&2 "\
|
||||
Usage: $0 [OPTION]...
|
||||
Bootstrap this package from the checked-out sources.
|
||||
|
||||
If the file \`.bootstrap' exists in the current working directory, its
|
||||
contents is read, comments and empty lines removed, shell variables expanded
|
||||
and the result is prepended to the command line options.
|
||||
Options:
|
||||
--paxutils-srcdir=DIRNAME Specify the local directory where paxutils
|
||||
sources reside. Use this if you already
|
||||
have paxutils sources on your machine, and
|
||||
do not want to waste your bandwidth dowloading
|
||||
them again.
|
||||
--gnulib-srcdir=DIRNAME Specify the local directory where gnulib
|
||||
sources reside. Use this if you already
|
||||
have gnulib sources on your machine, and
|
||||
do not want to waste your bandwidth dowloading
|
||||
them again.
|
||||
--copy Copy files instead of creating symbolic links.
|
||||
--force Attempt to bootstrap even if the sources seem
|
||||
not to have been checked out.
|
||||
--skip-po Do not download po files.
|
||||
--update-po Update po files and exit.
|
||||
--cvs-user=USERNAME Set the CVS username to be used when accessing
|
||||
the paxutils repository.
|
||||
|
||||
Running without arguments will suffice in most cases. It is equivalent
|
||||
to
|
||||
If the file bootstrap.conf exists in the current working directory, its
|
||||
contents are read as shell variables to configure the bootstrap.
|
||||
|
||||
./bootstrap --cvs-auth=pserver
|
||||
Local defaults can be provided by placing the file \`.bootstrap' in the
|
||||
current working directory. The file is read after bootstrap.conf, comments
|
||||
and empty lines are removed, shell variables expanded and the result is
|
||||
prepended to the command line options.
|
||||
|
||||
EOF
|
||||
Running without arguments will suffice in most cases.
|
||||
"
|
||||
}
|
||||
|
||||
# Read configuration file
|
||||
checkout() {
|
||||
if [ ! -d $1 ]; then
|
||||
echo "$0: getting $1 files..."
|
||||
|
||||
case $1 in
|
||||
paxutils)
|
||||
case ${CVS_AUTH-pserver} in
|
||||
pserver)
|
||||
CVS_PREFIX=':pserver:anonymous@';;
|
||||
ssh)
|
||||
CVS_PREFIX="$CVS_USER${CVS_USER+@}";;
|
||||
*)
|
||||
echo "$0: $CVS_AUTH: Unknown CVS access method" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
case $CVS_RSH in
|
||||
'') CVS_RSH=ssh; export CVS_RSH;;
|
||||
esac
|
||||
|
||||
CVSURL=${CVS_PREFIX}cvs.savannah.gnu.org:/cvsroot/"$1"
|
||||
;;
|
||||
|
||||
gnulib)
|
||||
CVSURL=:pserver:anonymous@pserver.git.sv.gnu.org:/gnulib.git
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
trap "cleanup $1" 1 2 13 15
|
||||
|
||||
cvs -z3 -q -d $CVSURL co $1 || cleanup $1
|
||||
|
||||
trap - 1 2 13 15
|
||||
fi
|
||||
}
|
||||
|
||||
cleanup() {
|
||||
status=$?
|
||||
rm -fr $1
|
||||
exit $status
|
||||
}
|
||||
|
||||
# Configuration.
|
||||
|
||||
# List of gnulib modules needed.
|
||||
gnulib_modules=
|
||||
|
||||
# Any gnulib files needed that are not in modules.
|
||||
gnulib_files=
|
||||
|
||||
# The command to download all .po files for a specified domain into
|
||||
# a specified directory. Fill in the first %s is the domain name, and
|
||||
# the second with the destination directory. Use rsync's -L and -r
|
||||
# options because the latest/%s directory and the .po files within are
|
||||
# all symlinks.
|
||||
po_download_command_format=\
|
||||
"rsync -Lrtvz 'translationproject.org::tp/latest/%s/' '%s'"
|
||||
|
||||
extract_package_name='
|
||||
/^AC_INIT(/{
|
||||
/.*,.*,.*,/{
|
||||
s///
|
||||
s/[][]//g
|
||||
p
|
||||
q
|
||||
}
|
||||
s/AC_INIT(\[*//
|
||||
s/]*,.*//
|
||||
s/^GNU //
|
||||
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
s/[^A-Za-z0-9_]/-/g
|
||||
p
|
||||
}
|
||||
'
|
||||
package=`sed -n "$extract_package_name" configure.ac` || exit
|
||||
|
||||
# Extra files from gnulib, which override files from other sources.
|
||||
gnulib_extra_files='
|
||||
build-aux/announce-gen
|
||||
build-aux/install-sh
|
||||
build-aux/missing
|
||||
build-aux/mdate-sh
|
||||
build-aux/texinfo.tex
|
||||
build-aux/depcomp
|
||||
build-aux/config.guess
|
||||
build-aux/config.sub
|
||||
doc/INSTALL
|
||||
'
|
||||
|
||||
# Other locale categories that need message catalogs.
|
||||
EXTRA_LOCALE_CATEGORIES=
|
||||
|
||||
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
||||
XGETTEXT_OPTIONS='\\\
|
||||
--flag=_:1:pass-c-format\\\
|
||||
--flag=N_:1:pass-c-format\\\
|
||||
--flag=error:3:c-format --flag=error_at_line:5:c-format\\\
|
||||
'
|
||||
|
||||
# Files we don't want to import.
|
||||
excluded_files=
|
||||
|
||||
# File that should exist in the top directory of a checked out hierarchy,
|
||||
# but not in a distribution tarball.
|
||||
CVS_only_file=README-cvs
|
||||
|
||||
# Whether to use copies instead of symlinks.
|
||||
copy=false
|
||||
|
||||
# Override the default configuration, if necessary.
|
||||
test -r bootstrap.conf && . ./bootstrap.conf
|
||||
|
||||
# Read local configuration file
|
||||
if [ -r .bootstrap ]; then
|
||||
echo "$0: Reading configuration file .bootstrap"
|
||||
eval set -- "`sed 's/#.*$//;/^$/d' .bootstrap | tr '\n' ' '` $*"
|
||||
fi
|
||||
|
||||
# Translate configuration into internal form.
|
||||
|
||||
# Parse options.
|
||||
|
||||
DOWNLOAD_PO=yes
|
||||
for option
|
||||
do
|
||||
case $option in
|
||||
--help)
|
||||
usage
|
||||
exit;;
|
||||
--gnulib-srcdir=*)
|
||||
GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
|
||||
--paxutils-srcdir=*)
|
||||
PAXUTILS_SRCDIR=`expr "$option" : '--paxutils-srcdir=\(.*\)'`;;
|
||||
--cvs-auth=*)
|
||||
CVS_AUTH=`expr "$option" : '--cvs-auth=\(.*\)'`;;
|
||||
--gnulib-srcdir=*)
|
||||
GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
|
||||
--cvs-user=*)
|
||||
CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
|
||||
--no-po)
|
||||
DOWNLOAD_PO=no;;
|
||||
--skip-po | --no-po) # --no-po is for compatibility with 'tar' tradition.
|
||||
DOWNLOAD_PO=skip;;
|
||||
--update-po=*)
|
||||
DOWNLOAD_PO=`expr "$option" : '--update-po=\(.*\)'`;;
|
||||
--update-po)
|
||||
DOWNLOAD_PO=only;;
|
||||
--force)
|
||||
CVS_only_file=;;
|
||||
--copy)
|
||||
copy=true;;
|
||||
*)
|
||||
echo >&2 "$0: $option: unknown option"
|
||||
exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Get translations.
|
||||
|
||||
get_translations() {
|
||||
subdir=$1
|
||||
domain=$2
|
||||
po_file=$3
|
||||
|
||||
echo "$0: getting translations into $subdir for $domain..."
|
||||
|
||||
case $po_file in
|
||||
'') (cd $subdir && rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'`);;
|
||||
esac &&
|
||||
|
||||
$WGET_COMMAND -O "$subdir/$domain.html" "$TP_URL$domain" &&
|
||||
|
||||
sed -n 's|.*"http://[^"]*/translation/teams/PO/\([^/"]*\)/'"$domain"'-\([^/"]*\)\.[^."]*\.po".*|\1.\2|p' <"$subdir/$domain.html" |
|
||||
sort -k 1,1 -k 2,2n -k2,2 -k3,3n -k3,3 -k4,4n -k4,4 -k5,5n -k5.5 |
|
||||
awk -F. '
|
||||
{ if (lang && $1 != lang) print lang, ver }
|
||||
{ lang = $1; ver = substr($0, index($0, ".") + 1) }
|
||||
END { if (lang) print lang, ver }
|
||||
' |
|
||||
awk -v domain="$domain" -v po_file="$po_file" -v subdir="$subdir" '
|
||||
{
|
||||
lang = $1
|
||||
if (po_file && po_file != (lang ".po")) next
|
||||
|
||||
# Work around bugs in translations uncovered by gettext 0.15.
|
||||
# This workaround can be removed once the translations are fixed.
|
||||
if (lang == "hu" || lang == "zh_TW") next
|
||||
|
||||
ver = $2
|
||||
urlfmt = ""
|
||||
printf "$WGET_COMMAND -O %s/%s.po 'http://www.iro.umontreal.ca/translation/teams/PO/%s/%s-%s.%s.po' &&\n", subdir, lang, lang, domain, ver, lang
|
||||
}
|
||||
END { print ":" }
|
||||
' |
|
||||
sh &&
|
||||
ls "$subdir"/*.po | sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
|
||||
rm "$subdir/$domain.html"
|
||||
}
|
||||
|
||||
update_po() {
|
||||
if [ $# = 1 ]; then
|
||||
case $1 in
|
||||
*.po) POFILE=$1;;
|
||||
*) POFILE=${1}.po;;
|
||||
esac
|
||||
get_translations po $package "$POFILE"
|
||||
else
|
||||
get_translations po $package
|
||||
fi
|
||||
}
|
||||
|
||||
case $DOWNLOAD_PO in
|
||||
no) ;;
|
||||
*)
|
||||
case `wget --help` in
|
||||
*'--no-cache'*)
|
||||
no_cache='--no-cache';;
|
||||
*'--cache=on/off'*)
|
||||
no_cache='--cache=off';;
|
||||
*)
|
||||
no_cache='';;
|
||||
esac
|
||||
|
||||
WGET_COMMAND="wget -nv $no_cache"
|
||||
export WGET_COMMAND
|
||||
esac
|
||||
|
||||
case $DOWNLOAD_PO in
|
||||
only) update_po
|
||||
exit
|
||||
;;
|
||||
no|yes) ;;
|
||||
*) update_po $DOWNLOAD_PO
|
||||
exit
|
||||
esac
|
||||
|
||||
if test -n "$CVS_only_file" && test ! -r "$CVS_only_file"; then
|
||||
echo "$0: Bootstrapping from a non-checked-out distribution is risky." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$0: Bootstrapping CVS $package..."
|
||||
|
||||
build_cvs_prefix() {
|
||||
CVS_PREFIX=:${1}:
|
||||
if [ "${2}" != - ]; then
|
||||
CVS_PREFIX=${CVS_PREFIX}${2}@
|
||||
fi
|
||||
if [ "$1" = "ext" ]; then
|
||||
if [ -z "${CVS_RSH}" ]; then
|
||||
CVS_RSH=ssh
|
||||
export CVS_RSH
|
||||
# Get translations.
|
||||
|
||||
download_po_files() {
|
||||
subdir=$1
|
||||
domain=$2
|
||||
echo "$0: getting translations into $subdir for $domain..."
|
||||
cmd=`printf "$po_download_command_format" "$domain" "$subdir"`
|
||||
eval "$cmd"
|
||||
}
|
||||
|
||||
# Download .po files to $po_dir/.reference and copy only the new
|
||||
# or modified ones into $po_dir. Also update $po_dir/LINGUAS.
|
||||
update_po_files() {
|
||||
# Directory containing primary .po files.
|
||||
# Overwrite them only when we're sure a .po file is new.
|
||||
po_dir=$1
|
||||
domain=$2
|
||||
|
||||
# Download *.po files into this dir.
|
||||
# Usually contains *.s1 checksum files.
|
||||
ref_po_dir="$po_dir/.reference"
|
||||
|
||||
test -d $ref_po_dir || mkdir $ref_po_dir || return
|
||||
download_po_files $ref_po_dir $domain \
|
||||
&& ls "$ref_po_dir"/*.po 2>/dev/null |
|
||||
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS"
|
||||
|
||||
langs=`cd $ref_po_dir && echo *.po|sed 's/\.po//g'`
|
||||
test "$langs" = '*' && langs=x
|
||||
for po in `cd $ref_po_dir && echo *.po|sed 's/\.po//g'`; do
|
||||
case $po in x) continue;; esac
|
||||
new_po="$ref_po_dir/$po.po"
|
||||
cksum_file="$ref_po_dir/$po.s1"
|
||||
if ! test -f "$cksum_file" ||
|
||||
! test -f "$po_dir/$po.po" ||
|
||||
! sha1sum -c --status "$cksum_file" < "$new_po" > /dev/null; then
|
||||
echo "updated $po_dir/$po.po..."
|
||||
cp "$new_po" "$po_dir/$po.po" && sha1sum < "$new_po" > "$cksum_file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
case $DOWNLOAD_PO in
|
||||
'skip')
|
||||
;;
|
||||
'')
|
||||
if test -d po; then
|
||||
update_po_files po $package || exit
|
||||
fi
|
||||
}
|
||||
|
||||
# checkout package
|
||||
checkout() {
|
||||
if [ ! -d $1 ]; then
|
||||
echo "$0: getting $1 files..."
|
||||
|
||||
trap exit 1 2 13 15
|
||||
trap 'rm -fr $1; exit 1' 0
|
||||
|
||||
case "${CVS_AUTH-pserver}" in
|
||||
pserver) build_cvs_prefix pserver ${CVS_USER:-anonymous}
|
||||
;;
|
||||
gserver|server)
|
||||
build_cvs_prefix $CVS_AUTH ${CVS_USER--}
|
||||
;;
|
||||
ext) build_cvs_prefix $CVS_AUTH ${CVS_USER--}
|
||||
;;
|
||||
*) echo "$0: Unknown CVS access method" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
cvs -q -d ${CVS_PREFIX}cvs.sv.gnu.org:/cvsroot/$1 co $1 || exit
|
||||
|
||||
trap - 0
|
||||
;;
|
||||
'only')
|
||||
if test -d po; then
|
||||
update_po_files po $package || exit
|
||||
fi
|
||||
}
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
gnulib_modules=
|
||||
newline='
|
||||
'
|
||||
# Get paxutils files.
|
||||
|
||||
get_modules() {
|
||||
new_gnulib_modules=`sed '/^[ ]*#/d; /^[ ]*$/d' $*`
|
||||
case $gnulib_modules,$new_gnulib_modules in
|
||||
?*,?*) new_gnulib_modules=$newline$new_gnulib_modules;;
|
||||
esac
|
||||
gnulib_modules=$gnulib_modules$new_gnulib_modules
|
||||
}
|
||||
|
||||
# Get paxutils files
|
||||
case ${PAXUTILS_SRCDIR--} in
|
||||
-) checkout paxutils
|
||||
PAXUTILS_SRCDIR=paxutils
|
||||
esac
|
||||
|
||||
if [ -r $PAXUTILS_SRCDIR/gnulib.modules ]; then
|
||||
get_modules $PAXUTILS_SRCDIR/gnulib.modules
|
||||
gnulib_modules=`
|
||||
(echo "$gnulib_modules"; grep '^[^#]' $PAXUTILS_SRCDIR/gnulib.modules) |
|
||||
sort -u
|
||||
`
|
||||
fi
|
||||
|
||||
ignore_file_list=
|
||||
cleanup_ifl() {
|
||||
test -n "$ignore_file_list" && rm -f $ignore_file_list
|
||||
}
|
||||
|
||||
trap 'cleanup_ifl' 1 2 3 15
|
||||
|
||||
# ignorefile DIR FILE
|
||||
# add FILE to the temporary ignorelist in the directory DIR
|
||||
ignorefile() {
|
||||
file=$1/.ignore.$$
|
||||
echo "$2" >> $file
|
||||
if `echo $ignore_list | grep -qv $file`; then
|
||||
ignore_file_list="$ignore_file_list
|
||||
$file"
|
||||
fi
|
||||
}
|
||||
|
||||
# copy_files srcdir dstdir
|
||||
copy_files() {
|
||||
for file in `cat $1/DISTFILES`
|
||||
@@ -259,9 +329,250 @@ copy_files() {
|
||||
fi
|
||||
echo "$0: Copying file $1/$file to $2/$dst"
|
||||
cp -p $1/$file $2/$dst
|
||||
ignorefile $2 $dst
|
||||
done
|
||||
}
|
||||
|
||||
# Get gnulib files.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-)
|
||||
checkout gnulib
|
||||
GNULIB_SRCDIR=gnulib
|
||||
esac
|
||||
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
<$gnulib_tool || exit
|
||||
|
||||
ensure_dir_exists()
|
||||
{
|
||||
d=`dirname $dst`
|
||||
test -d "$d" || mkdir -p -- "$d"
|
||||
}
|
||||
|
||||
symlink_to_gnulib()
|
||||
{
|
||||
src=$GNULIB_SRCDIR/$1
|
||||
dst=${2-$1}
|
||||
|
||||
test -f "$src" && {
|
||||
if $copy; then
|
||||
{
|
||||
test ! -h "$dst" || {
|
||||
echo "$0: rm -f $dst" &&
|
||||
rm -f "$dst"
|
||||
}
|
||||
} &&
|
||||
test -f "$dst" &&
|
||||
cmp -s "$src" "$dst" || {
|
||||
echo "$0: cp -fp $src $dst" &&
|
||||
ensure_dir_exists $dst &&
|
||||
cp -fp "$src" "$dst"
|
||||
}
|
||||
else
|
||||
test -h "$dst" &&
|
||||
src_ls=`ls -diL "$src" 2>/dev/null` && set $src_ls && src_i=$1 &&
|
||||
dst_ls=`ls -diL "$dst" 2>/dev/null` && set $dst_ls && dst_i=$1 &&
|
||||
test "$src_i" = "$dst_i" || {
|
||||
dot_dots=
|
||||
case $src in
|
||||
/*) ;;
|
||||
*)
|
||||
case /$dst/ in
|
||||
*//* | */../* | */./* | /*/*/*/*/*/)
|
||||
echo >&2 "$0: invalid symlink calculation: $src -> $dst"
|
||||
exit 1;;
|
||||
/*/*/*/*/) dot_dots=../../../;;
|
||||
/*/*/*/) dot_dots=../../;;
|
||||
/*/*/) dot_dots=../;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
echo "$0: ln -fs $dot_dots$src $dst" &&
|
||||
ensure_dir_exists $dst &&
|
||||
ln -fs "$dot_dots$src" "$dst"
|
||||
}
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
cp_mark_as_generated()
|
||||
{
|
||||
cp_src=$1
|
||||
cp_dst=$2
|
||||
|
||||
if cmp -s "$cp_src" "$GNULIB_SRCDIR/$cp_dst"; then
|
||||
symlink_to_gnulib "$cp_dst"
|
||||
else
|
||||
case $cp_dst in
|
||||
*.[ch]) c1='/* '; c2=' */';;
|
||||
*.texi) c1='@c '; c2= ;;
|
||||
*.m4|*/Make*|Make*) c1='# ' ; c2= ;;
|
||||
*) c1= ; c2= ;;
|
||||
esac
|
||||
|
||||
if test -z "$c1"; then
|
||||
cmp -s "$cp_src" "$cp_dst" || {
|
||||
echo "$0: cp -f $cp_src $cp_dst" &&
|
||||
cp -f "$cp_src" "$cp_dst"
|
||||
}
|
||||
else
|
||||
# Copy the file first to get proper permissions if it
|
||||
# doesn't already exist. Then overwrite the copy.
|
||||
cp "$cp_src" "$cp_dst-t" &&
|
||||
(
|
||||
echo "$c1-*- buffer-read-only: t -*- vi: set ro:$c2" &&
|
||||
echo "${c1}DO NOT EDIT! GENERATED AUTOMATICALLY!$c2" &&
|
||||
cat "$cp_src"
|
||||
) > $cp_dst-t &&
|
||||
if cmp -s "$cp_dst-t" "$cp_dst"; then
|
||||
rm -f "$cp_dst-t"
|
||||
else
|
||||
echo "$0: cp $cp_src $cp_dst # with edits" &&
|
||||
mv -f "$cp_dst-t" "$cp_dst"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
version_controlled_file() {
|
||||
dir=$1
|
||||
file=$2
|
||||
found=no
|
||||
if test -d CVS; then
|
||||
grep -F "/$file/" $dir/CVS/Entries 2>/dev/null |
|
||||
grep '^/[^/]*/[0-9]' > /dev/null && found=yes
|
||||
elif test -d .git; then
|
||||
git-rm -n "$dir/$file" > /dev/null 2>&1 && found=yes
|
||||
else
|
||||
echo "$0: no version control for $dir/$file?" >&2
|
||||
fi
|
||||
test $found = yes
|
||||
}
|
||||
|
||||
slurp() {
|
||||
for dir in . `(cd $1 && find * -type d -print)`; do
|
||||
copied=
|
||||
sep=
|
||||
for file in `ls $1/$dir`; do
|
||||
test -d $1/$dir/$file && continue
|
||||
for excluded_file in $excluded_files; do
|
||||
test "$dir/$file" = "$excluded_file" && continue 2
|
||||
done
|
||||
if test $file = Makefile.am; then
|
||||
copied=$copied${sep}gnulib.mk; sep=$nl
|
||||
remove_intl='/^[^#].*\/intl/s/^/#/;'"s,/$bt,,g"
|
||||
sed "$remove_intl" $1/$dir/$file | cmp -s - $dir/gnulib.mk || {
|
||||
echo "$0: Copying $1/$dir/$file to $dir/gnulib.mk ..." &&
|
||||
rm -f $dir/gnulib.mk &&
|
||||
sed "$remove_intl" $1/$dir/$file >$dir/gnulib.mk
|
||||
}
|
||||
elif { test "${2+set}" = set && test -r $2/$dir/$file; } ||
|
||||
version_controlled_file $dir $file; then
|
||||
echo "$0: $dir/$file overrides $1/$dir/$file"
|
||||
else
|
||||
copied=$copied$sep$file; sep=$nl
|
||||
if test $file = gettext.m4; then
|
||||
echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
|
||||
rm -f $dir/$file
|
||||
sed '
|
||||
/^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
|
||||
AC_DEFUN([AM_INTL_SUBDIR], [
|
||||
/^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
|
||||
AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
|
||||
$a\
|
||||
AC_DEFUN([gl_LOCK_EARLY], [])
|
||||
' $1/$dir/$file >$dir/$file
|
||||
else
|
||||
cp_mark_as_generated $1/$dir/$file $dir/$file
|
||||
fi
|
||||
fi || exit
|
||||
done
|
||||
|
||||
if test -n "$copied"; then
|
||||
copied="Makefile
|
||||
Makefile.in
|
||||
$copied"
|
||||
if test -d CVS; then
|
||||
dot_ig=.cvsignore
|
||||
else
|
||||
dor_ig=.gitignore
|
||||
fi
|
||||
|
||||
ig=$dir/$dot_ig
|
||||
if [ -f $dir/.ignore.$$ ]; then
|
||||
tfile=$dir/.ignore.$$
|
||||
else
|
||||
tfile=
|
||||
fi
|
||||
if test -f $ig; then
|
||||
echo "$copied" | sort -u - $ig | cmp -s - $ig ||
|
||||
echo "$copied" | sort -u - $ig $tfile -o $ig
|
||||
else
|
||||
copied="$dot_ig
|
||||
$copied"
|
||||
if [ "$dir" = "po" ]; then
|
||||
copied="LINGUAS
|
||||
Makevars
|
||||
POTFILES
|
||||
*.mo
|
||||
*.gmo
|
||||
*.po
|
||||
remove-potcdate.sed
|
||||
stamp-po
|
||||
$package.pot
|
||||
$copied"
|
||||
fi
|
||||
echo "$copied" | sort -u - $tfile -o $ig
|
||||
fi || exit
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# Create boot temporary directories to import from gnulib and gettext.
|
||||
|
||||
bt='.#bootmp'
|
||||
bt2=${bt}2
|
||||
rm -fr $bt $bt2 &&
|
||||
mkdir $bt $bt2 || exit
|
||||
|
||||
# Import from gnulib.
|
||||
|
||||
test -d build-aux || {
|
||||
echo "$0: mkdir build-aux ..." &&
|
||||
mkdir build-aux
|
||||
} || exit
|
||||
gnulib_tool_options="\
|
||||
--import\
|
||||
--no-changelog\
|
||||
--aux-dir $bt/build-aux\
|
||||
--doc-base $bt/doc\
|
||||
--lib lib$package\
|
||||
--m4-base $bt/m4/\
|
||||
--source-base $bt/lib/\
|
||||
--tests-base $bt/tests\
|
||||
--local-dir gl\
|
||||
"
|
||||
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
|
||||
$gnulib_tool $gnulib_tool_options --import $gnulib_modules &&
|
||||
slurp $bt || exit
|
||||
|
||||
for file in $gnulib_files; do
|
||||
symlink_to_gnulib $file || exit
|
||||
done
|
||||
|
||||
|
||||
# Import from gettext.
|
||||
|
||||
echo "$0: (cd $bt2; autopoint) ..."
|
||||
cp configure.ac $bt2 &&
|
||||
(cd $bt2 && autopoint && rm configure.ac) &&
|
||||
slurp $bt2 $bt || exit
|
||||
|
||||
rm -fr $bt $bt2 || exit
|
||||
|
||||
# Import from paxutils
|
||||
copy_files ${PAXUTILS_SRCDIR}/m4 m4
|
||||
echo "$0: Creating m4/paxutils.m4"
|
||||
(echo "# This file is generated automatically. Please, do not edit."
|
||||
@@ -269,6 +580,7 @@ echo "$0: Creating m4/paxutils.m4"
|
||||
echo "AC_DEFUN([${package}_PAXUTILS],["
|
||||
cat ${PAXUTILS_SRCDIR}/m4/DISTFILES | sed '/^#/d;s/\(.*\)\.m4/pu_\1/' | tr a-z A-Z
|
||||
echo "])") > ./m4/paxutils.m4
|
||||
ignorefile m4 paxutils.m4
|
||||
|
||||
if [ -d rmt ]; then
|
||||
:
|
||||
@@ -283,114 +595,8 @@ done
|
||||
|
||||
copy_files ${PAXUTILS_SRCDIR}/paxlib lib pax
|
||||
|
||||
# Get gnulib files.
|
||||
|
||||
case ${GNULIB_SRCDIR--} in
|
||||
-) checkout gnulib
|
||||
GNULIB_SRCDIR=gnulib
|
||||
esac
|
||||
|
||||
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
|
||||
<$gnulib_tool || exit
|
||||
|
||||
get_modules gnulib.modules
|
||||
|
||||
gnulib_modules=`echo "$gnulib_modules" | sort -u`
|
||||
previous_gnulib_modules=
|
||||
while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
|
||||
previous_gnulib_modules=$gnulib_modules
|
||||
gnulib_modules=`
|
||||
(echo "$gnulib_modules"
|
||||
for gnulib_module in $gnulib_modules; do
|
||||
$gnulib_tool --extract-dependencies $gnulib_module
|
||||
done) | sort -u
|
||||
`
|
||||
done
|
||||
|
||||
gnulib_files=`
|
||||
(for gnulib_module in $gnulib_modules; do
|
||||
$gnulib_tool --extract-filelist $gnulib_module
|
||||
done) | sort -u
|
||||
`
|
||||
|
||||
gnulib_dirs=`echo "$gnulib_files" | sed 's,/[^/]*$,,' | sort -u`
|
||||
mkdir -p $gnulib_dirs || exit
|
||||
|
||||
for gnulib_file in $gnulib_files; do
|
||||
dest=$gnulib_file
|
||||
rm -f $dest &&
|
||||
echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file" &&
|
||||
cp -p $GNULIB_SRCDIR/$gnulib_file $dest || exit
|
||||
done
|
||||
|
||||
# This suppresses a bogus diagnostic
|
||||
# "warning: macro `AM_LANGINFO_CODESET' not found in library".
|
||||
echo "$0: patching m4/gettext.m4 to remove need for intl/* ..."
|
||||
sed '
|
||||
/^AC_DEFUN(\[AM_INTL_SUBDIR],/,/^]/c\
|
||||
AC_DEFUN([AM_INTL_SUBDIR], [])
|
||||
/^AC_DEFUN(\[gt_INTL_SUBDIR_CORE],/,/^]/c\
|
||||
AC_DEFUN([gt_INTL_SUBDIR_CORE], [])
|
||||
' m4/gettext.m4 >m4/gettext_gl.m4 || exit
|
||||
|
||||
echo "$0: Creating m4/gnulib.m4"
|
||||
(echo "# This file is generated automatically. Please, do not edit."
|
||||
echo "#"
|
||||
echo "AC_DEFUN([${package}_GNULIB],["
|
||||
for gnulib_module in $gnulib_modules; do
|
||||
echo "# $gnulib_module"
|
||||
$gnulib_tool --extract-autoconf-snippet $gnulib_module
|
||||
done | sed '/AM_GNU_GETTEXT/d'
|
||||
echo "])") > ./m4/gnulib.m4
|
||||
|
||||
echo "$0: Creating lib/Makefile.am"
|
||||
(echo "# This file is generated automatically. Do not edit!"
|
||||
cat lib/Makefile.tmpl
|
||||
|
||||
for gnulib_module in $gnulib_modules; do
|
||||
echo "# $gnulib_module"
|
||||
$gnulib_tool --extract-automake-snippet $gnulib_module
|
||||
done | sed "s/lib_SOURCES/lib${package}_a_SOURCES/g" ) > lib/Makefile.am
|
||||
|
||||
# Get translations.
|
||||
if test "$DOWNLOAD_PO" = "yes"; then
|
||||
update_po
|
||||
fi
|
||||
|
||||
# Reconfigure, getting other files.
|
||||
|
||||
echo "$0: autopoint --force ..."
|
||||
autopoint --force || exit
|
||||
|
||||
# We don't need intl, so remove it.
|
||||
intl_files_to_remove='
|
||||
intl
|
||||
m4/gettext.m4
|
||||
m4/glibc2.m4
|
||||
m4/intdiv0.m4
|
||||
m4/intmax.m4
|
||||
m4/lcmessage.m4
|
||||
m4/lock.m4
|
||||
m4/printf-posix.m4
|
||||
m4/visibility.m4
|
||||
'
|
||||
echo $0: rm -fr $intl_files_to_remove ...
|
||||
rm -fr $intl_files_to_remove || exit
|
||||
|
||||
|
||||
# Undo changes to gnulib files that autoreconf made.
|
||||
|
||||
for gnulib_file in $gnulib_files; do
|
||||
test ! -f $gnulib_file || cmp -s $gnulib_file $GNULIB_SRCDIR/$gnulib_file || {
|
||||
rm -f $gnulib_file &&
|
||||
echo "$0: Copying file $GNULIB_SRCDIR/$gnulib_file again" &&
|
||||
cp -p $GNULIB_SRCDIR/$gnulib_file $gnulib_file || exit
|
||||
}
|
||||
done
|
||||
|
||||
# Make sure aclocal.m4 is not older than input files.
|
||||
sleep 1
|
||||
|
||||
for command in \
|
||||
'aclocal --force -I m4' \
|
||||
'autoconf --force' \
|
||||
@@ -402,25 +608,46 @@ do
|
||||
done
|
||||
|
||||
|
||||
# Get some extra files from gnulib, overriding existing files.
|
||||
|
||||
for file in $gnulib_extra_files; do
|
||||
case $file in
|
||||
*/INSTALL) dst=INSTALL;;
|
||||
*) dst=$file;;
|
||||
esac
|
||||
symlink_to_gnulib $file $dst || exit
|
||||
done
|
||||
|
||||
|
||||
# Create gettext configuration.
|
||||
echo "$0: Creating po/Makevars from po/Makevars.template ..."
|
||||
rm -f po/Makevars
|
||||
sed '
|
||||
/^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
|
||||
/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
|
||||
/^XGETTEXT_OPTIONS *=/{
|
||||
s/$/ \\/
|
||||
a\
|
||||
--flag=_:1:pass-c-format \\\
|
||||
--flag=N_:1:pass-c-format \\\
|
||||
--flag=error:3:c-format --flag=error_at_line:5:c-format \\\
|
||||
--flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format \\\
|
||||
--flag=argp_error:2:c-format \\\
|
||||
--flag=__argp_error:2:c-format \\\
|
||||
--flag=argp_failure:4:c-format \\\
|
||||
--flag=__argp_failure:4:c-format \\\
|
||||
--flag=argp_fmtstream_printf:2:c-format \\\
|
||||
--flag=__argp_fmtstream_printf:2:c-format
|
||||
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
|
||||
}
|
||||
' po/Makevars.template >po/Makevars
|
||||
|
||||
if test -d runtime-po; then
|
||||
# Similarly for runtime-po/Makevars, but not quite the same.
|
||||
rm -f runtime-po/Makevars
|
||||
sed '
|
||||
/^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
|
||||
/^subdir *=.*/s/=.*/= runtime-po/
|
||||
/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
|
||||
/^XGETTEXT_OPTIONS *=/{
|
||||
s/$/ \\/
|
||||
a\
|
||||
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
|
||||
}
|
||||
' <po/Makevars.template >runtime-po/Makevars
|
||||
|
||||
# Copy identical files from po to runtime-po.
|
||||
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
|
||||
fi
|
||||
cleanup_ifl
|
||||
echo "$0: done. Now you can run './configure'."
|
||||
|
||||
59
bootstrap.conf
Normal file
59
bootstrap.conf
Normal file
@@ -0,0 +1,59 @@
|
||||
# Bootstrap configuration.
|
||||
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
|
||||
# We don't need these modules, even though gnulib-tool mistakenly
|
||||
# includes them because of gettext dependencies.
|
||||
avoided_gnulib_modules='
|
||||
--avoid=lock
|
||||
--avoid=size_max
|
||||
'
|
||||
|
||||
# gnulib modules used by this package.
|
||||
gnulib_modules="$avoided_gnulib_modules
|
||||
`grep '^[^#]' gnulib.modules`
|
||||
"
|
||||
|
||||
# Additional xgettext options to use. Use "\\\newline" to break lines.
|
||||
XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
|
||||
--flag=_:1:pass-c-format\\\
|
||||
--flag=N_:1:pass-c-format\\\
|
||||
--flag=error:3:c-format --flag=error_at_line:5:c-format\\\
|
||||
--flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format\\\
|
||||
--flag=argp_error:2:c-format\\\
|
||||
--flag=__argp_error:2:c-format\\\
|
||||
--flag=argp_failure:4:c-format\\\
|
||||
--flag=__argp_failure:4:c-format\\\
|
||||
--flag=argp_fmtstream_printf:2:c-format\\\
|
||||
--flag=__argp_fmtstream_printf:2:c-format\\\
|
||||
'
|
||||
|
||||
# Gettext supplies these files, but we don't need them since
|
||||
# we don't have an intl subdirectory.
|
||||
excluded_files='
|
||||
m4/glibc2.m4
|
||||
m4/intdiv0.m4
|
||||
m4/lcmessage.m4
|
||||
m4/lock.m4
|
||||
m4/printf-posix.m4
|
||||
m4/size_max.m4
|
||||
m4/uintmax_t.m4
|
||||
m4/ulonglong.m4
|
||||
m4/visibility.m4
|
||||
'
|
||||
17
configure.ac
17
configure.ac
@@ -1,11 +1,11 @@
|
||||
# Configure template for GNU tar.
|
||||
# Configure template for GNU tar. -*- autoconf -*-
|
||||
|
||||
# Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -18,18 +18,19 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
AC_INIT([GNU tar], [1.16], [bug-tar@gnu.org])
|
||||
AC_INIT([GNU tar], [1.21], [bug-tar@gnu.org])
|
||||
AC_CONFIG_SRCDIR([src/tar.c])
|
||||
AC_CONFIG_AUX_DIR([build-aux])
|
||||
AC_CONFIG_HEADERS([config.h:config.hin])
|
||||
AC_PREREQ([2.60])
|
||||
AM_INIT_AUTOMAKE([1.9 gnits tar-ustar dist-bzip2 dist-shar std-options])
|
||||
|
||||
gl_USE_SYSTEM_EXTENSIONS
|
||||
AC_PROG_CC
|
||||
AC_EXEEXT
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_YACC
|
||||
gl_EARLY
|
||||
|
||||
AC_SYS_LARGEFILE
|
||||
AC_ISC_POSIX
|
||||
AC_C_INLINE
|
||||
@@ -82,11 +83,11 @@ AC_CHECK_TYPE(ino_t, unsigned)
|
||||
gt_TYPE_SSIZE_T
|
||||
|
||||
# gnulib modules
|
||||
tar_GNULIB
|
||||
gl_INIT
|
||||
# paxutils modules
|
||||
tar_PAXUTILS
|
||||
|
||||
AC_CHECK_FUNCS(fsync getdtablesize lstat mkfifo readlink strerror symlink setlocale utimes)
|
||||
AC_CHECK_FUNCS(fsync getdtablesize lstat mkfifo readlink symlink setlocale utimes)
|
||||
AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
|
||||
AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
|
||||
AC_CHECK_DECLS([time],,, [#include <time.h>])
|
||||
@@ -213,7 +214,7 @@ AC_CHECK_TYPE(iconv_t,:,
|
||||
|
||||
# Gettext.
|
||||
AM_GNU_GETTEXT([external], [need-formatstring-macros])
|
||||
AM_GNU_GETTEXT_VERSION([0.15])
|
||||
AM_GNU_GETTEXT_VERSION([0.16])
|
||||
|
||||
# Initialize the test suite.
|
||||
AC_CONFIG_TESTDIR(tests)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Makefile for GNU tar documentation.
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2003, 2006 Free
|
||||
# Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2003, 2006,
|
||||
# 2007 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2, or (at your option)
|
||||
## the Free Software Foundation; either version 3, or (at your option)
|
||||
## any later version.
|
||||
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
@@ -20,6 +20,7 @@
|
||||
info_TEXINFOS = tar.texi
|
||||
tar_TEXINFOS = \
|
||||
dumpdir.texi\
|
||||
tar-snapshot-edit.texi\
|
||||
fdl.texi\
|
||||
freemanuals.texi\
|
||||
genfile.texi\
|
||||
@@ -30,8 +31,7 @@ tar_TEXINFOS = \
|
||||
snapshot.texi\
|
||||
sparse.texi\
|
||||
value.texi
|
||||
EXTRA_DIST = gendocs_template mastermenu.el texify.sed
|
||||
DISTCLEANFILES=*.info*
|
||||
EXTRA_DIST = gendocs_template mastermenu.el texify.sed untabify.el
|
||||
|
||||
# The rendering level is anyone of PUBLISH, DISTRIB or PROOF.
|
||||
# Just call `make RENDITION=PROOF [target]' if you want PROOF rendition.
|
||||
@@ -46,6 +46,18 @@ header.texi: $(top_srcdir)/src/tar.h
|
||||
master-menu: $(tar_TEXINFOS)
|
||||
emacs -batch -l mastermenu.el -f make-master-menu $(info_TEXINFOS)
|
||||
|
||||
untabify:
|
||||
emacs -batch -l untabify.el $(info_TEXINFOS) $(tar_TEXINFOS)
|
||||
|
||||
final: untabify master-menu
|
||||
|
||||
# Checking
|
||||
check-format:
|
||||
@if test -n "`cat $(info_TEXINFOS) $(tar_TEXINFOS) | tr -d -c '\t'`"; then \
|
||||
echo "Sources contain tabs; run make untabify"; \
|
||||
false; \
|
||||
fi
|
||||
|
||||
check-options:
|
||||
@ARGP_HELP_FMT='usage-indent=0,short-opt-col=0,long-opt-col=0,\
|
||||
doc-opt-col=0,opt-doc-col=0,header-col=0,rmargin=1' \
|
||||
@@ -67,6 +79,52 @@ doc-opt-col=0,opt-doc-col=0,header-col=0,rmargin=1' \
|
||||
fi;\
|
||||
rm report.$$$$
|
||||
|
||||
check-refs:
|
||||
@for file in $(info_TEXINFOS) $(tar_TEXINFOS); \
|
||||
do \
|
||||
sed -e = $$file | \
|
||||
sed -n 'N;/@FIXME-.*ref/{s/\(^[0-9][0-9]*\).*@FIXME-.*ref{\([^}]*\).*/'$$file':\1: \2/gp}'; \
|
||||
done > $@-t; \
|
||||
if [ -s $@-t ]; then \
|
||||
echo "Unresolved cross-references:"; \
|
||||
cat $@-t;\
|
||||
rm $@-t; \
|
||||
else \
|
||||
rm -f $@-t; \
|
||||
fi
|
||||
|
||||
check-fixmes:
|
||||
@for file in $(info_TEXINFOS); \
|
||||
do \
|
||||
sed -e = $$file | \
|
||||
sed -n 'N;/@FIXME{/{s/\(^[0-9][0-9]*\).*@FIXME{\([^}]*\).*/'$$file':\1: \2/gp}'; \
|
||||
done > $@-t; \
|
||||
if [ -s $@-t ]; then \
|
||||
echo "Unresolved FIXMEs:"; \
|
||||
cat $@-t; \
|
||||
rm $@-t; \
|
||||
false; \
|
||||
else \
|
||||
rm -f $@-t; \
|
||||
fi
|
||||
|
||||
check-unrevised:
|
||||
@grep -Hn @UNREVISED $(info_TEXINFOS) > $@-t; \
|
||||
if [ -s $@-t ]; then \
|
||||
echo "Unrevised nodes:"; \
|
||||
cat $@-t; \
|
||||
rm $@-t; \
|
||||
false;\
|
||||
else \
|
||||
rm $@-t; \
|
||||
fi
|
||||
|
||||
all-check-docs: check-format check-options check-refs check-fixmes check-unrevised
|
||||
|
||||
check-docs:
|
||||
$(MAKE) -k all-check-docs
|
||||
|
||||
#
|
||||
|
||||
clean-local:
|
||||
rm -rf manual
|
||||
@@ -82,5 +140,5 @@ manual:
|
||||
TEXINPUTS=$(srcdir):$(top_srcdir)/build-tex:$(TEXINPUTS) \
|
||||
MAKEINFO="$(MAKEINFO) $(MAKEINFOFLAGS)" \
|
||||
TEXI2DVI="$(TEXI2DVI) -t @finalout" \
|
||||
$(GENDOCS) tar 'GNU tar manual'
|
||||
$(GENDOCS) --texi2html tar 'GNU tar manual'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@c This is part of the paxutils manual.
|
||||
@c Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
@c Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
@c Written by Sergey Poznyakoff
|
||||
@c This file is distributed under GFDL 1.1 or any later version
|
||||
@c published by the Free Software Foundation.
|
||||
@@ -38,7 +38,7 @@ changed since the last backup.
|
||||
|
||||
@item R
|
||||
This code requests renaming of the @var{filename} to the name
|
||||
specified with the following @samp{T} command.
|
||||
specified with the @samp{T} command, that immediately follows it.
|
||||
|
||||
@item T
|
||||
Specify target file name for @samp{R} command (see below).
|
||||
@@ -90,9 +90,9 @@ New incremental dump was made.
|
||||
@end enumerate
|
||||
|
||||
This case cannot be handled by three successive renames, since
|
||||
renaming @file{a} to @file{b} will destroy existing directory.
|
||||
To handle such case a temporary directory is required. @GNUTAR{}
|
||||
will create the following dumpdir (newlines have been added for
|
||||
renaming @file{a} to @file{b} will destroy the existing directory.
|
||||
To correctly process it, @GNUTAR{} needs a temporary directory, so
|
||||
it creates the following dumpdir (newlines have been added for
|
||||
readability):
|
||||
|
||||
@smallexample
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<!-- $Id: gendocs_template,v 1.2 2005/05/15 03:59:09 eggert Exp $ -->
|
||||
<!-- $Id: gendocs_template,v 1.5 2007/10/30 14:58:52 gray Exp $ -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
|
||||
<head>
|
||||
@@ -30,24 +30,41 @@
|
||||
alt=" [image of the head of a GNU] "
|
||||
width="129" height="122" />
|
||||
</a>
|
||||
<a href="/philosophy/gif.html">(no gifs due to patent problems)</a>
|
||||
</p>
|
||||
<hr />
|
||||
|
||||
The manual for %%PACKAGE%% is available in the following formats:</p>
|
||||
<p>The manual for %%PACKAGE%% is available in the following formats:</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="%%PACKAGE%%.html">HTML
|
||||
(%%HTML_MONO_SIZE%%K characters)</a> - entirely on one web page.</li>
|
||||
(%%HTML_MONO_SIZE%%K bytes)</a> - entirely on one web page.</li>
|
||||
<li><a href="html_node/index.html">HTML</a> - with one web page per
|
||||
node.</li>
|
||||
%%IF HTML_SECTION%%
|
||||
<li><a href="html_section/index.html">HTML</a> - with one web page per
|
||||
section.</li>
|
||||
%%ENDIF HTML_SECTION%%
|
||||
%%IF HTML_CHAPTER%%
|
||||
<li><a href="html_chapter/index.html">HTML</a> - with one web page per
|
||||
chapter.</li>
|
||||
%%ENDIF HTML_CHAPTER%%
|
||||
<li><a href="%%PACKAGE%%.html.gz">HTML compressed
|
||||
(%%HTML_MONO_GZ_SIZE%%K gzipped characters)</a> - entirely on
|
||||
one web page.</li>
|
||||
<li><a href="%%PACKAGE%%_html_node.tar.gz">HTML compressed
|
||||
<li><a href="%%PACKAGE%%.html_node.tar.gz">HTML compressed
|
||||
(%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> -
|
||||
with one web page per node.</li>
|
||||
<li><a href="%%PACKAGE%%-info.tar.gz">Info document
|
||||
%%IF HTML_SECTION%%
|
||||
<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML compressed
|
||||
(%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file)</a> -
|
||||
with one web page per section.</li>
|
||||
%%ENDIF HTML_SECTION%%
|
||||
%%IF HTML_CHAPTER%%
|
||||
<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML compressed
|
||||
(%%HTML_CHAPTER_TGZ_SIZE%%K gzipped tar file)</a> -
|
||||
with one web page per chapter.</li>
|
||||
%%ENDIF HTML_CHAPTER%%
|
||||
<li><a href="%%PACKAGE%%.info.tar.gz">Info document
|
||||
(%%INFO_TGZ_SIZE%%K characters gzipped tar file)</a>.</li>
|
||||
<li><a href="%%PACKAGE%%.txt">ASCII text
|
||||
(%%ASCII_SIZE%%K characters)</a>.</li>
|
||||
@@ -99,7 +116,7 @@ permitted in any medium, provided this notice is preserved.
|
||||
<p>
|
||||
Updated:
|
||||
<!-- timestamp start -->
|
||||
$Date: 2005/05/15 03:59:09 $ $Author: eggert $
|
||||
$Date: 2007/10/30 14:58:52 $ $Author: gray $
|
||||
<!-- timestamp end -->
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -36,8 +36,6 @@ Archives are permitted to have more than one member with the same
|
||||
member name. One way this situation can occur is if more than one
|
||||
version of a file has been stored in the archive. For information
|
||||
about adding new versions of a file to an archive, see @ref{update}.
|
||||
@FIXME-xref{To learn more about having more than one archive member with the
|
||||
same name, see -backup node, when it's written.}
|
||||
|
||||
In addition to entries describing archive members, an archive may
|
||||
contain entries which @command{tar} itself uses to store information.
|
||||
@@ -96,7 +94,7 @@ The @code{name} field is the file name of the file, with directory names
|
||||
@FIXME{how big a name before field overflows?}
|
||||
|
||||
The @code{mode} field provides nine bits specifying file permissions
|
||||
and three bits to specify the Set UID, Set GID, and Save Text
|
||||
and three bits to specify the Set @acronym{UID}, Set @acronym{GID}, and Save Text
|
||||
(@dfn{sticky}) modes. Values for these bits are defined above.
|
||||
When special permissions are required to create a file with a given
|
||||
mode, and the user restoring files from the archive does not hold such
|
||||
@@ -107,12 +105,12 @@ should be faked up when creating or updating an archive; e.g., the
|
||||
group permission could be copied from the @emph{other} permission.
|
||||
|
||||
The @code{uid} and @code{gid} fields are the numeric user and group
|
||||
ID of the file owners, respectively. If the operating system does
|
||||
not support numeric user or group IDs, these fields should be ignored.
|
||||
@acronym{ID} of the file owners, respectively. If the operating system does
|
||||
not support numeric user or group @acronym{ID}s, these fields should
|
||||
be ignored.
|
||||
|
||||
The @code{size} field is the size of the file in bytes; linked files
|
||||
are archived with this field specified as zero. @FIXME-xref{Modifiers, in
|
||||
particular the @option{--incremental} (@option{-G}) option.}
|
||||
are archived with this field specified as zero.
|
||||
|
||||
The @code{mtime} field is the data modification time of the file at
|
||||
the time it was archived. It is the ASCII representation of the octal
|
||||
@@ -258,7 +256,7 @@ The @code{magic} field indicates that this archive was output in
|
||||
the P1003 archive format. If this field contains @code{TMAGIC},
|
||||
the @code{uname} and @code{gname} fields will contain the ASCII
|
||||
representation of the owner and group of the file respectively.
|
||||
If found, the user and group IDs are used rather than the values in
|
||||
If found, the user and group @acronym{ID}s are used rather than the values in
|
||||
the @code{uid} and @code{gid} fields.
|
||||
|
||||
For references, see ISO/IEC 9945-1:1990 or IEEE Std 1003.1-1990, pages
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;;; mastermenu.el --- Redefinition of texinfo-master-menu-list
|
||||
|
||||
;; Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: Sergey Poznyakoff
|
||||
;; Maintainer: bug-tar@gnu.org
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
;; This program is free software; you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation; either version 2, or (at your option)
|
||||
;; the Free Software Foundation; either version 3, or (at your option)
|
||||
;; any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -72,19 +72,28 @@
|
||||
@ifset PROOF
|
||||
@strong{<REF>} \string\ @strong{</>}
|
||||
@end ifset
|
||||
@ifclear PROOF
|
||||
@cite{\string\}
|
||||
@end ifclear
|
||||
@end macro
|
||||
|
||||
@macro FIXME-pxref{string}
|
||||
@ifset PROOF
|
||||
@strong{<PXREF>} \string\ @strong{</>}
|
||||
See @strong{<PXREF>} \string\ @strong{</>}
|
||||
@end ifset
|
||||
@ifclear PROOF
|
||||
See @cite{\string\}
|
||||
@end ifclear
|
||||
|
||||
@end macro
|
||||
|
||||
@macro FIXME-xref{string}
|
||||
@ifset PROOF
|
||||
@strong{<XREF>} \string\ @strong{</>}
|
||||
See @strong{<XREF>} \string\ @strong{</>}
|
||||
@end ifset
|
||||
@ifclear PROOF
|
||||
See @cite{\string\}
|
||||
@end ifclear
|
||||
@end macro
|
||||
|
||||
@c End of rendition.texi
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@c This is part of the paxutils manual.
|
||||
@c Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
@c Copyright (C) 2005, 2007 Free Software Foundation, Inc.
|
||||
@c Written by Sergey Poznyakoff
|
||||
@c This file is distributed under GFDL 1.1 or any later version
|
||||
@c published by the Free Software Foundation.
|
||||
@@ -9,27 +9,55 @@ incremental backups (@pxref{Incremental Dumps}). It
|
||||
contains the status of the file system at the time of the dump and is
|
||||
used to determine which files were modified since the last backup.
|
||||
|
||||
@GNUTAR{} version @value{VERSION} supports two snapshot file
|
||||
@GNUTAR{} version @value{VERSION} supports three snapshot file
|
||||
formats. The first format, called @dfn{format 0}, is the one used by
|
||||
@GNUTAR{} versions up to 1.15.1. The second format, called @dfn{format
|
||||
1} is an extended version of this format, that contains more metadata
|
||||
and allows for further extensions.
|
||||
and allows for further extensions. It was used by version
|
||||
1.15.1. Starting from version 1.16 and up to @value{VERSION}, the
|
||||
@dfn{format 2} is used.
|
||||
|
||||
@GNUTAR{} is able to read all three formats, but will create
|
||||
snapshots only in format 2.
|
||||
|
||||
This appendix describes all three formats in detail.
|
||||
|
||||
@enumerate 0
|
||||
@cindex format 0, snapshot file
|
||||
@cindex snapshot file, format 0
|
||||
@item
|
||||
@samp{Format 0} snapshot file begins with a line containing a
|
||||
decimal number that represents the UNIX timestamp of the beginning of
|
||||
the last archivation. This line is followed by directory metadata
|
||||
descriptions, one per line. Each description has the following format:
|
||||
decimal number that represents a @acronym{UNIX} timestamp of the
|
||||
beginning of the last archivation. This line is followed by directory
|
||||
metadata descriptions, one per line. Each description has the
|
||||
following format:
|
||||
|
||||
@smallexample
|
||||
[@var{nfs}]@var{dev} @var{inode} @var{name}
|
||||
@var{nfs}@var{dev} @var{inode} @var{name}
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
where optional @var{nfs} is a single plus character (@samp{+}) if this
|
||||
directory is located on an NFS-mounted partition, @var{dev} and
|
||||
@var{inode} are the device and inode numbers of the directory, and
|
||||
@var{name} is the directory name.
|
||||
where:
|
||||
|
||||
@table @var
|
||||
@item nfs
|
||||
A single plus character (@samp{+}), if this directory is located on
|
||||
an @acronym{NFS}-mounted partition, or a single space otherwise;
|
||||
|
||||
@item dev
|
||||
Device number of the directory;
|
||||
|
||||
@item inode
|
||||
I-node number of the directory;
|
||||
|
||||
@item name
|
||||
Name of the directory. Any special characters (white-space,
|
||||
backslashes, etc.) are quoted.
|
||||
@end table
|
||||
|
||||
@cindex format 1, snapshot file
|
||||
@cindex snapshot file, format 1
|
||||
@item
|
||||
@samp{Format 1} snapshot file begins with a line specifying the
|
||||
format of the file. This line has the following structure:
|
||||
|
||||
@@ -38,28 +66,75 @@ format of the file. This line has the following structure:
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
where @var{tar-version} is the version of @GNUTAR{} implementation
|
||||
that created this snapshot, and @var{incr-format-version} is the
|
||||
version number of the snapshot format (in this case @samp{1}).
|
||||
where @var{tar-version} is the version number of @GNUTAR{}
|
||||
implementation that created this snapshot, and
|
||||
@var{incr-format-version} is the version number of the snapshot format
|
||||
(in this case @samp{1}).
|
||||
|
||||
The following line contains two decimal numbers, representing the
|
||||
Next line contains two decimal numbers, representing the
|
||||
time of the last backup. First number is the number of seconds, the
|
||||
second one is the number of nanoseconds, since the beginning of the
|
||||
epoch.
|
||||
|
||||
Following lines contain directory metadata, one line per
|
||||
directory. The line format is:
|
||||
Lines that follow contain directory metadata, one line per
|
||||
directory. Each line is formatted as follows:
|
||||
|
||||
@smallexample
|
||||
[@var{nfs}]@var{mtime-sec} @var{mtime-nsec} @var{dev} @var{inode} @var{name}
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
where @var{mtime-sec} and @var{mtime-nsec} represent the last
|
||||
where @var{mtime-sec} and @var{mtime-nsec} represent last
|
||||
modification time of this directory with nanosecond precision;
|
||||
@var{nfs}, @var{dev}, @var{inode} and @var{name} have the same meaning
|
||||
as with @samp{format 0}.
|
||||
|
||||
@cindex format 2, snapshot file
|
||||
@cindex snapshot file, format 2
|
||||
@item
|
||||
@FIXME{}
|
||||
A snapshot file begins with a format identifier, as described for
|
||||
version 1, e.g.:
|
||||
|
||||
@smallexample
|
||||
GNU tar-@value{VERSION}-2
|
||||
@end smallexample
|
||||
|
||||
This line is followed by newline. Rest of file consists of
|
||||
records, separated by null (@acronym{ASCII} 0)
|
||||
characters. Thus, in contrast to the previous formats, format 2
|
||||
snapshot is a binary file.
|
||||
|
||||
First two records are decimal numbers, representing the
|
||||
time of the last backup. First number is the number of seconds, the
|
||||
second one is the number of nanoseconds, since the beginning of the
|
||||
epoch. These are followed by arbitrary number of directory records.
|
||||
|
||||
Each @dfn{directory record} contains a set of metadata describing a
|
||||
particular directory. Parts of a directory record are delimited with
|
||||
@acronym{ASCII} 0 characters. The following table describes each
|
||||
part. The @dfn{Number} type in this table stands for a decimal number
|
||||
in @acronym{ASCII} notation.
|
||||
|
||||
@multitable @columnfractions 0.2 0.2 0.6
|
||||
@headitem Field @tab Type @tab Description
|
||||
@item nfs @tab Character @tab @samp{1} if the directory is located on
|
||||
an @acronym{NFS}-mounted partition, or @samp{0} otherwise;
|
||||
@item mtime-sec @tab Number @tab Modification time, seconds;
|
||||
@item mtime-nano @tab Number @tab Modification time, nanoseconds;
|
||||
@item dev-no @tab Number @tab Device number;
|
||||
@item i-no @tab Number @tab I-node number;
|
||||
@item name @tab String @tab Directory name; In contrast to the
|
||||
previous versions it is not quoted.
|
||||
@item contents @tab Dumpdir @tab Contents of the directory;
|
||||
@xref{Dumpdir}, for a description of its format.
|
||||
@item
|
||||
@end multitable
|
||||
|
||||
Dumpdirs stored in snapshot files contain only records of types
|
||||
@samp{Y}, @samp{N} and @samp{D}.
|
||||
|
||||
@end enumerate
|
||||
|
||||
@c End of snapshot.texi
|
||||
|
||||
|
||||
58
doc/tar-snapshot-edit.texi
Normal file
58
doc/tar-snapshot-edit.texi
Normal file
@@ -0,0 +1,58 @@
|
||||
@c This is part of the paxutils manual.
|
||||
@c Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
@c This file is distributed under GFDL 1.1 or any later version
|
||||
@c published by the Free Software Foundation.
|
||||
|
||||
@cindex Device numbers, changing
|
||||
@cindex snapshot files, editing
|
||||
@cindex snapshot files, fixing device numbers
|
||||
Sometimes device numbers can change after upgrading your kernel
|
||||
version or recofiguring the harvare. Reportedly this is the case with
|
||||
some newer @i{Linux} kernels, when using @acronym{LVM}. In majority of
|
||||
cases this change is unnoticed by the users. However, it influences
|
||||
@command{tar} incremental backups: the device number is stored in tar
|
||||
snapshot files (@pxref{Snapshot Files}) and is used to determine whether
|
||||
the file has changed since the last backup. If the device numbers
|
||||
change for some reason, the next backup you run will be a full backup.
|
||||
|
||||
@pindex tar-snapshot-edit
|
||||
To minimize the impact in these cases, GNU @command{tar} comes with
|
||||
the @command{tar-snapshot-edit} utility for inspecting and updating
|
||||
device numbers in snapshot files. The utility, written by
|
||||
Dustin J.@: Mitchell, is available from
|
||||
@uref{http://www.gnu.org/@/software/@/tar/@/utils/@/tar-snapshot-edit.html,
|
||||
@GNUTAR{} home page}.
|
||||
|
||||
To obtain the device numbers used in the snapshot file, run
|
||||
|
||||
@smallexample
|
||||
$ @kbd{tar-snapshot-edit @var{snapfile}}
|
||||
@end smallexample
|
||||
|
||||
@noindent
|
||||
where @var{snapfile} is the name of the snapshot file (you can supply as many
|
||||
files as you wish in a single command line ).
|
||||
|
||||
To update all occurrences of the given device number in the file, use
|
||||
@option{-r} option. It takes a single argument of the form
|
||||
@samp{@var{olddev}-@var{newdev}}, where @var{olddev} is the device number
|
||||
used in the snapshot file, and @var{newdev} is the corresponding new device
|
||||
number. Both numbers may be specified in hex (e.g., @samp{0xfe01}),
|
||||
decimal (e.g., @samp{65025}), or as a major:minor number pair (e.g.,
|
||||
@samp{254:1}). To change several device numbers at once, specify them
|
||||
in a single comma-separated list, as in
|
||||
@option{-r 0x3060-0x4500,0x307-0x4600}.
|
||||
|
||||
Before updating the snapshot file, it is a good idea to create a backup
|
||||
copy of it. This is accomplished by @samp{-b} option. The name of the
|
||||
backup file is obtained by appending @samp{~} to the original file name.
|
||||
|
||||
An example session:
|
||||
@smallexample
|
||||
$ @kbd{tar-snapshot-edit /var/backup/snap.a}
|
||||
file version 2
|
||||
/tmp/snap: Device 0x0306 occurs 634 times.
|
||||
$ @kbd{tar-snapshot-edit -b -r 0x0306-0x4500 /var/backup/snap.a}
|
||||
file version 2
|
||||
@end smallexample
|
||||
|
||||
1376
doc/tar.texi
1376
doc/tar.texi
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,8 @@
|
||||
# Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
#
|
||||
# GNU tar is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 2, or (at
|
||||
# published by the Free Software Foundation; either version 3, or (at
|
||||
# your option) any later version.
|
||||
#
|
||||
# GNU tar is distributed in the hope that it will be useful, but
|
||||
|
||||
13
doc/untabify.el
Normal file
13
doc/untabify.el
Normal file
@@ -0,0 +1,13 @@
|
||||
;;;; Untabify the sources.
|
||||
;;;; Usage: emacs -batch -l untabify.el [file ...]
|
||||
|
||||
(defun global-untabify (buflist)
|
||||
(mapcar
|
||||
(lambda (bufname)
|
||||
(set-buffer (find-file bufname))
|
||||
(untabify (point-min) (point-max))
|
||||
(save-buffer)
|
||||
(kill-buffer (current-buffer)))
|
||||
buflist))
|
||||
|
||||
(global-untabify command-line-args-left)
|
||||
@@ -6,12 +6,14 @@ argmatch
|
||||
argp
|
||||
backupfile
|
||||
closeout
|
||||
configmake
|
||||
dirname
|
||||
error
|
||||
exclude
|
||||
exitfail
|
||||
fileblocks
|
||||
fnmatch-gnu
|
||||
fseeko
|
||||
ftruncate
|
||||
full-write
|
||||
getdate
|
||||
@@ -37,11 +39,13 @@ safe-read
|
||||
save-cwd
|
||||
savedir
|
||||
setenv
|
||||
snprintf
|
||||
stat-time
|
||||
stdbool
|
||||
stdint
|
||||
stpcpy
|
||||
strdup
|
||||
strerror
|
||||
strtol
|
||||
strtoul
|
||||
timespec
|
||||
|
||||
117
lib/.cvsignore
117
lib/.cvsignore
@@ -1,15 +1,10 @@
|
||||
.cvsignore
|
||||
.deps
|
||||
Makefile
|
||||
Makefile.am
|
||||
Makefile.in
|
||||
__fpending.c
|
||||
__fpending.h
|
||||
alloca.c
|
||||
alloca.h
|
||||
alloca_.h
|
||||
allocsa.c
|
||||
allocsa.h
|
||||
allocsa.valgrind
|
||||
alloca.in.h
|
||||
argmatch.c
|
||||
argmatch.h
|
||||
argp-ba.c
|
||||
@@ -30,60 +25,79 @@ at-func.c
|
||||
backupfile.c
|
||||
backupfile.h
|
||||
basename.c
|
||||
c-ctype.c
|
||||
c-ctype.h
|
||||
canonicalize-lgpl.c
|
||||
canonicalize.h
|
||||
charset.alias
|
||||
chdir-long.c
|
||||
chdir-long.h
|
||||
chown.c
|
||||
close-stream.c
|
||||
close-stream.h
|
||||
close.c
|
||||
closeout.c
|
||||
closeout.h
|
||||
config.charset
|
||||
configmake.h
|
||||
creat-safer.c
|
||||
dirent.h
|
||||
dirent.in.h
|
||||
dirfd.c
|
||||
dirfd.h
|
||||
dirname.c
|
||||
dirname.h
|
||||
dup-safer.c
|
||||
dup2.c
|
||||
errno.in.h
|
||||
error.c
|
||||
error.h
|
||||
exclude.c
|
||||
exclude.h
|
||||
exit.h
|
||||
exitfail.c
|
||||
exitfail.h
|
||||
fchdir.c
|
||||
fchmodat.c
|
||||
fchown-stub.c
|
||||
fchownat.c
|
||||
fclose.c
|
||||
fcntl--.h
|
||||
fcntl-safer.h
|
||||
fcntl.h
|
||||
fcntl_.h
|
||||
fcntl.in.h
|
||||
fd-safer.c
|
||||
fileblocks.c
|
||||
float+.h
|
||||
float.h
|
||||
float.in.h
|
||||
fnmatch.c
|
||||
fnmatch.h
|
||||
fnmatch_.h
|
||||
fnmatch.in.h
|
||||
fnmatch_loop.c
|
||||
fpending.c
|
||||
fpending.h
|
||||
fseeko.c
|
||||
fstatat.c
|
||||
ftruncate.c
|
||||
full-write.c
|
||||
full-write.h
|
||||
getcwd.c
|
||||
getcwd.h
|
||||
getdate.c
|
||||
getdate.h
|
||||
getdate.y
|
||||
getdelim.c
|
||||
getdelim.h
|
||||
getline.c
|
||||
getline.h
|
||||
getopt.c
|
||||
getopt.h
|
||||
getopt.in.h
|
||||
getopt1.c
|
||||
getopt_.h
|
||||
getopt_int.h
|
||||
getpagesize.c
|
||||
getpagesize.h
|
||||
gettext.h
|
||||
gettime.c
|
||||
gettimeofday.c
|
||||
gnulib.mk
|
||||
hash.c
|
||||
hash.h
|
||||
human.c
|
||||
@@ -93,28 +107,27 @@ intprops.h
|
||||
inttostr.c
|
||||
inttostr.h
|
||||
inttypes.h
|
||||
inttypes_.h
|
||||
inttypes.in.h
|
||||
lchown.c
|
||||
lchown.h
|
||||
localcharset.c
|
||||
localcharset.h
|
||||
localedir.h
|
||||
lseek.c
|
||||
lstat.c
|
||||
lstat.h
|
||||
malloc.c
|
||||
malloca.c
|
||||
malloca.h
|
||||
malloca.valgrind
|
||||
mbchar.c
|
||||
mbchar.h
|
||||
mbscasecmp.c
|
||||
mbuiter.h
|
||||
memchr.c
|
||||
mempcpy.c
|
||||
mempcpy.h
|
||||
memrchr.c
|
||||
memrchr.h
|
||||
memset.c
|
||||
minmax.h
|
||||
mkdirat.c
|
||||
mkdtemp.c
|
||||
mkdtemp.h
|
||||
mktime.c
|
||||
modechange.c
|
||||
modechange.h
|
||||
@@ -122,10 +135,13 @@ obstack.c
|
||||
obstack.h
|
||||
offtostr.c
|
||||
open-safer.c
|
||||
open.c
|
||||
openat-die.c
|
||||
openat-priv.h
|
||||
openat-proc.c
|
||||
openat.c
|
||||
openat.h
|
||||
pathmax.h
|
||||
paxerror.c
|
||||
paxexit.c
|
||||
paxlib.h
|
||||
@@ -139,6 +155,10 @@ quote.c
|
||||
quote.h
|
||||
quotearg.c
|
||||
quotearg.h
|
||||
rawmemchr.c
|
||||
rawmemchr.valgrind
|
||||
readlink.c
|
||||
realloc.c
|
||||
ref-add.sed
|
||||
ref-add.sin
|
||||
ref-del.sed
|
||||
@@ -150,6 +170,7 @@ regex_internal.c
|
||||
regex_internal.h
|
||||
regexec.c
|
||||
rmdir.c
|
||||
rmt-command.h
|
||||
rmt.h
|
||||
rpmatch.c
|
||||
rtapelib.c
|
||||
@@ -157,33 +178,42 @@ safe-read.c
|
||||
safe-read.h
|
||||
safe-write.c
|
||||
safe-write.h
|
||||
same-inode.h
|
||||
save-cwd.c
|
||||
save-cwd.h
|
||||
savedir.c
|
||||
savedir.h
|
||||
setenv.c
|
||||
setenv.h
|
||||
size_max.h
|
||||
sleep.c
|
||||
snprintf.c
|
||||
stat-macros.h
|
||||
stat-time.h
|
||||
stdarg.in.h
|
||||
stdbool.h
|
||||
stdbool_.h
|
||||
stdbool.in.h
|
||||
stdint.h
|
||||
stdint_.h
|
||||
stdint.in.h
|
||||
stdio-impl.h
|
||||
stdio-write.c
|
||||
stdio.h
|
||||
stdio.in.h
|
||||
stdlib.h
|
||||
stdlib.in.h
|
||||
stpcpy.c
|
||||
stpcpy.h
|
||||
strcase.h
|
||||
strcasecmp.c
|
||||
strchrnul.c
|
||||
strchrnul.h
|
||||
strchrnul.valgrind
|
||||
strdup.c
|
||||
strdup.h
|
||||
streq.h
|
||||
strerror.c
|
||||
string.h
|
||||
string.in.h
|
||||
strings.in.h
|
||||
stripslash.c
|
||||
strncasecmp.c
|
||||
strndup.c
|
||||
strndup.h
|
||||
strnlen.c
|
||||
strnlen.h
|
||||
strnlen1.c
|
||||
strnlen1.h
|
||||
strtoimax.c
|
||||
@@ -192,16 +222,30 @@ strtoll.c
|
||||
strtoul.c
|
||||
strtoull.c
|
||||
strtoumax.c
|
||||
sysexit_.h
|
||||
sys
|
||||
sys_stat.h
|
||||
sys_stat.in.h
|
||||
sys_time.h
|
||||
sys_time.in.h
|
||||
sysexits.h
|
||||
sysexits.in.h
|
||||
system-ioctl.h
|
||||
system.h
|
||||
tempname.c
|
||||
tempname.h
|
||||
time.h
|
||||
time.in.h
|
||||
time_r.c
|
||||
time_r.h
|
||||
timespec.h
|
||||
uinttostr.c
|
||||
umaxtostr.c
|
||||
unistd--.h
|
||||
unistd-safer.h
|
||||
unistd.h
|
||||
unistd.in.h
|
||||
unitypes.h
|
||||
uniwidth
|
||||
uniwidth.h
|
||||
unlinkdir.c
|
||||
unlinkdir.h
|
||||
unlocked-io.h
|
||||
@@ -216,8 +260,12 @@ version-etc-fsf.c
|
||||
version-etc.c
|
||||
version-etc.h
|
||||
vsnprintf.c
|
||||
vsnprintf.h
|
||||
wcwidth.h
|
||||
wchar.h
|
||||
wchar.in.h
|
||||
wctype.h
|
||||
wctype.in.h
|
||||
wcwidth.c
|
||||
write.c
|
||||
xalloc-die.c
|
||||
xalloc.h
|
||||
xgetcwd.c
|
||||
@@ -226,6 +274,7 @@ xmalloc.c
|
||||
xsize.h
|
||||
xstrndup.c
|
||||
xstrndup.h
|
||||
xstrtol-error.c
|
||||
xstrtol.c
|
||||
xstrtol.h
|
||||
xstrtoul.c
|
||||
|
||||
41
lib/Makefile.am
Normal file
41
lib/Makefile.am
Normal file
@@ -0,0 +1,41 @@
|
||||
# Makefile for GNU tar library. -*- Makefile -*-
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2003, 2004,
|
||||
# 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
include gnulib.mk
|
||||
|
||||
rmt-command.h : Makefile
|
||||
rm -f $@-t $@
|
||||
echo "#ifndef DEFAULT_RMT_COMMAND" >> $@-t
|
||||
echo "# define DEFAULT_RMT_COMMAND \"$(DEFAULT_RMT_DIR)/`echo rmt | sed '$(transform)'`$(EXEEXT)\"" >> $@-t
|
||||
echo "#endif" >> $@-t
|
||||
mv $@-t $@
|
||||
BUILT_SOURCES += rmt-command.h
|
||||
CLEANFILES += rmt-command.h rmt-command.h-t
|
||||
|
||||
noinst_HEADERS += system.h system-ioctl.h rmt.h paxlib.h stdopen.h
|
||||
libtar_a_SOURCES += \
|
||||
paxerror.c paxexit.c paxlib.h paxnames.c \
|
||||
prepargs.c prepargs.h \
|
||||
rtapelib.c \
|
||||
rmt.h \
|
||||
stdopen.c stdopen.h \
|
||||
system.h system-ioctl.h
|
||||
|
||||
libtar_a_LIBADD += $(LIBOBJS)
|
||||
libtar_a_DEPENDENCIES += $(LIBOBJS)
|
||||
@@ -1,56 +0,0 @@
|
||||
# Makefile for GNU tar library. -*- Makefile -*-
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2003, 2004,
|
||||
# 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2, or (at your option)
|
||||
## any later version.
|
||||
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
## 02110-1301, USA.
|
||||
|
||||
noinst_LIBRARIES = libtar.a
|
||||
noinst_HEADERS = system.h system-ioctl.h localedir.h rmt.h paxlib.h stdopen.h
|
||||
libtar_a_SOURCES = prepargs.c prepargs.h rtapelib.c paxerror.c paxexit.c paxnames.c stdopen.c
|
||||
|
||||
localedir = $(datadir)/locale
|
||||
|
||||
DISTCLEANFILES = localedir.h
|
||||
localedir.h : Makefile
|
||||
echo '#define LOCALEDIR "$(localedir)"' >$@
|
||||
echo "#ifndef DEFAULT_RMT_COMMAND" >> $@
|
||||
echo "# define DEFAULT_RMT_COMMAND \"$(DEFAULT_RMT_DIR)/`echo rmt | sed '$(transform)'`$(EXEEXT)\"" >> $@
|
||||
echo "#endif" >> $@
|
||||
|
||||
rtapelib.o: localedir.h
|
||||
|
||||
libtar_a_LIBADD = $(LIBOBJS) $(ALLOCA)
|
||||
libtar_a_DEPENDENCIES = $(libtar_a_LIBADD)
|
||||
|
||||
BUILT_SOURCES =
|
||||
AM_CPPFLAGS =
|
||||
EXTRA_DIST = Makefile.tmpl
|
||||
MAINTAINERCLEANFILES =
|
||||
MOSTLYCLEANFILES =
|
||||
lib_OBJECTS = $(libtar_a_OBJECTS)
|
||||
|
||||
# Special rule for getdate
|
||||
#
|
||||
# Say $(srcdir), so GNU make does not report an ambiguity with the .y.c rule.
|
||||
$(srcdir)/getdate.c: getdate.y
|
||||
cd $(srcdir) && \
|
||||
$(YACC) $(YFLAGS) getdate.y && \
|
||||
mv -f y.tab.c getdate.c
|
||||
|
||||
SUFFIXES = .o .c .h
|
||||
CLEANFILES =
|
||||
# gnulib modules
|
||||
@@ -1,9 +1,9 @@
|
||||
/* Parse arguments from a string and prepend them to an argv.
|
||||
Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
Copyright 1999, 2000, 2001, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/* stdopen.c - ensure that the three standard file descriptors are in use
|
||||
|
||||
Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* Emulate waitpid on systems that just have wait.
|
||||
Copyright 1994, 1995, 1998, 1999 Free Software Foundation, Inc.
|
||||
Copyright 1994, 1995, 1998, 1999, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.m4
|
||||
@@ -1,21 +0,0 @@
|
||||
index.html
|
||||
*.po
|
||||
LINGUAS
|
||||
Makefile.in.in
|
||||
Makevars
|
||||
Makevars.template
|
||||
Rules-quot
|
||||
boldquot.sed
|
||||
en@boldquot.header
|
||||
en@quot.header
|
||||
insert-header.sin
|
||||
quot.sed
|
||||
remove-potcdate.sin
|
||||
Makefile.in
|
||||
POTFILES
|
||||
Makefile
|
||||
tar.pot
|
||||
remove-potcdate.sed
|
||||
*.gmo
|
||||
*.mo
|
||||
stamp-po
|
||||
@@ -1,11 +1,11 @@
|
||||
# List of files which contain translatable strings.
|
||||
|
||||
# Copyright (C) 1996, 1999, 2000, 2003, 2004, 2005 Free Software
|
||||
# Copyright (C) 1996, 1999, 2000, 2003, 2004, 2005, 2007 Free Software
|
||||
# Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -22,10 +22,13 @@
|
||||
lib/argmatch.c
|
||||
lib/argp-help.c
|
||||
lib/argp-parse.c
|
||||
lib/closeout.c
|
||||
lib/error.c
|
||||
lib/getopt.c
|
||||
lib/obstack.c
|
||||
lib/human.c
|
||||
lib/obstack.c
|
||||
lib/openat-die.c
|
||||
lib/paxerror.c
|
||||
lib/paxexit.c
|
||||
lib/paxnames.c
|
||||
@@ -34,6 +37,8 @@ lib/rpmatch.c
|
||||
lib/rtapelib.c
|
||||
lib/xalloc-die.c
|
||||
lib/xmalloc.c
|
||||
lib/version-etc.c
|
||||
lib/xalloc-die.c
|
||||
|
||||
rmt/rmt.c
|
||||
|
||||
@@ -46,12 +51,12 @@ src/delete.c
|
||||
src/extract.c
|
||||
src/incremen.c
|
||||
src/list.c
|
||||
src/mangle.c
|
||||
src/misc.c
|
||||
src/names.c
|
||||
src/tar.c
|
||||
src/update.c
|
||||
src/xheader.c
|
||||
src/checkpoint.c
|
||||
|
||||
# Testsuite
|
||||
tests/genfile.c
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2, or (at your option)
|
||||
## the Free Software Foundation; either version 3, or (at your option)
|
||||
## any later version.
|
||||
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -82,11 +82,11 @@ SLEEP_MESSAGE="`awk '
|
||||
}' /dev/null`"
|
||||
|
||||
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2007 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2, or (at your option)
|
||||
## the Free Software Foundation; either version 3, or (at your option)
|
||||
## any later version.
|
||||
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
|
||||
328
scripts/tar-snapshot-edit
Executable file
328
scripts/tar-snapshot-edit
Executable file
@@ -0,0 +1,328 @@
|
||||
#! /usr/bin/perl -w
|
||||
# Display and edit the 'dev' field in tar's snapshots
|
||||
# Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
#
|
||||
# Author: Dustin J. Mitchell <dustin@zmanda.com>
|
||||
#
|
||||
# This script is capable of replacing values in the 'dev' field of an
|
||||
# incremental backup 'snapshot' file. This is useful when the device
|
||||
# used to store files in a tar archive changes, without the files
|
||||
# themselves changing. This may happen when, for example, a device
|
||||
# driver changes major or minor numbers.
|
||||
|
||||
use Getopt::Std;
|
||||
|
||||
## reading
|
||||
|
||||
sub read_incr_db ($) {
|
||||
my $filename = shift;
|
||||
open(my $file, "<$filename") || die "Could not open '$filename' for reading";
|
||||
|
||||
my $header_str = <$file>;
|
||||
my $file_version;
|
||||
if ($header_str =~ /^GNU tar-[^-]*-([0-9]+)\n$/) {
|
||||
$file_version = $1+0;
|
||||
} else {
|
||||
$file_version = 0;
|
||||
}
|
||||
|
||||
print "file version $file_version\n";
|
||||
|
||||
if ($file_version == 0) {
|
||||
return read_incr_db_0($file, $header_str);
|
||||
} elsif ($file_version == 1) {
|
||||
return read_incr_db_1($file);
|
||||
} elsif ($file_version == 2) {
|
||||
return read_incr_db_2($file);
|
||||
} else {
|
||||
die "Unrecognized snapshot version in header '$header_str'";
|
||||
}
|
||||
}
|
||||
|
||||
sub read_incr_db_0 ($$) {
|
||||
my $file = shift;
|
||||
my $header_str = shift;
|
||||
|
||||
my $hdr_timestamp_sec = $header_str;
|
||||
chop $hdr_timestamp_sec;
|
||||
my $hdr_timestamp_nsec = ''; # not present in file format 0
|
||||
|
||||
my @dirs;
|
||||
|
||||
while (<$file>) {
|
||||
/^([0-9]*) ([0-9]*) (.*)\n$/ || die("Bad snapshot line $_");
|
||||
|
||||
push @dirs, { dev=>$1,
|
||||
ino=>$2,
|
||||
name=>$3 };
|
||||
}
|
||||
|
||||
close($file);
|
||||
|
||||
# file version, timestamp, timestamp, dir list
|
||||
return [ 0, $hdr_timestamp_sec, $hdr_timestamp_nsec, \@dirs ];
|
||||
}
|
||||
|
||||
sub read_incr_db_1 ($) {
|
||||
my $file = shift;
|
||||
|
||||
my $timestamp = <$file>; # "sec nsec"
|
||||
my ($hdr_timestamp_sec, $hdr_timestamp_nsec) = ($timestamp =~ /([0-9]*) ([0-9]*)/);
|
||||
|
||||
my @dirs;
|
||||
|
||||
while (<$file>) {
|
||||
/^([0-9]*) ([0-9]*) ([0-9]*) ([0-9]*) (.*)\n$/ || die("Bad snapshot line $_");
|
||||
|
||||
push @dirs, { timestamp_sec=>$1,
|
||||
timestamp_nsec=>$2,
|
||||
dev=>$3,
|
||||
ino=>$4,
|
||||
name=>$5 };
|
||||
}
|
||||
|
||||
close($file);
|
||||
|
||||
# file version, timestamp, timestamp, dir list
|
||||
return [ 1, $hdr_timestamp_sec, $hdr_timestamp_nsec, \@dirs ];
|
||||
}
|
||||
|
||||
sub read_incr_db_2 ($) {
|
||||
my $file = shift;
|
||||
|
||||
$/="\0"; # $INPUT_RECORD_SEPARATOR
|
||||
my $hdr_timestamp_sec = <$file>;
|
||||
chop $hdr_timestamp_sec;
|
||||
my $hdr_timestamp_nsec = <$file>;
|
||||
chop $hdr_timestamp_nsec;
|
||||
my @dirs;
|
||||
|
||||
while (1) {
|
||||
last if eof($file);
|
||||
|
||||
my $nfs = <$file>;
|
||||
my $timestamp_sec = <$file>;
|
||||
my $timestamp_nsec = <$file>;
|
||||
my $dev = <$file>;
|
||||
my $ino = <$file>;
|
||||
my $name = <$file>;
|
||||
|
||||
# get rid of trailing NULs
|
||||
chop $nfs;
|
||||
chop $timestamp_sec;
|
||||
chop $timestamp_nsec;
|
||||
chop $dev;
|
||||
chop $ino;
|
||||
chop $name;
|
||||
|
||||
my @dirents;
|
||||
while (my $dirent = <$file>) {
|
||||
chop $dirent;
|
||||
push @dirents, $dirent;
|
||||
last if ($dirent eq "");
|
||||
}
|
||||
die "missing terminator" unless (<$file> eq "\0");
|
||||
|
||||
push @dirs, { nfs=>$nfs,
|
||||
timestamp_sec=>$timestamp_sec,
|
||||
timestamp_nsec=>$timestamp_nsec,
|
||||
dev=>$dev,
|
||||
ino=>$ino,
|
||||
name=>$name,
|
||||
dirents=>\@dirents };
|
||||
}
|
||||
|
||||
close($file);
|
||||
$/ = "\n"; # reset to normal
|
||||
|
||||
# file version, timestamp, timestamp, dir list
|
||||
return [ 2, $hdr_timestamp_sec, $hdr_timestamp_nsec, \@dirs ];
|
||||
}
|
||||
|
||||
## display
|
||||
|
||||
sub show_device_counts ($$) {
|
||||
my $info = shift;
|
||||
my $filename = shift;
|
||||
my %devices;
|
||||
foreach my $dir (@{${@$info}[3]}) {
|
||||
my $dev = ${%$dir}{'dev'};
|
||||
$devices{$dev}++;
|
||||
}
|
||||
|
||||
foreach $dev (sort keys %devices) {
|
||||
printf "$filename: Device 0x%04x occurs $devices{$dev} times.\n", $dev;
|
||||
}
|
||||
}
|
||||
|
||||
## editing
|
||||
|
||||
sub replace_device_number ($@) {
|
||||
my $info = shift(@_);
|
||||
my @repl = @_;
|
||||
|
||||
foreach my $dir (@{${@$info}[3]}) {
|
||||
foreach $x (@repl) {
|
||||
if (${%$dir}{'dev'} eq $$x[0]) {
|
||||
${%$dir}{'dev'} = $$x[1];
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
## writing
|
||||
|
||||
sub write_incr_db ($$) {
|
||||
my $info = shift;
|
||||
my $filename = shift;
|
||||
my $file_version = $$info[0];
|
||||
|
||||
open($file, ">$filename") || die "Could not open '$filename' for writing";
|
||||
|
||||
if ($file_version == 0) {
|
||||
write_incr_db_0($info, $file);
|
||||
} elsif ($file_version == 1) {
|
||||
write_incr_db_1($info, $file);
|
||||
} elsif ($file_version == 2) {
|
||||
write_incr_db_2($info, $file);
|
||||
} else {
|
||||
die "Unknown file version $file_version.";
|
||||
}
|
||||
|
||||
close($file);
|
||||
}
|
||||
|
||||
sub write_incr_db_0 ($$) {
|
||||
my $info = shift;
|
||||
my $file = shift;
|
||||
|
||||
my $timestamp_sec = $info->[1];
|
||||
print $file "$timestamp_sec\n";
|
||||
|
||||
foreach my $dir (@{${@$info}[3]}) {
|
||||
print $file "${%$dir}{'dev'} ";
|
||||
print $file "${%$dir}{'ino'} ";
|
||||
print $file "${%$dir}{'name'}\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub write_incr_db_1 ($$) {
|
||||
my $info = shift;
|
||||
my $file = shift;
|
||||
|
||||
print $file "GNU tar-1.15-1\n";
|
||||
|
||||
my $timestamp_sec = $info->[1];
|
||||
my $timestamp_nsec = $info->[2];
|
||||
print $file "$timestamp_sec $timestamp_nsec\n";
|
||||
|
||||
foreach my $dir (@{${@$info}[3]}) {
|
||||
print $file "${%$dir}{'timestamp_sec'} ";
|
||||
print $file "${%$dir}{'timestamp_nsec'} ";
|
||||
print $file "${%$dir}{'dev'} ";
|
||||
print $file "${%$dir}{'ino'} ";
|
||||
print $file "${%$dir}{'name'}\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub write_incr_db_2 ($$) {
|
||||
my $info = shift;
|
||||
my $file = shift;
|
||||
|
||||
print $file "GNU tar-1.16-2\n";
|
||||
|
||||
my $timestamp_sec = $info->[1];
|
||||
my $timestamp_nsec = $info->[2];
|
||||
print $file $timestamp_sec . "\0";
|
||||
print $file $timestamp_nsec . "\0";
|
||||
|
||||
foreach my $dir (@{${@$info}[3]}) {
|
||||
print $file ${%$dir}{'nfs'} . "\0";
|
||||
print $file ${%$dir}{'timestamp_sec'} . "\0";
|
||||
print $file ${%$dir}{'timestamp_nsec'} . "\0";
|
||||
print $file ${%$dir}{'dev'} . "\0";
|
||||
print $file ${%$dir}{'ino'} . "\0";
|
||||
print $file ${%$dir}{'name'} . "\0";
|
||||
foreach my $dirent (@{${%$dir}{'dirents'}}) {
|
||||
print $file $dirent . "\0";
|
||||
}
|
||||
print $file "\0";
|
||||
}
|
||||
}
|
||||
|
||||
## main
|
||||
|
||||
sub main {
|
||||
our ($opt_b, $opt_r, $opt_h);
|
||||
getopts('br:h');
|
||||
HELP_MESSAGE() if ($opt_h || $#ARGV == -1 || ($opt_b && !$opt_r));
|
||||
|
||||
my @repl;
|
||||
if ($opt_r) {
|
||||
foreach my $spec (split(/,/, $opt_r)) {
|
||||
($spec =~ /^([^-]+)-([^-]+)/) || die "Invalid replacement specification '$opt_r'";
|
||||
push @repl, [interpret_dev($1), interpret_dev($2)];
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $snapfile (@ARGV) {
|
||||
my $info = read_incr_db($snapfile);
|
||||
if ($opt_r ) {
|
||||
if ($opt_b) {
|
||||
rename($snapfile, $snapfile . "~") || die "Could not rename '$snapfile' to backup";
|
||||
}
|
||||
|
||||
replace_device_number($info, @repl);
|
||||
write_incr_db($info, $snapfile);
|
||||
} else {
|
||||
show_device_counts($info, $snapfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub HELP_MESSAGE {
|
||||
print "Usage: tar-snapshot-edit.pl [-r 'DEV1-DEV2[,DEV3-DEV4...]' [-b]] SNAPFILE [SNAPFILE [..]]\n";
|
||||
print "\n";
|
||||
print " Without -r, summarize the 'device' values in each SNAPFILE.\n";
|
||||
print "\n";
|
||||
print " With -r, replace occurrences of DEV1 with DEV2 in each SNAPFILE.\n";
|
||||
print " DEV1 and DEV2 may be specified in hex (e.g., 0xfe01), decimal (e.g.,\n";
|
||||
print " 65025), or MAJ:MIN (e.g., 254:1). To replace multiple occurrences,\n";
|
||||
print " separate them with commas. If -b is also specified, backup\n";
|
||||
print " files (ending with '~') will be created.\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub interpret_dev ($) {
|
||||
my $dev = shift;
|
||||
|
||||
if ($dev =~ /^([0-9]+):([0-9]+)$/) {
|
||||
return $1 * 256 + $2;
|
||||
} elsif ($dev =~ /^0x[0-9a-fA-F]+$/) {
|
||||
return oct $dev;
|
||||
} elsif ($dev =~ /^[0-9]+$/) {
|
||||
return $dev+0;
|
||||
} else {
|
||||
die "Invalid device specification '$dev'";
|
||||
}
|
||||
}
|
||||
|
||||
main
|
||||
@@ -1,13 +1,13 @@
|
||||
/* xsparse - expands compressed sparse file images extracted from GNU tar
|
||||
archives.
|
||||
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
Written by Sergey Poznyakoff
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -302,15 +302,20 @@ expand_sparse (FILE *sfp, int ofd)
|
||||
{
|
||||
size_t size = sparse_map[i].numbytes;
|
||||
|
||||
lseek (ofd, sparse_map[i].offset, SEEK_SET);
|
||||
while (size)
|
||||
if (size == 0)
|
||||
ftruncate (ofd, sparse_map[i].offset);
|
||||
else
|
||||
{
|
||||
size_t rdsize = (size < maxbytes) ? size : maxbytes;
|
||||
if (rdsize != fread (buffer, 1, rdsize, sfp))
|
||||
die (1, "read error (%d)", errno);
|
||||
if (rdsize != write (ofd, buffer, rdsize))
|
||||
die (1, "write error (%d)", errno);
|
||||
size -= rdsize;
|
||||
lseek (ofd, sparse_map[i].offset, SEEK_SET);
|
||||
while (size)
|
||||
{
|
||||
size_t rdsize = (size < maxbytes) ? size : maxbytes;
|
||||
if (rdsize != fread (buffer, 1, rdsize, sfp))
|
||||
die (1, "read error (%d)", errno);
|
||||
if (rdsize != write (ofd, buffer, rdsize))
|
||||
die (1, "write error (%d)", errno);
|
||||
size -= rdsize;
|
||||
}
|
||||
}
|
||||
}
|
||||
free (buffer);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
localedir.h
|
||||
rmt
|
||||
tar
|
||||
.deps
|
||||
.gdbinit
|
||||
Makefile
|
||||
Makefile.in
|
||||
rmt
|
||||
tar
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Makefile for GNU tar sources.
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2003 Free
|
||||
# Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2003, 2006,
|
||||
# 2007 Free Software Foundation, Inc.
|
||||
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2, or (at your option)
|
||||
## the Free Software Foundation; either version 3, or (at your option)
|
||||
## any later version.
|
||||
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
@@ -23,6 +23,7 @@ bin_PROGRAMS = tar
|
||||
noinst_HEADERS = arith.h common.h tar.h
|
||||
tar_SOURCES = \
|
||||
buffer.c\
|
||||
checkpoint.c\
|
||||
compare.c\
|
||||
create.c\
|
||||
delete.c\
|
||||
@@ -30,19 +31,17 @@ tar_SOURCES = \
|
||||
xheader.c\
|
||||
incremen.c\
|
||||
list.c\
|
||||
mangle.c\
|
||||
misc.c\
|
||||
names.c\
|
||||
sparse.c\
|
||||
suffix.c\
|
||||
system.c\
|
||||
tar.c\
|
||||
transform.c\
|
||||
update.c\
|
||||
utf8.c
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/lib -I../ -I../lib
|
||||
|
||||
tar.o: ../lib/localedir.h
|
||||
INCLUDES = -I$(top_srcdir)/lib -I../ -I../lib
|
||||
|
||||
LDADD = ../lib/libtar.a $(LIBINTL) $(LIBICONV)
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* Long integers, for GNU tar.
|
||||
Copyright 1999 Free Software Foundation, Inc.
|
||||
Copyright 1999, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2, or (at your option)
|
||||
the Free Software Foundation; either version 3, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
|
||||
866
src/buffer.c
866
src/buffer.c
File diff suppressed because it is too large
Load Diff
270
src/checkpoint.c
Normal file
270
src/checkpoint.c
Normal file
@@ -0,0 +1,270 @@
|
||||
/* Checkpoint management for tar.
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <system.h>
|
||||
#include "common.h"
|
||||
|
||||
enum checkpoint_opcode
|
||||
{
|
||||
cop_dot,
|
||||
cop_bell,
|
||||
cop_echo,
|
||||
cop_ttyout,
|
||||
cop_sleep,
|
||||
cop_exec
|
||||
};
|
||||
|
||||
struct checkpoint_action
|
||||
{
|
||||
struct checkpoint_action *next;
|
||||
enum checkpoint_opcode opcode;
|
||||
union
|
||||
{
|
||||
time_t time;
|
||||
char *command;
|
||||
} v;
|
||||
};
|
||||
|
||||
/* Checkpointing counter */
|
||||
static unsigned checkpoint;
|
||||
|
||||
/* List of checkpoint actions */
|
||||
static struct checkpoint_action *checkpoint_action, *checkpoint_action_tail;
|
||||
|
||||
static struct checkpoint_action *
|
||||
alloc_action (enum checkpoint_opcode opcode)
|
||||
{
|
||||
struct checkpoint_action *p = xzalloc (sizeof *p);
|
||||
if (checkpoint_action_tail)
|
||||
checkpoint_action_tail->next = p;
|
||||
else
|
||||
checkpoint_action = p;
|
||||
checkpoint_action_tail = p;
|
||||
p->opcode = opcode;
|
||||
return p;
|
||||
}
|
||||
|
||||
static char *
|
||||
copy_string_unquote (const char *str)
|
||||
{
|
||||
char *output = xstrdup (str);
|
||||
size_t len = strlen (output);
|
||||
if ((*output == '"' || *output == '\'')
|
||||
&& output[len-1] == *output)
|
||||
{
|
||||
memmove (output, output+1, len-2);
|
||||
output[len-2] = 0;
|
||||
}
|
||||
unquote_string (output);
|
||||
return output;
|
||||
}
|
||||
|
||||
void
|
||||
checkpoint_compile_action (const char *str)
|
||||
{
|
||||
struct checkpoint_action *act;
|
||||
|
||||
if (strcmp (str, ".") == 0 || strcmp (str, "dot") == 0)
|
||||
alloc_action (cop_dot);
|
||||
else if (strcmp (str, "bell") == 0)
|
||||
alloc_action (cop_bell);
|
||||
else if (strcmp (str, "echo") == 0)
|
||||
alloc_action (cop_echo);
|
||||
else if (strncmp (str, "echo=", 5) == 0)
|
||||
{
|
||||
act = alloc_action (cop_echo);
|
||||
act->v.command = copy_string_unquote (str + 5);
|
||||
}
|
||||
else if (strncmp (str, "exec=", 5) == 0)
|
||||
{
|
||||
act = alloc_action (cop_exec);
|
||||
act->v.command = copy_string_unquote (str + 5);
|
||||
}
|
||||
else if (strncmp (str, "ttyout=", 7) == 0)
|
||||
{
|
||||
act = alloc_action (cop_ttyout);
|
||||
act->v.command = copy_string_unquote (str + 7);
|
||||
}
|
||||
else if (strncmp (str, "sleep=", 6) == 0)
|
||||
{
|
||||
char *p;
|
||||
time_t n = strtoul (str+6, &p, 10);
|
||||
if (*p)
|
||||
FATAL_ERROR ((0, 0, _("%s: not a valid timeout"), str));
|
||||
act = alloc_action (cop_sleep);
|
||||
act->v.time = n;
|
||||
}
|
||||
else
|
||||
FATAL_ERROR ((0, 0, _("%s: unknown checkpoint action"), str));
|
||||
}
|
||||
|
||||
void
|
||||
checkpoint_finish_compile ()
|
||||
{
|
||||
if (checkpoint_option)
|
||||
{
|
||||
if (!checkpoint_action)
|
||||
/* Provide a historical default */
|
||||
checkpoint_compile_action ("echo");
|
||||
}
|
||||
else if (checkpoint_action)
|
||||
/* Otherwise, set default checkpoint rate */
|
||||
checkpoint_option = DEFAULT_CHECKPOINT;
|
||||
}
|
||||
|
||||
char *
|
||||
expand_checkpoint_string (const char *input, bool do_write, unsigned cpn)
|
||||
{
|
||||
const char *opstr = do_write ? gettext ("write") : gettext ("read");
|
||||
size_t opstrlen = strlen (opstr);
|
||||
char uintbuf[UINTMAX_STRSIZE_BOUND];
|
||||
char *cps = STRINGIFY_BIGINT (cpn, uintbuf);
|
||||
size_t cpslen = strlen (cps);
|
||||
const char *ip;
|
||||
char *op;
|
||||
char *output;
|
||||
size_t outlen = strlen (input); /* Initial guess */
|
||||
|
||||
/* Fix the initial length guess */
|
||||
for (ip = input; (ip = strchr (ip, '%')) != NULL; )
|
||||
{
|
||||
switch (ip[1])
|
||||
{
|
||||
case 'u':
|
||||
outlen += cpslen - 2;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
outlen += opstrlen - 2;
|
||||
}
|
||||
ip++;
|
||||
}
|
||||
|
||||
output = xmalloc (outlen + 1);
|
||||
for (ip = input, op = output; *ip; )
|
||||
{
|
||||
if (*ip == '%')
|
||||
{
|
||||
switch (*++ip)
|
||||
{
|
||||
case 'u':
|
||||
op = stpcpy (op, cps);
|
||||
break;
|
||||
|
||||
case 's':
|
||||
op = stpcpy (op, opstr);
|
||||
break;
|
||||
|
||||
default:
|
||||
*op++ = '%';
|
||||
*op++ = *ip;
|
||||
break;
|
||||
}
|
||||
ip++;
|
||||
}
|
||||
else
|
||||
*op++ = *ip++;
|
||||
}
|
||||
*op = 0;
|
||||
return output;
|
||||
}
|
||||
|
||||
static void
|
||||
run_checkpoint_actions (bool do_write)
|
||||
{
|
||||
struct checkpoint_action *p;
|
||||
FILE *tty = NULL;
|
||||
|
||||
for (p = checkpoint_action; p; p = p->next)
|
||||
{
|
||||
switch (p->opcode)
|
||||
{
|
||||
case cop_dot:
|
||||
fputc ('.', stdlis);
|
||||
fflush (stdlis);
|
||||
break;
|
||||
|
||||
case cop_bell:
|
||||
if (!tty)
|
||||
tty = fopen ("/dev/tty", "w");
|
||||
if (tty)
|
||||
{
|
||||
fputc ('\a', tty);
|
||||
fflush (tty);
|
||||
}
|
||||
break;
|
||||
|
||||
case cop_echo:
|
||||
{
|
||||
char *tmp;
|
||||
const char *str = p->v.command;
|
||||
if (!str)
|
||||
{
|
||||
if (do_write)
|
||||
/* TRANSLATORS: This is a ``checkpoint of write operation'',
|
||||
*not* ``Writing a checkpoint''.
|
||||
E.g. in Spanish ``Punto de comprobaci@'on de escritura'',
|
||||
*not* ``Escribiendo un punto de comprobaci@'on'' */
|
||||
str = gettext ("Write checkpoint %u");
|
||||
else
|
||||
/* TRANSLATORS: This is a ``checkpoint of read operation'',
|
||||
*not* ``Reading a checkpoint''.
|
||||
E.g. in Spanish ``Punto de comprobaci@'on de lectura'',
|
||||
*not* ``Leyendo un punto de comprobaci@'on'' */
|
||||
str = gettext ("Read checkpoint %u");
|
||||
}
|
||||
tmp = expand_checkpoint_string (str, do_write, checkpoint);
|
||||
WARN ((0, 0, "%s", tmp));
|
||||
free (tmp);
|
||||
}
|
||||
break;
|
||||
|
||||
case cop_ttyout:
|
||||
if (!tty)
|
||||
tty = fopen ("/dev/tty", "w");
|
||||
if (tty)
|
||||
{
|
||||
char *tmp = expand_checkpoint_string (p->v.command, do_write,
|
||||
checkpoint);
|
||||
fprintf (tty, "%s", tmp);
|
||||
fflush (tty);
|
||||
free (tmp);
|
||||
}
|
||||
break;
|
||||
|
||||
case cop_sleep:
|
||||
sleep (p->v.time);
|
||||
break;
|
||||
|
||||
case cop_exec:
|
||||
sys_exec_checkpoint_script (p->v.command,
|
||||
archive_name_cursor[0],
|
||||
checkpoint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tty)
|
||||
fclose (tty);
|
||||
}
|
||||
|
||||
void
|
||||
checkpoint_run (bool do_write)
|
||||
{
|
||||
if (checkpoint_option && !(++checkpoint % checkpoint_option))
|
||||
run_checkpoint_actions (do_write);
|
||||
}
|
||||
|
||||
117
src/common.h
117
src/common.h
@@ -1,11 +1,11 @@
|
||||
/* Common declarations for the tar program.
|
||||
|
||||
Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,
|
||||
2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -93,9 +93,6 @@ GLOBAL enum subcommand subcommand_option;
|
||||
/* Selected format for output archive. */
|
||||
GLOBAL enum archive_format archive_format;
|
||||
|
||||
/* Either NL or NUL, as decided by the --null option. */
|
||||
GLOBAL char filename_terminator;
|
||||
|
||||
/* Size of each record, once in blocks, once in bytes. Those two variables
|
||||
are always related, the second being BLOCKSIZE times the first. They do
|
||||
not have _option in their name, even if their values is derived from
|
||||
@@ -130,19 +127,13 @@ GLOBAL enum backup_type backup_type;
|
||||
GLOBAL bool block_number_option;
|
||||
|
||||
GLOBAL unsigned checkpoint_option;
|
||||
|
||||
enum checkpoint_style
|
||||
{
|
||||
checkpoint_text,
|
||||
checkpoint_dot
|
||||
};
|
||||
|
||||
GLOBAL enum checkpoint_style checkpoint_style;
|
||||
#define DEFAULT_CHECKPOINT 10
|
||||
|
||||
/* Specified name of compression program, or "gzip" as implied by -z. */
|
||||
GLOBAL const char *use_compress_program_option;
|
||||
|
||||
GLOBAL bool dereference_option;
|
||||
GLOBAL bool hard_dereference_option;
|
||||
|
||||
/* Print a message if not all links are dumped */
|
||||
GLOBAL int check_links_option;
|
||||
@@ -150,8 +141,18 @@ GLOBAL int check_links_option;
|
||||
/* Patterns that match file names to be excluded. */
|
||||
GLOBAL struct exclude *excluded;
|
||||
|
||||
/* Exclude directories containing a cache directory tag. */
|
||||
GLOBAL bool exclude_caches_option;
|
||||
enum exclusion_tag_type
|
||||
{
|
||||
exclusion_tag_none,
|
||||
/* Exclude the directory contents, but preserve the directory
|
||||
itself and the exclusion tag file */
|
||||
exclusion_tag_contents,
|
||||
/* Exclude everything below the directory, preserving the directory
|
||||
itself */
|
||||
exclusion_tag_under,
|
||||
/* Exclude entire directory */
|
||||
exclusion_tag_all,
|
||||
};
|
||||
|
||||
/* Specified value to be put into tar file in place of stat () results, or
|
||||
just -1 if such an override should not take place. */
|
||||
@@ -184,6 +185,8 @@ GLOBAL enum old_files old_files_option;
|
||||
|
||||
/* Specified file name for incremental list. */
|
||||
GLOBAL const char *listed_incremental_option;
|
||||
/* Check device numbers when doing incremental dumps. */
|
||||
GLOBAL bool check_device_option;
|
||||
|
||||
/* Specified mode change string. */
|
||||
GLOBAL struct mode_change *mode_option;
|
||||
@@ -254,7 +257,7 @@ GLOBAL bool show_omitted_dirs_option;
|
||||
GLOBAL bool sparse_option;
|
||||
GLOBAL unsigned tar_sparse_major;
|
||||
GLOBAL unsigned tar_sparse_minor;
|
||||
|
||||
|
||||
GLOBAL bool starting_file_option;
|
||||
|
||||
/* Specified maximum byte length of each tape volume (multiple of 1024). */
|
||||
@@ -296,7 +299,7 @@ GLOBAL int archive;
|
||||
/* Nonzero when outputting to /dev/null. */
|
||||
GLOBAL bool dev_null_output;
|
||||
|
||||
/* Timestamps: */
|
||||
/* Timestamps: */
|
||||
GLOBAL struct timespec start_time; /* when we started execution */
|
||||
GLOBAL struct timespec volume_start_time; /* when the current volume was
|
||||
opened*/
|
||||
@@ -406,6 +409,7 @@ void mv_end (void);
|
||||
void mv_total_size (off_t size);
|
||||
void mv_size_left (off_t size);
|
||||
|
||||
void buffer_write_global_xheader (void);
|
||||
|
||||
/* Module create.c. */
|
||||
|
||||
@@ -417,6 +421,10 @@ enum dump_status
|
||||
dump_status_not_implemented
|
||||
};
|
||||
|
||||
void add_exclusion_tag (const char *name, enum exclusion_tag_type type,
|
||||
bool (*)(const char*));
|
||||
bool cachedir_file_p (const char *name);
|
||||
|
||||
bool file_dumpable_p (struct tar_stat_info *st);
|
||||
void create_archive (void);
|
||||
void pad_archive (off_t size_left);
|
||||
@@ -430,7 +438,11 @@ union block * write_extended (bool global, struct tar_stat_info *st,
|
||||
union block *start_private_header (const char *name, size_t size);
|
||||
void write_eot (void);
|
||||
void check_links (void);
|
||||
|
||||
void exclusion_tag_warning (const char *dirname, const char *tagname,
|
||||
const char *message);
|
||||
enum exclusion_tag_type check_exclusion_tags (char *dirname,
|
||||
const char **tag_file_name);
|
||||
|
||||
#define GID_TO_CHARS(val, where) gid_to_chars (val, where, sizeof (where))
|
||||
#define MAJOR_TO_CHARS(val, where) major_to_chars (val, where, sizeof (where))
|
||||
#define MINOR_TO_CHARS(val, where) minor_to_chars (val, where, sizeof (where))
|
||||
@@ -474,8 +486,18 @@ bool rename_directory (char *src, char *dst);
|
||||
void delete_archive_members (void);
|
||||
|
||||
/* Module incremen.c. */
|
||||
typedef struct dumpdir *dumpdir_t;
|
||||
typedef struct dumpdir_iter *dumpdir_iter_t;
|
||||
|
||||
char *get_directory_contents (char *dir_name, dev_t device);
|
||||
dumpdir_t dumpdir_create0 (const char *contents, const char *cmask);
|
||||
dumpdir_t dumpdir_create (const char *contents);
|
||||
void dumpdir_free (dumpdir_t);
|
||||
char *dumpdir_locate (dumpdir_t dump, const char *name);
|
||||
char *dumpdir_next (dumpdir_iter_t itr);
|
||||
char *dumpdir_first (dumpdir_t dump, int all, dumpdir_iter_t *pitr);
|
||||
|
||||
|
||||
const char *get_directory_contents (char *dir_name, dev_t device);
|
||||
const char *append_incremental_renames (const char *dump);
|
||||
void read_directory_file (void);
|
||||
void write_directory_file (void);
|
||||
@@ -498,14 +520,6 @@ enum read_header
|
||||
HEADER_FAILURE /* ill-formed header, or bad checksum */
|
||||
};
|
||||
|
||||
struct xheader
|
||||
{
|
||||
struct obstack *stk;
|
||||
size_t size;
|
||||
char *buffer;
|
||||
};
|
||||
|
||||
GLOBAL struct xheader extended_header;
|
||||
extern union block *current_header;
|
||||
extern enum archive_format current_format;
|
||||
extern size_t recent_long_name_blocks;
|
||||
@@ -546,10 +560,6 @@ enum read_header tar_checksum (union block *header, bool silent);
|
||||
void skip_file (off_t size);
|
||||
void skip_member (void);
|
||||
|
||||
/* Module mangle.c. */
|
||||
|
||||
void extract_mangle (void);
|
||||
|
||||
/* Module misc.c. */
|
||||
|
||||
void assign_string (char **dest, const char *src);
|
||||
@@ -582,7 +592,6 @@ void undo_last_backup (void);
|
||||
|
||||
int deref_stat (bool deref, char const *name, struct stat *buf);
|
||||
|
||||
void closeopen (void);
|
||||
int chdir_arg (char const *dir);
|
||||
void chdir_do (int dir);
|
||||
|
||||
@@ -666,23 +675,22 @@ void update_archive (void);
|
||||
|
||||
/* Module xheader.c. */
|
||||
|
||||
void xheader_init (struct xheader *xhdr);
|
||||
void xheader_decode (struct tar_stat_info *stat);
|
||||
void xheader_decode_global (void);
|
||||
void xheader_store (char const *keyword, struct tar_stat_info const *st,
|
||||
void xheader_decode_global (struct xheader *xhdr);
|
||||
void xheader_store (char const *keyword, struct tar_stat_info *st,
|
||||
void const *data);
|
||||
void xheader_read (union block *header, size_t size);
|
||||
void xheader_read (struct xheader *xhdr, union block *header, size_t size);
|
||||
void xheader_write (char type, char *name, struct xheader *xhdr);
|
||||
void xheader_write_global (void);
|
||||
void xheader_write_global (struct xheader *xhdr);
|
||||
void xheader_finish (struct xheader *hdr);
|
||||
void xheader_destroy (struct xheader *hdr);
|
||||
char *xheader_xhdr_name (struct tar_stat_info *st);
|
||||
char *xheader_ghdr_name (void);
|
||||
void xheader_write (char type, char *name, struct xheader *xhdr);
|
||||
void xheader_write_global (void);
|
||||
void xheader_set_option (char *string);
|
||||
void xheader_string_begin (void);
|
||||
void xheader_string_add (char const *s);
|
||||
bool xheader_string_end (char const *keyword);
|
||||
void xheader_string_begin (struct xheader *xhdr);
|
||||
void xheader_string_add (struct xheader *xhdr, char const *s);
|
||||
bool xheader_string_end (struct xheader *xhdr, char const *keyword);
|
||||
bool xheader_keyword_deleted_p (const char *kw);
|
||||
char *xheader_format_name (struct tar_stat_info *st, const char *fmt,
|
||||
size_t n);
|
||||
@@ -691,8 +699,7 @@ char *xheader_format_name (struct tar_stat_info *st, const char *fmt,
|
||||
|
||||
void sys_detect_dev_null_output (void);
|
||||
void sys_save_archive_dev_ino (void);
|
||||
void sys_drain_input_pipe (void);
|
||||
void sys_wait_for_child (pid_t);
|
||||
void sys_wait_for_child (pid_t, bool);
|
||||
void sys_spawn_shell (void);
|
||||
bool sys_compare_uid (struct stat *a, struct stat *b);
|
||||
bool sys_compare_gid (struct stat *a, struct stat *b);
|
||||
@@ -706,6 +713,9 @@ bool sys_get_archive_stat (void);
|
||||
int sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st);
|
||||
void sys_wait_command (void);
|
||||
int sys_exec_info_script (const char **archive_name, int volume_number);
|
||||
void sys_exec_checkpoint_script (const char *script_name,
|
||||
const char *archive_name,
|
||||
int checkpoint_number);
|
||||
|
||||
/* Module compare.c */
|
||||
void report_difference (struct tar_stat_info *st, const char *message, ...);
|
||||
@@ -724,8 +734,21 @@ bool string_ascii_p (const char *str);
|
||||
bool utf8_convert (bool to_utf, char const *input, char **output);
|
||||
|
||||
/* Module transform.c */
|
||||
#define XFORM_REGFILE 0x01
|
||||
#define XFORM_LINK 0x02
|
||||
#define XFORM_SYMLINK 0x04
|
||||
#define XFORM_ALL (XFORM_REGFILE|XFORM_LINK|XFORM_SYMLINK)
|
||||
|
||||
void set_transform_expr (const char *expr);
|
||||
bool transform_name (char **pinput);
|
||||
bool transform_name_fp (char **pinput, char *(*fun)(char *));
|
||||
|
||||
|
||||
bool transform_name (char **pinput, int type);
|
||||
bool transform_member_name (char **pinput, int type);
|
||||
bool transform_name_fp (char **pinput, int type,
|
||||
char *(*fun)(char *, void *), void *);
|
||||
|
||||
/* Module suffix.c */
|
||||
void set_comression_program_by_suffix (const char *name, const char *defprog);
|
||||
|
||||
/* Module checkpoint.c */
|
||||
void checkpoint_compile_action (const char *str);
|
||||
void checkpoint_finish_compile (void);
|
||||
void checkpoint_run (bool do_write);
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
/* Diff files from a tar archive.
|
||||
|
||||
Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,
|
||||
2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
Written by John Gilmore, on 1987-04-30.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -110,27 +110,10 @@ process_rawdata (size_t bytes, char *buffer)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Directory contents, only for GNUTYPE_DUMPDIR. */
|
||||
|
||||
static char *dumpdir_cursor;
|
||||
|
||||
static int
|
||||
process_dumpdir (size_t bytes, char *buffer)
|
||||
{
|
||||
if (memcmp (buffer, dumpdir_cursor, bytes))
|
||||
{
|
||||
report_difference (¤t_stat_info, _("Contents differ"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
dumpdir_cursor += bytes;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Some other routine wants SIZE bytes in the archive. For each chunk
|
||||
of the archive, call PROCESSOR with the size of the chunk, and the
|
||||
address of the chunk it can work with. The PROCESSOR should return
|
||||
nonzero for success. It it return error once, continue skipping
|
||||
nonzero for success. Once it returns error, continue skipping
|
||||
without calling PROCESSOR anymore. */
|
||||
|
||||
static void
|
||||
@@ -138,7 +121,7 @@ read_and_process (struct tar_stat_info *st, int (*processor) (size_t, char *))
|
||||
{
|
||||
union block *data_block;
|
||||
size_t data_size;
|
||||
size_t size = st->stat.st_size;
|
||||
off_t size = st->stat.st_size;
|
||||
|
||||
mv_begin (st);
|
||||
while (size)
|
||||
@@ -345,14 +328,49 @@ diff_special (void)
|
||||
report_difference (¤t_stat_info, _("Mode differs"));
|
||||
}
|
||||
|
||||
static int
|
||||
dumpdir_cmp (const char *a, const char *b)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
while (*a)
|
||||
switch (*a)
|
||||
{
|
||||
case 'Y':
|
||||
case 'N':
|
||||
if (!strchr ("YN", *b))
|
||||
return 1;
|
||||
if (strcmp(a + 1, b + 1))
|
||||
return 1;
|
||||
len = strlen (a) + 1;
|
||||
a += len;
|
||||
b += len;
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
if (strcmp(a, b))
|
||||
return 1;
|
||||
len = strlen (a) + 1;
|
||||
a += len;
|
||||
b += len;
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
case 'T':
|
||||
case 'X':
|
||||
return *b;
|
||||
}
|
||||
return *b;
|
||||
}
|
||||
|
||||
static void
|
||||
diff_dumpdir (void)
|
||||
{
|
||||
char *dumpdir_buffer;
|
||||
const char *dumpdir_buffer;
|
||||
dev_t dev = 0;
|
||||
struct stat stat;
|
||||
struct stat stat_data;
|
||||
|
||||
if (deref_stat (true, current_stat_info.file_name, &stat))
|
||||
if (deref_stat (true, current_stat_info.file_name, &stat_data))
|
||||
{
|
||||
if (errno == ENOENT)
|
||||
stat_warn (current_stat_info.file_name);
|
||||
@@ -360,15 +378,14 @@ diff_dumpdir (void)
|
||||
stat_error (current_stat_info.file_name);
|
||||
}
|
||||
else
|
||||
dev = stat.st_dev;
|
||||
dev = stat_data.st_dev;
|
||||
|
||||
dumpdir_buffer = get_directory_contents (current_stat_info.file_name, dev);
|
||||
|
||||
if (dumpdir_buffer)
|
||||
{
|
||||
dumpdir_cursor = dumpdir_buffer;
|
||||
read_and_process (¤t_stat_info, process_dumpdir);
|
||||
free (dumpdir_buffer);
|
||||
if (dumpdir_cmp (current_stat_info.dumpdir, dumpdir_buffer))
|
||||
report_difference (¤t_stat_info, _("Contents differ"));
|
||||
}
|
||||
else
|
||||
read_and_process (¤t_stat_info, process_noop);
|
||||
@@ -484,10 +501,9 @@ diff_archive (void)
|
||||
break;
|
||||
|
||||
case GNUTYPE_DUMPDIR:
|
||||
diff_dumpdir ();
|
||||
/* Fall through. */
|
||||
|
||||
case DIRTYPE:
|
||||
if (is_dumpdir (¤t_stat_info))
|
||||
diff_dumpdir ();
|
||||
diff_dir ();
|
||||
break;
|
||||
|
||||
@@ -581,12 +597,25 @@ verify_volume (void)
|
||||
"VERIFY FAILURE: %d invalid headers detected",
|
||||
counter), counter));
|
||||
}
|
||||
if (status == HEADER_ZERO_BLOCK || status == HEADER_END_OF_FILE)
|
||||
if (status == HEADER_END_OF_FILE)
|
||||
break;
|
||||
if (status == HEADER_ZERO_BLOCK)
|
||||
{
|
||||
set_next_block_after (current_header);
|
||||
if (!ignore_zeros_option)
|
||||
{
|
||||
char buf[UINTMAX_STRSIZE_BOUND];
|
||||
|
||||
status = read_header (false);
|
||||
if (status == HEADER_ZERO_BLOCK)
|
||||
break;
|
||||
WARN ((0, 0, _("A lone zero block at %s"),
|
||||
STRINGIFY_BIGINT (current_block_ordinal (), buf)));
|
||||
}
|
||||
}
|
||||
|
||||
diff_archive ();
|
||||
tar_stat_destroy (¤t_stat_info);
|
||||
xheader_destroy (&extended_header);
|
||||
}
|
||||
|
||||
access_mode = ACCESS_WRITE;
|
||||
|
||||
288
src/create.c
288
src/create.c
@@ -1,13 +1,13 @@
|
||||
/* Create a tar archive.
|
||||
|
||||
Copyright (C) 1985, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,
|
||||
2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
Written by John Gilmore, on 1985-08-25.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -33,6 +33,111 @@ struct link
|
||||
size_t nlink;
|
||||
char name[1];
|
||||
};
|
||||
|
||||
struct exclusion_tag
|
||||
{
|
||||
const char *name;
|
||||
size_t length;
|
||||
enum exclusion_tag_type type;
|
||||
bool (*predicate) (const char *name);
|
||||
struct exclusion_tag *next;
|
||||
};
|
||||
|
||||
static struct exclusion_tag *exclusion_tags;
|
||||
|
||||
void
|
||||
add_exclusion_tag (const char *name, enum exclusion_tag_type type,
|
||||
bool (*predicate) (const char *name))
|
||||
{
|
||||
struct exclusion_tag *tag = xmalloc (sizeof tag[0]);
|
||||
tag->next = exclusion_tags;
|
||||
tag->name = name;
|
||||
tag->type = type;
|
||||
tag->predicate = predicate;
|
||||
tag->length = strlen (name);
|
||||
exclusion_tags = tag;
|
||||
}
|
||||
|
||||
void
|
||||
exclusion_tag_warning (const char *dirname, const char *tagname,
|
||||
const char *message)
|
||||
{
|
||||
if (verbose_option)
|
||||
WARN ((0, 0,
|
||||
_("%s: contains a cache directory tag %s; %s"),
|
||||
quotearg_colon (dirname),
|
||||
quotearg_n (1, tagname),
|
||||
message));
|
||||
}
|
||||
|
||||
enum exclusion_tag_type
|
||||
check_exclusion_tags (char *dirname, const char **tag_file_name)
|
||||
{
|
||||
static char *tagname;
|
||||
static size_t tagsize;
|
||||
struct exclusion_tag *tag;
|
||||
size_t dlen = strlen (dirname);
|
||||
int addslash = dirname[dlen-1] != '/';
|
||||
char *nptr = NULL;
|
||||
|
||||
for (tag = exclusion_tags; tag; tag = tag->next)
|
||||
{
|
||||
size_t size = dlen + addslash + tag->length + 1;
|
||||
if (size > tagsize)
|
||||
{
|
||||
tagsize = size;
|
||||
tagname = xrealloc (tagname, tagsize);
|
||||
}
|
||||
|
||||
if (!nptr)
|
||||
{
|
||||
strcpy (tagname, dirname);
|
||||
nptr = tagname + dlen;
|
||||
if (addslash)
|
||||
*nptr++ = '/';
|
||||
}
|
||||
strcpy (nptr, tag->name);
|
||||
if (access (tagname, F_OK) == 0
|
||||
&& (!tag->predicate || tag->predicate (tagname)))
|
||||
{
|
||||
if (tag_file_name)
|
||||
*tag_file_name = tag->name;
|
||||
return tag->type;
|
||||
}
|
||||
}
|
||||
|
||||
return exclusion_tag_none;
|
||||
}
|
||||
|
||||
/* Exclusion predicate to test if the named file (usually "CACHEDIR.TAG")
|
||||
contains a valid header, as described at:
|
||||
http://www.brynosaurus.com/cachedir
|
||||
Applications can write this file into directories they create
|
||||
for use as caches containing purely regenerable, non-precious data,
|
||||
allowing us to avoid archiving them if --exclude-caches is specified. */
|
||||
|
||||
#define CACHEDIR_SIGNATURE "Signature: 8a477f597d28d172789f06886806bc55"
|
||||
#define CACHEDIR_SIGNATURE_SIZE (sizeof CACHEDIR_SIGNATURE - 1)
|
||||
|
||||
bool
|
||||
cachedir_file_p (const char *name)
|
||||
{
|
||||
bool tag_present = false;
|
||||
int fd = open (name, O_RDONLY);
|
||||
if (fd >= 0)
|
||||
{
|
||||
static char tagbuf[CACHEDIR_SIGNATURE_SIZE];
|
||||
|
||||
if (read (fd, tagbuf, CACHEDIR_SIGNATURE_SIZE)
|
||||
== CACHEDIR_SIGNATURE_SIZE
|
||||
&& memcmp (tagbuf, CACHEDIR_SIGNATURE, CACHEDIR_SIGNATURE_SIZE) == 0)
|
||||
tag_present = true;
|
||||
|
||||
close (fd);
|
||||
}
|
||||
return tag_present;
|
||||
}
|
||||
|
||||
|
||||
/* The maximum uintmax_t value that can be represented with DIGITS digits,
|
||||
assuming that each digit is BITS_PER_DIGIT wide. */
|
||||
@@ -608,10 +713,10 @@ write_extended (bool global, struct tar_stat_info *st, union block *old_header)
|
||||
char *p;
|
||||
int type;
|
||||
|
||||
if (extended_header.buffer || extended_header.stk == NULL)
|
||||
if (st->xhdr.buffer || st->xhdr.stk == NULL)
|
||||
return old_header;
|
||||
|
||||
xheader_finish (&extended_header);
|
||||
xheader_finish (&st->xhdr);
|
||||
memcpy (hp.buffer, old_header, sizeof (hp));
|
||||
if (global)
|
||||
{
|
||||
@@ -623,7 +728,7 @@ write_extended (bool global, struct tar_stat_info *st, union block *old_header)
|
||||
type = XHDTYPE;
|
||||
p = xheader_xhdr_name (st);
|
||||
}
|
||||
xheader_write (type, p, &extended_header);
|
||||
xheader_write (type, p, &st->xhdr);
|
||||
free (p);
|
||||
header = find_next_block ();
|
||||
memcpy (header, &hp.buffer, sizeof (hp.buffer));
|
||||
@@ -742,7 +847,7 @@ start_header (struct tar_stat_info *st)
|
||||
{
|
||||
if (MAX_OCTAL_VAL (header->header.mtime) < mtime.tv_sec
|
||||
|| mtime.tv_nsec != 0)
|
||||
xheader_store ("mtime", st, NULL);
|
||||
xheader_store ("mtime", st, &mtime);
|
||||
if (MAX_OCTAL_VAL (header->header.mtime) < mtime.tv_sec)
|
||||
mtime.tv_sec = 0;
|
||||
}
|
||||
@@ -936,7 +1041,7 @@ dump_regular_file (int fd, struct tar_stat_info *st)
|
||||
while (size_left > 0)
|
||||
{
|
||||
size_t bufsize, count;
|
||||
|
||||
|
||||
mv_size_left (size_left);
|
||||
|
||||
blk = find_next_block ();
|
||||
@@ -961,8 +1066,7 @@ dump_regular_file (int fd, struct tar_stat_info *st)
|
||||
return dump_status_short;
|
||||
}
|
||||
size_left -= count;
|
||||
if (count)
|
||||
set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
|
||||
set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
|
||||
|
||||
if (count != bufsize)
|
||||
{
|
||||
@@ -976,60 +1080,21 @@ dump_regular_file (int fd, struct tar_stat_info *st)
|
||||
STRINGIFY_BIGINT (size_left, buf)));
|
||||
if (! ignore_failed_read_option)
|
||||
exit_status = TAREXIT_DIFFERS;
|
||||
pad_archive (size_left - (bufsize-count));
|
||||
pad_archive (size_left - (bufsize - count));
|
||||
return dump_status_short;
|
||||
}
|
||||
}
|
||||
return dump_status_ok;
|
||||
}
|
||||
|
||||
/* Look in directory DIRNAME for a cache directory tag file
|
||||
with the magic name "CACHEDIR.TAG" and a standard header,
|
||||
as described at:
|
||||
http://www.brynosaurus.com/cachedir
|
||||
Applications can write this file into directories they create
|
||||
for use as caches containing purely regenerable, non-precious data,
|
||||
allowing us to avoid archiving them if --exclude-caches is specified. */
|
||||
|
||||
#define CACHEDIR_SIGNATURE "Signature: 8a477f597d28d172789f06886806bc55"
|
||||
#define CACHEDIR_SIGNATURE_SIZE (sizeof CACHEDIR_SIGNATURE - 1)
|
||||
|
||||
static bool
|
||||
check_cache_directory (char *dirname)
|
||||
{
|
||||
static char tagname[] = "CACHEDIR.TAG";
|
||||
char *tagpath;
|
||||
int fd;
|
||||
int tag_present = false;
|
||||
|
||||
tagpath = xmalloc (strlen (dirname) + strlen (tagname) + 1);
|
||||
strcpy (tagpath, dirname);
|
||||
strcat (tagpath, tagname);
|
||||
|
||||
fd = open (tagpath, O_RDONLY);
|
||||
if (fd >= 0)
|
||||
{
|
||||
static char tagbuf[CACHEDIR_SIGNATURE_SIZE];
|
||||
|
||||
if (read (fd, tagbuf, CACHEDIR_SIGNATURE_SIZE)
|
||||
== CACHEDIR_SIGNATURE_SIZE
|
||||
&& memcmp (tagbuf, CACHEDIR_SIGNATURE, CACHEDIR_SIGNATURE_SIZE) == 0)
|
||||
tag_present = true;
|
||||
|
||||
close (fd);
|
||||
}
|
||||
|
||||
free (tagpath);
|
||||
|
||||
return tag_present;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dump_dir0 (char *directory,
|
||||
struct tar_stat_info *st, int top_level, dev_t parent_device)
|
||||
{
|
||||
dev_t our_device = st->stat.st_dev;
|
||||
|
||||
const char *tag_file_name;
|
||||
|
||||
if (!is_avoided_name (st->orig_file_name))
|
||||
{
|
||||
union block *blk = NULL;
|
||||
@@ -1111,44 +1176,63 @@ dump_dir0 (char *directory,
|
||||
WARN ((0, 0,
|
||||
_("%s: file is on a different filesystem; not dumped"),
|
||||
quotearg_colon (st->orig_file_name)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (exclude_caches_option
|
||||
&& check_cache_directory(st->orig_file_name))
|
||||
else
|
||||
{
|
||||
if (verbose_option)
|
||||
WARN ((0, 0,
|
||||
_("%s: contains a cache directory tag; not dumped"),
|
||||
quotearg_colon (st->orig_file_name)));
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
char const *entry;
|
||||
size_t entry_len;
|
||||
char *name_buf = xstrdup (st->orig_file_name);
|
||||
size_t name_size = strlen (name_buf);
|
||||
size_t name_len = name_size;
|
||||
|
||||
/* Now output all the files in the directory. */
|
||||
/* FIXME: Should speed this up by cd-ing into the dir. */
|
||||
|
||||
for (entry = directory; (entry_len = strlen (entry)) != 0;
|
||||
entry += entry_len + 1)
|
||||
{
|
||||
if (name_size < name_len + entry_len)
|
||||
char *name_buf;
|
||||
size_t name_size;
|
||||
|
||||
switch (check_exclusion_tags (st->orig_file_name, &tag_file_name))
|
||||
{
|
||||
case exclusion_tag_all:
|
||||
/* Handled in dump_file0 */
|
||||
break;
|
||||
|
||||
case exclusion_tag_none:
|
||||
{
|
||||
name_size = name_len + entry_len;
|
||||
name_buf = xrealloc (name_buf, name_size + 1);
|
||||
}
|
||||
strcpy (name_buf + name_len, entry);
|
||||
if (!excluded_name (name_buf))
|
||||
dump_file (name_buf, 0, our_device);
|
||||
}
|
||||
char const *entry;
|
||||
size_t entry_len;
|
||||
size_t name_len;
|
||||
|
||||
free (name_buf);
|
||||
}
|
||||
name_buf = xstrdup (st->orig_file_name);
|
||||
name_size = name_len = strlen (name_buf);
|
||||
|
||||
/* Now output all the files in the directory. */
|
||||
/* FIXME: Should speed this up by cd-ing into the dir. */
|
||||
for (entry = directory; (entry_len = strlen (entry)) != 0;
|
||||
entry += entry_len + 1)
|
||||
{
|
||||
if (name_size < name_len + entry_len)
|
||||
{
|
||||
name_size = name_len + entry_len;
|
||||
name_buf = xrealloc (name_buf, name_size + 1);
|
||||
}
|
||||
strcpy (name_buf + name_len, entry);
|
||||
if (!excluded_name (name_buf))
|
||||
dump_file (name_buf, 0, our_device);
|
||||
}
|
||||
|
||||
free (name_buf);
|
||||
}
|
||||
break;
|
||||
|
||||
case exclusion_tag_contents:
|
||||
exclusion_tag_warning (st->orig_file_name, tag_file_name,
|
||||
_("contents not dumped"));
|
||||
name_size = strlen (st->orig_file_name) + strlen (tag_file_name) + 1;
|
||||
name_buf = xmalloc (name_size);
|
||||
strcpy (name_buf, st->orig_file_name);
|
||||
strcat (name_buf, tag_file_name);
|
||||
dump_file (name_buf, 0, our_device);
|
||||
free (name_buf);
|
||||
break;
|
||||
|
||||
case exclusion_tag_under:
|
||||
exclusion_tag_warning (st->orig_file_name, tag_file_name,
|
||||
_("contents not dumped"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Ensure exactly one trailing slash. */
|
||||
@@ -1174,9 +1258,6 @@ dump_dir (int fd, struct tar_stat_info *st, int top_level, dev_t parent_device)
|
||||
return false;
|
||||
}
|
||||
|
||||
ensure_slash (&st->orig_file_name);
|
||||
ensure_slash (&st->file_name);
|
||||
|
||||
dump_dir0 (directory, st, top_level, parent_device);
|
||||
|
||||
free (directory);
|
||||
@@ -1192,7 +1273,7 @@ create_archive (void)
|
||||
const char *p;
|
||||
|
||||
open_archive (ACCESS_WRITE);
|
||||
xheader_write_global ();
|
||||
buffer_write_global_xheader ();
|
||||
|
||||
if (incremental_option)
|
||||
{
|
||||
@@ -1341,6 +1422,8 @@ dump_hard_link (struct tar_stat_info *st)
|
||||
static void
|
||||
file_count_links (struct tar_stat_info *st)
|
||||
{
|
||||
if (hard_dereference_option)
|
||||
return;
|
||||
if (st->stat.st_nlink > 1)
|
||||
{
|
||||
struct link *duplicate;
|
||||
@@ -1412,7 +1495,7 @@ dump_file0 (struct tar_stat_info *st, const char *p,
|
||||
assign_string (&st->file_name,
|
||||
safer_name_suffix (p, false, absolute_names_option));
|
||||
|
||||
transform_name (&st->file_name);
|
||||
transform_name (&st->file_name, XFORM_REGFILE);
|
||||
|
||||
if (deref_stat (dereference_option, p, &st->stat) != 0)
|
||||
{
|
||||
@@ -1497,6 +1580,18 @@ dump_file0 (struct tar_stat_info *st, const char *p,
|
||||
|
||||
if (is_dir)
|
||||
{
|
||||
const char *tag_file_name;
|
||||
ensure_slash (&st->orig_file_name);
|
||||
ensure_slash (&st->file_name);
|
||||
|
||||
if (check_exclusion_tags (st->orig_file_name, &tag_file_name)
|
||||
== exclusion_tag_all)
|
||||
{
|
||||
exclusion_tag_warning (st->orig_file_name, tag_file_name,
|
||||
_("directory not dumped"));
|
||||
return;
|
||||
}
|
||||
|
||||
ok = dump_dir (fd, st, top_level, parent_device);
|
||||
|
||||
/* dump_dir consumes FD if successful. */
|
||||
@@ -1521,6 +1616,7 @@ dump_file0 (struct tar_stat_info *st, const char *p,
|
||||
case dump_status_ok:
|
||||
case dump_status_short:
|
||||
mv_end ();
|
||||
file_count_links (st);
|
||||
break;
|
||||
|
||||
case dump_status_fail:
|
||||
@@ -1530,8 +1626,6 @@ dump_file0 (struct tar_stat_info *st, const char *p,
|
||||
abort ();
|
||||
}
|
||||
|
||||
file_count_links (st);
|
||||
|
||||
ok = status == dump_status_ok;
|
||||
}
|
||||
|
||||
@@ -1556,7 +1650,10 @@ dump_file0 (struct tar_stat_info *st, const char *p,
|
||||
|
||||
if (ok)
|
||||
{
|
||||
if (timespec_cmp (get_stat_ctime (&final_stat), original_ctime) != 0
|
||||
if ((timespec_cmp (get_stat_ctime (&final_stat), original_ctime) != 0
|
||||
/* Original ctime will change if the file is a directory and
|
||||
--remove-files is given */
|
||||
&& !(remove_files_option && is_dir))
|
||||
|| original_size < final_stat.st_size)
|
||||
{
|
||||
WARN ((0, 0, _("%s: file changed as we read it"),
|
||||
@@ -1608,6 +1705,7 @@ dump_file0 (struct tar_stat_info *st, const char *p,
|
||||
}
|
||||
buffer[size] = '\0';
|
||||
assign_string (&st->link_name, buffer);
|
||||
transform_name (&st->link_name, XFORM_SYMLINK);
|
||||
if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) < size)
|
||||
write_long_link (st);
|
||||
|
||||
@@ -1616,7 +1714,7 @@ dump_file0 (struct tar_stat_info *st, const char *p,
|
||||
header = start_header (st);
|
||||
if (!header)
|
||||
return;
|
||||
tar_copy_str (header->header.linkname, buffer, NAME_FIELD_SIZE);
|
||||
tar_copy_str (header->header.linkname, st->link_name, NAME_FIELD_SIZE);
|
||||
header->header.typeflag = SYMTYPE;
|
||||
finish_header (st, header, block_ordinal);
|
||||
/* nothing more to do to it */
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -307,10 +307,10 @@ delete_archive_members (void)
|
||||
}
|
||||
/* Copy header. */
|
||||
|
||||
if (extended_header.size)
|
||||
if (current_stat_info.xhdr.size)
|
||||
{
|
||||
write_recent_bytes (extended_header.buffer,
|
||||
extended_header.size);
|
||||
write_recent_bytes (current_stat_info.xhdr.buffer,
|
||||
current_stat_info.xhdr.size);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
137
src/extract.c
137
src/extract.c
@@ -1,13 +1,13 @@
|
||||
/* Extract files from a tar archive.
|
||||
|
||||
Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
2001, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
Written by John Gilmore, on 1985-11-19.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -37,7 +37,8 @@ enum permstatus
|
||||
/* This file may have existed already; its permissions are unknown. */
|
||||
UNKNOWN_PERMSTATUS,
|
||||
|
||||
/* This file was created using the permissions from the archive. */
|
||||
/* This file was created using the permissions from the archive,
|
||||
except with S_IRWXG | S_IRWXO masked out if 0 < same_owner_option. */
|
||||
ARCHIVED_PERMSTATUS,
|
||||
|
||||
/* This is an intermediate directory; the archive did not specify
|
||||
@@ -149,12 +150,15 @@ set_mode (char const *file_name,
|
||||
{
|
||||
mode = stat_info->st_mode;
|
||||
|
||||
/* If we created the file and it has a usual mode, then its mode
|
||||
is normally set correctly already. But on many hosts, some
|
||||
/* If we created the file and it has a mode that we set already
|
||||
with O_CREAT, then its mode is often set correctly already.
|
||||
But if we are changing ownership, the mode's group and and
|
||||
other permission bits were omitted originally, so it's less
|
||||
likely that the mode is OK now. Also, on many hosts, some
|
||||
directories inherit the setgid bits from their parents, so we
|
||||
we must set directories' modes explicitly. */
|
||||
if (permstatus == ARCHIVED_PERMSTATUS
|
||||
&& ! (mode & ~ MODE_RWX)
|
||||
if ((permstatus == ARCHIVED_PERMSTATUS
|
||||
&& ! (mode & ~ (0 < same_owner_option ? S_IRWXU : MODE_RWX)))
|
||||
&& typeflag != DIRTYPE
|
||||
&& typeflag != GNUTYPE_DUMPDIR)
|
||||
return;
|
||||
@@ -217,7 +221,7 @@ check_time (char const *file_name, struct timespec t)
|
||||
/* Restore stat attributes (owner, group, mode and times) for
|
||||
FILE_NAME, using information given in *ST.
|
||||
If CUR_INFO is nonzero, *CUR_INFO is the
|
||||
file's currernt status.
|
||||
file's current status.
|
||||
If not restoring permissions, invert the
|
||||
INVERT_PERMISSIONS bits from the file's current permissions.
|
||||
PERMSTATUS specifies the status of the file's permissions.
|
||||
@@ -265,11 +269,11 @@ set_stat (char const *file_name,
|
||||
}
|
||||
|
||||
/* Some systems allow non-root users to give files away. Once this
|
||||
done, it is not possible anymore to change file permissions, so we
|
||||
have to set permissions prior to possibly giving files away. */
|
||||
|
||||
set_mode (file_name, &st->stat, cur_info,
|
||||
invert_permissions, permstatus, typeflag);
|
||||
done, it is not possible anymore to change file permissions.
|
||||
However, setting file permissions now would be incorrect, since
|
||||
they would apply to the wrong user, and there would be a race
|
||||
condition. So, don't use systems that allow non-root users to
|
||||
give files away. */
|
||||
}
|
||||
|
||||
if (0 < same_owner_option && permstatus != INTERDIR_PERMSTATUS)
|
||||
@@ -278,29 +282,36 @@ set_stat (char const *file_name,
|
||||
the symbolic link itself. In this case, a mere chown would change
|
||||
the attributes of the file the symbolic link is pointing to, and
|
||||
should be avoided. */
|
||||
int chown_result = 1;
|
||||
|
||||
if (typeflag == SYMTYPE)
|
||||
{
|
||||
#if HAVE_LCHOWN
|
||||
if (lchown (file_name, st->stat.st_uid, st->stat.st_gid) < 0)
|
||||
chown_error_details (file_name,
|
||||
st->stat.st_uid, st->stat.st_gid);
|
||||
chown_result = lchown (file_name, st->stat.st_uid, st->stat.st_gid);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if (chown (file_name, st->stat.st_uid, st->stat.st_gid) < 0)
|
||||
chown_error_details (file_name,
|
||||
st->stat.st_uid, st->stat.st_gid);
|
||||
|
||||
/* On a few systems, and in particular, those allowing to give files
|
||||
away, changing the owner or group destroys the suid or sgid bits.
|
||||
So let's attempt setting these bits once more. */
|
||||
if (st->stat.st_mode & (S_ISUID | S_ISGID | S_ISVTX))
|
||||
set_mode (file_name, &st->stat, 0,
|
||||
invert_permissions, permstatus, typeflag);
|
||||
chown_result = chown (file_name, st->stat.st_uid, st->stat.st_gid);
|
||||
}
|
||||
|
||||
if (chown_result == 0)
|
||||
{
|
||||
/* Changing the owner can flip st_mode bits in some cases, so
|
||||
ignore cur_info if it might be obsolete now. */
|
||||
if (cur_info
|
||||
&& cur_info->st_mode & S_IXUGO
|
||||
&& cur_info->st_mode & (S_ISUID | S_ISGID))
|
||||
cur_info = NULL;
|
||||
}
|
||||
else if (chown_result < 0)
|
||||
chown_error_details (file_name,
|
||||
st->stat.st_uid, st->stat.st_gid);
|
||||
}
|
||||
|
||||
if (typeflag != SYMTYPE)
|
||||
set_mode (file_name, &st->stat, cur_info,
|
||||
invert_permissions, permstatus, typeflag);
|
||||
}
|
||||
|
||||
/* Remember to restore stat attributes (owner, group, mode and times)
|
||||
@@ -374,7 +385,8 @@ repair_delayed_set_stat (char const *dir,
|
||||
data->atime = current_stat_info.atime;
|
||||
data->mtime = current_stat_info.mtime;
|
||||
data->invert_permissions =
|
||||
(MODE_RWX & (current_stat_info.stat.st_mode ^ st.st_mode));
|
||||
((current_stat_info.stat.st_mode ^ st.st_mode)
|
||||
& MODE_RWX & ~ current_umask);
|
||||
data->permstatus = ARCHIVED_PERMSTATUS;
|
||||
return;
|
||||
}
|
||||
@@ -581,13 +593,13 @@ apply_nonancestor_delayed_set_stat (char const *file_name, bool after_links)
|
||||
|
||||
if (! skip_this_one)
|
||||
{
|
||||
struct tar_stat_info st;
|
||||
st.stat.st_mode = data->mode;
|
||||
st.stat.st_uid = data->uid;
|
||||
st.stat.st_gid = data->gid;
|
||||
st.atime = data->atime;
|
||||
st.mtime = data->mtime;
|
||||
set_stat (data->file_name, &st, cur_info,
|
||||
struct tar_stat_info sb;
|
||||
sb.stat.st_mode = data->mode;
|
||||
sb.stat.st_uid = data->uid;
|
||||
sb.stat.st_gid = data->gid;
|
||||
sb.atime = data->atime;
|
||||
sb.mtime = data->mtime;
|
||||
set_stat (data->file_name, &sb, cur_info,
|
||||
data->invert_permissions, data->permstatus, DIRTYPE);
|
||||
}
|
||||
|
||||
@@ -626,8 +638,9 @@ extract_dir (char *file_name, int typeflag)
|
||||
else if (typeflag == GNUTYPE_DUMPDIR)
|
||||
skip_member ();
|
||||
|
||||
mode = (current_stat_info.stat.st_mode |
|
||||
(we_are_root ? 0 : MODE_WXUSR)) & MODE_RWX;
|
||||
mode = current_stat_info.stat.st_mode | (we_are_root ? 0 : MODE_WXUSR);
|
||||
if (0 < same_owner_option || current_stat_info.stat.st_mode & ~ MODE_RWX)
|
||||
mode &= S_IRWXU;
|
||||
|
||||
while ((status = mkdir (file_name, mode)))
|
||||
{
|
||||
@@ -670,7 +683,8 @@ extract_dir (char *file_name, int typeflag)
|
||||
{
|
||||
if (status == 0)
|
||||
delay_set_stat (file_name, ¤t_stat_info,
|
||||
MODE_RWX & (mode ^ current_stat_info.stat.st_mode),
|
||||
((mode ^ current_stat_info.stat.st_mode)
|
||||
& MODE_RWX & ~ current_umask),
|
||||
ARCHIVED_PERMSTATUS);
|
||||
else /* For an already existing directory, invert_perms must be 0 */
|
||||
delay_set_stat (file_name, ¤t_stat_info,
|
||||
@@ -682,14 +696,13 @@ extract_dir (char *file_name, int typeflag)
|
||||
|
||||
|
||||
static int
|
||||
open_output_file (char *file_name, int typeflag)
|
||||
open_output_file (char *file_name, int typeflag, mode_t mode)
|
||||
{
|
||||
int fd;
|
||||
int openflag = (O_WRONLY | O_BINARY | O_CREAT
|
||||
| (old_files_option == OVERWRITE_OLD_FILES
|
||||
? O_TRUNC
|
||||
: O_EXCL));
|
||||
mode_t mode = current_stat_info.stat.st_mode & MODE_RWX & ~ current_umask;
|
||||
|
||||
#if O_CTG
|
||||
/* Contiguous files (on the Masscomp) have to specify the size in
|
||||
@@ -728,6 +741,9 @@ extract_file (char *file_name, int typeflag)
|
||||
size_t count;
|
||||
size_t written;
|
||||
int interdir_made = 0;
|
||||
mode_t mode = current_stat_info.stat.st_mode & MODE_RWX & ~ current_umask;
|
||||
mode_t invert_permissions =
|
||||
0 < same_owner_option ? mode & (S_IRWXG | S_IRWXO) : 0;
|
||||
|
||||
/* FIXME: deal with protection issues. */
|
||||
|
||||
@@ -745,11 +761,12 @@ extract_file (char *file_name, int typeflag)
|
||||
else
|
||||
{
|
||||
do
|
||||
fd = open_output_file (file_name, typeflag);
|
||||
fd = open_output_file (file_name, typeflag, mode ^ invert_permissions);
|
||||
while (fd < 0 && maybe_recoverable (file_name, &interdir_made));
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
skip_member ();
|
||||
open_error (file_name);
|
||||
return 1;
|
||||
}
|
||||
@@ -810,7 +827,7 @@ extract_file (char *file_name, int typeflag)
|
||||
if (to_command_option)
|
||||
sys_wait_command ();
|
||||
else
|
||||
set_stat (file_name, ¤t_stat_info, NULL, 0,
|
||||
set_stat (file_name, ¤t_stat_info, NULL, invert_permissions,
|
||||
(old_files_option == OVERWRITE_OLD_FILES ?
|
||||
UNKNOWN_PERMSTATUS : ARCHIVED_PERMSTATUS),
|
||||
typeflag);
|
||||
@@ -871,7 +888,7 @@ create_placeholder_file (char *file_name, bool is_symlink, int *interdir_made)
|
||||
if (h && ! h->after_links
|
||||
&& strncmp (file_name, h->file_name, h->file_name_len) == 0
|
||||
&& ISSLASH (file_name[h->file_name_len])
|
||||
&& (base_name (file_name) == file_name + h->file_name_len + 1))
|
||||
&& (last_component (file_name) == file_name + h->file_name_len + 1))
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -897,10 +914,11 @@ create_placeholder_file (char *file_name, bool is_symlink, int *interdir_made)
|
||||
static int
|
||||
extract_link (char *file_name, int typeflag)
|
||||
{
|
||||
char const *link_name = safer_name_suffix (current_stat_info.link_name,
|
||||
true, absolute_names_option);
|
||||
int interdir_made = 0;
|
||||
char const *link_name;
|
||||
|
||||
link_name = current_stat_info.link_name;
|
||||
|
||||
if (! absolute_names_option && contains_dot_dot (link_name))
|
||||
return create_placeholder_file (file_name, false, &interdir_made);
|
||||
|
||||
@@ -988,16 +1006,19 @@ extract_node (char *file_name, int typeflag)
|
||||
{
|
||||
int status;
|
||||
int interdir_made = 0;
|
||||
mode_t mode = current_stat_info.stat.st_mode & ~ current_umask;
|
||||
mode_t invert_permissions =
|
||||
0 < same_owner_option ? mode & (S_IRWXG | S_IRWXO) : 0;
|
||||
|
||||
do
|
||||
status = mknod (file_name, current_stat_info.stat.st_mode,
|
||||
status = mknod (file_name, mode ^ invert_permissions,
|
||||
current_stat_info.stat.st_rdev);
|
||||
while (status && maybe_recoverable (file_name, &interdir_made));
|
||||
|
||||
if (status != 0)
|
||||
mknod_error (file_name);
|
||||
else
|
||||
set_stat (file_name, ¤t_stat_info, NULL, 0,
|
||||
set_stat (file_name, ¤t_stat_info, NULL, invert_permissions,
|
||||
ARCHIVED_PERMSTATUS, typeflag);
|
||||
return status;
|
||||
}
|
||||
@@ -1009,13 +1030,16 @@ extract_fifo (char *file_name, int typeflag)
|
||||
{
|
||||
int status;
|
||||
int interdir_made = 0;
|
||||
mode_t mode = current_stat_info.stat.st_mode & ~ current_umask;
|
||||
mode_t invert_permissions =
|
||||
0 < same_owner_option ? mode & (S_IRWXG | S_IRWXO) : 0;
|
||||
|
||||
while ((status = mkfifo (file_name, current_stat_info.stat.st_mode)))
|
||||
while ((status = mkfifo (file_name, mode)) != 0)
|
||||
if (!maybe_recoverable (file_name, &interdir_made))
|
||||
break;
|
||||
|
||||
if (status == 0)
|
||||
set_stat (file_name, ¤t_stat_info, NULL, 0,
|
||||
set_stat (file_name, ¤t_stat_info, NULL, invert_permissions,
|
||||
ARCHIVED_PERMSTATUS, typeflag);
|
||||
else
|
||||
mkfifo_error (file_name);
|
||||
@@ -1023,13 +1047,6 @@ extract_fifo (char *file_name, int typeflag)
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
extract_mangle_wrapper (char *file_name, int typeflag)
|
||||
{
|
||||
extract_mangle ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
extract_volhdr (char *file_name, int typeflag)
|
||||
{
|
||||
@@ -1121,10 +1138,6 @@ prepare_to_extract (char const *file_name, int typeflag, tar_extractor_t *fun)
|
||||
*fun = extract_volhdr;
|
||||
break;
|
||||
|
||||
case GNUTYPE_NAMES:
|
||||
*fun = extract_mangle_wrapper;
|
||||
break;
|
||||
|
||||
case GNUTYPE_MULTIVOL:
|
||||
ERROR ((0, 0,
|
||||
_("%s: Cannot extract -- file is continued from another volume"),
|
||||
@@ -1331,10 +1344,10 @@ rename_directory (char *src, char *dst)
|
||||
e = errno;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case EXDEV:
|
||||
/* FIXME: Fall back to recursive copying */
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -1346,7 +1359,7 @@ rename_directory (char *src, char *dst)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
fatal_exit (void)
|
||||
{
|
||||
|
||||
483
src/incremen.c
483
src/incremen.c
@@ -1,11 +1,11 @@
|
||||
/* GNU dump extensions to tar.
|
||||
|
||||
Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,
|
||||
2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -18,7 +18,6 @@
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <system.h>
|
||||
#include <getline.h>
|
||||
#include <hash.h>
|
||||
#include <quotearg.h>
|
||||
#include "common.h"
|
||||
@@ -50,22 +49,156 @@ enum children
|
||||
#define DIR_SET_FLAG(d,f) (d)->flags |= (f)
|
||||
#define DIR_CLEAR_FLAG(d,f) (d)->flags &= ~(f)
|
||||
|
||||
struct dumpdir /* Dump directory listing */
|
||||
{
|
||||
char *contents; /* Actual contents */
|
||||
size_t total; /* Total number of elements */
|
||||
size_t elc; /* Number of D/N/Y elements. */
|
||||
char **elv; /* Array of D/N/Y elements */
|
||||
};
|
||||
|
||||
/* Directory attributes. */
|
||||
struct directory
|
||||
{
|
||||
struct directory *next;
|
||||
struct timespec mtime; /* Modification time */
|
||||
dev_t device_number; /* device number for directory */
|
||||
ino_t inode_number; /* inode number for directory */
|
||||
char *contents; /* Directory contents */
|
||||
char *icontents; /* Initial contents if the directory was
|
||||
struct dumpdir *dump; /* Directory contents */
|
||||
struct dumpdir *idump; /* Initial contents if the directory was
|
||||
rescanned */
|
||||
enum children children; /* What to save under this directory */
|
||||
unsigned flags; /* See DIRF_ macros above */
|
||||
struct directory *orig; /* If the directory was renamed, points to
|
||||
the original directory structure */
|
||||
char name[1]; /* file name of directory */
|
||||
const char *tagfile; /* Tag file, if the directory falls under
|
||||
exclusion_tag_under */
|
||||
char *name; /* file name of directory */
|
||||
};
|
||||
|
||||
struct dumpdir *
|
||||
dumpdir_create0 (const char *contents, const char *cmask)
|
||||
{
|
||||
struct dumpdir *dump;
|
||||
size_t i, total, ctsize, len;
|
||||
char *p;
|
||||
const char *q;
|
||||
|
||||
for (i = 0, total = 0, ctsize = 1, q = contents; *q; total++, q += len)
|
||||
{
|
||||
len = strlen (q) + 1;
|
||||
ctsize += len;
|
||||
if (!cmask || strchr (cmask, *q))
|
||||
i++;
|
||||
}
|
||||
dump = xmalloc (sizeof (*dump) + ctsize);
|
||||
dump->contents = (char*)(dump + 1);
|
||||
memcpy (dump->contents, contents, ctsize);
|
||||
dump->total = total;
|
||||
dump->elc = i;
|
||||
dump->elv = xcalloc (i + 1, sizeof (dump->elv[0]));
|
||||
|
||||
for (i = 0, p = dump->contents; *p; p += strlen (p) + 1)
|
||||
{
|
||||
if (!cmask || strchr (cmask, *p))
|
||||
dump->elv[i++] = p + 1;
|
||||
}
|
||||
dump->elv[i] = NULL;
|
||||
return dump;
|
||||
}
|
||||
|
||||
struct dumpdir *
|
||||
dumpdir_create (const char *contents)
|
||||
{
|
||||
return dumpdir_create0 (contents, "YND");
|
||||
}
|
||||
|
||||
void
|
||||
dumpdir_free (struct dumpdir *dump)
|
||||
{
|
||||
free (dump->elv);
|
||||
free (dump);
|
||||
}
|
||||
|
||||
static int
|
||||
compare_dirnames (const void *first, const void *second)
|
||||
{
|
||||
char const *const *name1 = first;
|
||||
char const *const *name2 = second;
|
||||
return strcmp (*name1, *name2);
|
||||
}
|
||||
|
||||
/* Locate NAME in the dumpdir array DUMP.
|
||||
Return pointer to the slot in DUMP->contents, or NULL if not found */
|
||||
char *
|
||||
dumpdir_locate (struct dumpdir *dump, const char *name)
|
||||
{
|
||||
char **ptr;
|
||||
if (!dump)
|
||||
return NULL;
|
||||
|
||||
ptr = bsearch (&name, dump->elv, dump->elc, sizeof (dump->elv[0]),
|
||||
compare_dirnames);
|
||||
return ptr ? *ptr - 1: NULL;
|
||||
}
|
||||
|
||||
struct dumpdir_iter
|
||||
{
|
||||
struct dumpdir *dump; /* Dumpdir being iterated */
|
||||
int all; /* Iterate over all entries, not only D/N/Y */
|
||||
size_t next; /* Index of the next element */
|
||||
};
|
||||
|
||||
char *
|
||||
dumpdir_next (struct dumpdir_iter *itr)
|
||||
{
|
||||
size_t cur = itr->next;
|
||||
char *ret = NULL;
|
||||
|
||||
if (itr->all)
|
||||
{
|
||||
ret = itr->dump->contents + cur;
|
||||
if (*ret == 0)
|
||||
return NULL;
|
||||
itr->next += strlen (ret) + 1;
|
||||
}
|
||||
else if (cur < itr->dump->elc)
|
||||
{
|
||||
ret = itr->dump->elv[cur] - 1;
|
||||
itr->next++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *
|
||||
dumpdir_first (struct dumpdir *dump, int all, struct dumpdir_iter **pitr)
|
||||
{
|
||||
struct dumpdir_iter *itr = xmalloc (sizeof (*itr));
|
||||
itr->dump = dump;
|
||||
itr->all = all;
|
||||
itr->next = 0;
|
||||
*pitr = itr;
|
||||
return dumpdir_next (itr);
|
||||
}
|
||||
|
||||
/* Return size in bytes of the dumpdir array P */
|
||||
size_t
|
||||
dumpdir_size (const char *p)
|
||||
{
|
||||
size_t totsize = 0;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
size_t size = strlen (p) + 1;
|
||||
totsize += size;
|
||||
p += size;
|
||||
}
|
||||
return totsize + 1;
|
||||
}
|
||||
|
||||
|
||||
static struct directory *dirhead, *dirtail;
|
||||
static Hash_table *directory_table;
|
||||
static Hash_table *directory_meta_table;
|
||||
|
||||
@@ -117,26 +250,78 @@ static struct directory *
|
||||
make_directory (const char *name)
|
||||
{
|
||||
size_t namelen = strlen (name);
|
||||
size_t size = offsetof (struct directory, name) + namelen + 1;
|
||||
struct directory *directory = xmalloc (size);
|
||||
directory->contents = directory->icontents = NULL;
|
||||
struct directory *directory = xmalloc (sizeof (*directory));
|
||||
directory->next = NULL;
|
||||
directory->dump = directory->idump = NULL;
|
||||
directory->orig = NULL;
|
||||
directory->flags = false;
|
||||
strcpy (directory->name, name);
|
||||
if (ISSLASH (directory->name[namelen-1]))
|
||||
directory->name[namelen-1] = 0;
|
||||
if (namelen && ISSLASH (name[namelen - 1]))
|
||||
namelen--;
|
||||
directory->name = xmalloc (namelen + 1);
|
||||
memcpy (directory->name, name, namelen);
|
||||
directory->name[namelen] = 0;
|
||||
directory->tagfile = NULL;
|
||||
return directory;
|
||||
}
|
||||
|
||||
static void
|
||||
free_directory (struct directory *dir)
|
||||
{
|
||||
free (dir->name);
|
||||
free (dir);
|
||||
}
|
||||
|
||||
static struct directory *
|
||||
attach_directory (const char *name)
|
||||
{
|
||||
struct directory *dir = make_directory (name);
|
||||
if (dirtail)
|
||||
dirtail->next = dir;
|
||||
else
|
||||
dirhead = dir;
|
||||
dirtail = dir;
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
replace_prefix (char **pname, const char *samp, size_t slen,
|
||||
const char *repl, size_t rlen)
|
||||
{
|
||||
char *name = *pname;
|
||||
size_t nlen = strlen (name);
|
||||
if (nlen > slen && memcmp (name, samp, slen) == 0 && ISSLASH (name[slen]))
|
||||
{
|
||||
if (rlen > slen)
|
||||
{
|
||||
name = xrealloc (name, nlen - slen + rlen + 1);
|
||||
*pname = name;
|
||||
}
|
||||
memmove (name + rlen, name + slen, nlen - slen + 1);
|
||||
memcpy (name, repl, rlen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
dirlist_replace_prefix (const char *pref, const char *repl)
|
||||
{
|
||||
struct directory *dp;
|
||||
size_t pref_len = strlen (pref);
|
||||
size_t repl_len = strlen (repl);
|
||||
for (dp = dirhead; dp; dp = dp->next)
|
||||
replace_prefix (&dp->name, pref, pref_len, repl, repl_len);
|
||||
}
|
||||
|
||||
/* Create and link a new directory entry for directory NAME, having a
|
||||
device number DEV and an inode number INO, with NFS indicating
|
||||
whether it is an NFS device and FOUND indicating whether we have
|
||||
found that the directory exists. */
|
||||
static struct directory *
|
||||
note_directory (char const *name, struct timespec mtime,
|
||||
dev_t dev, ino_t ino, bool nfs, bool found, char *contents)
|
||||
dev_t dev, ino_t ino, bool nfs, bool found,
|
||||
const char *contents)
|
||||
{
|
||||
struct directory *directory = make_directory (name);
|
||||
struct directory *directory = attach_directory (name);
|
||||
|
||||
directory->mtime = mtime;
|
||||
directory->device_number = dev;
|
||||
@@ -147,13 +332,9 @@ note_directory (char const *name, struct timespec mtime,
|
||||
if (found)
|
||||
DIR_SET_FLAG (directory, DIRF_FOUND);
|
||||
if (contents)
|
||||
{
|
||||
size_t size = dumpdir_size (contents);
|
||||
directory->contents = xmalloc (size);
|
||||
memcpy (directory->contents, contents, size);
|
||||
}
|
||||
directory->dump = dumpdir_create (contents);
|
||||
else
|
||||
directory->contents = NULL;
|
||||
directory->dump = NULL;
|
||||
|
||||
if (! ((directory_table
|
||||
|| (directory_table = hash_initialize (0, 0,
|
||||
@@ -183,7 +364,7 @@ find_directory (const char *name)
|
||||
{
|
||||
struct directory *dir = make_directory (name);
|
||||
struct directory *ret = hash_lookup (directory_table, dir);
|
||||
free (dir);
|
||||
free_directory (dir);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -202,7 +383,7 @@ find_directory_meta (dev_t dev, ino_t ino)
|
||||
dir->device_number = dev;
|
||||
dir->inode_number = ino;
|
||||
ret = hash_lookup (directory_meta_table, dir);
|
||||
free (dir);
|
||||
free_directory (dir);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -230,7 +411,8 @@ static struct directory *
|
||||
procdir (char *name_buffer, struct stat *stat_data,
|
||||
dev_t device,
|
||||
enum children children,
|
||||
bool verbose)
|
||||
bool verbose,
|
||||
char *entry)
|
||||
{
|
||||
struct directory *directory;
|
||||
bool nfs = NFS_FILE_STAT (*stat_data);
|
||||
@@ -247,7 +429,8 @@ procdir (char *name_buffer, struct stat *stat_data,
|
||||
directories, consider all NFS devices as equal,
|
||||
relying on the i-node to establish differences. */
|
||||
|
||||
if (! (((DIR_IS_NFS (directory) & nfs)
|
||||
if (! ((!check_device_option
|
||||
|| (DIR_IS_NFS (directory) && nfs)
|
||||
|| directory->device_number == stat_data->st_dev)
|
||||
&& directory->inode_number == stat_data->st_ino))
|
||||
{
|
||||
@@ -256,12 +439,16 @@ procdir (char *name_buffer, struct stat *stat_data,
|
||||
stat_data->st_ino);
|
||||
if (d)
|
||||
{
|
||||
if (verbose_option)
|
||||
WARN ((0, 0, _("%s: Directory has been renamed from %s"),
|
||||
quotearg_colon (name_buffer),
|
||||
quote_n (1, d->name)));
|
||||
directory->orig = d;
|
||||
DIR_SET_FLAG (directory, DIRF_RENAMED);
|
||||
if (strcmp (d->name, name_buffer))
|
||||
{
|
||||
if (verbose_option)
|
||||
WARN ((0, 0, _("%s: Directory has been renamed from %s"),
|
||||
quotearg_colon (name_buffer),
|
||||
quote_n (1, d->name)));
|
||||
directory->orig = d;
|
||||
DIR_SET_FLAG (directory, DIRF_RENAMED);
|
||||
dirlist_replace_prefix (d->name, name_buffer);
|
||||
}
|
||||
directory->children = CHANGED_CHILDREN;
|
||||
}
|
||||
else
|
||||
@@ -296,12 +483,16 @@ procdir (char *name_buffer, struct stat *stat_data,
|
||||
|
||||
if (d)
|
||||
{
|
||||
if (verbose)
|
||||
WARN ((0, 0, _("%s: Directory has been renamed from %s"),
|
||||
quotearg_colon (name_buffer),
|
||||
quote_n (1, d->name)));
|
||||
directory->orig = d;
|
||||
DIR_SET_FLAG (directory, DIRF_RENAMED);
|
||||
if (strcmp (d->name, name_buffer))
|
||||
{
|
||||
if (verbose)
|
||||
WARN ((0, 0, _("%s: Directory has been renamed from %s"),
|
||||
quotearg_colon (name_buffer),
|
||||
quote_n (1, d->name)));
|
||||
directory->orig = d;
|
||||
DIR_SET_FLAG (directory, DIRF_RENAMED);
|
||||
dirlist_replace_prefix (d->name, name_buffer);
|
||||
}
|
||||
directory->children = CHANGED_CHILDREN;
|
||||
}
|
||||
else
|
||||
@@ -331,54 +522,40 @@ procdir (char *name_buffer, struct stat *stat_data,
|
||||
|
||||
DIR_SET_FLAG (directory, DIRF_INIT);
|
||||
|
||||
return directory;
|
||||
}
|
||||
{
|
||||
const char *tag_file_name;
|
||||
|
||||
/* Locate NAME in the dumpdir array DUMP.
|
||||
Return pointer to the slot in the array, or NULL if not found */
|
||||
const char *
|
||||
dumpdir_locate (const char *dump, const char *name)
|
||||
{
|
||||
if (dump)
|
||||
while (*dump)
|
||||
switch (check_exclusion_tags (name_buffer, &tag_file_name))
|
||||
{
|
||||
/* Ignore 'R' (rename) and 'X' (tempname) entries, since they break
|
||||
alphabetical ordering.
|
||||
They normally do not occur in dumpdirs from the snapshot files,
|
||||
but this function is also used by purge_directory, which operates
|
||||
on a dumpdir from the archive, hence the need for this test. */
|
||||
if (!strchr ("RX", *dump))
|
||||
{
|
||||
int rc = strcmp (dump + 1, name);
|
||||
if (rc == 0)
|
||||
return dump;
|
||||
if (rc > 1)
|
||||
break;
|
||||
}
|
||||
dump += strlen (dump) + 1;
|
||||
case exclusion_tag_all:
|
||||
/* This warning can be duplicated by code in dump_file0, but only
|
||||
in case when the topmost directory being archived contains
|
||||
an exclusion tag. */
|
||||
exclusion_tag_warning (name_buffer, tag_file_name,
|
||||
_("directory not dumped"));
|
||||
if (entry)
|
||||
*entry = 'N';
|
||||
directory->children = NO_CHILDREN;
|
||||
break;
|
||||
|
||||
case exclusion_tag_contents:
|
||||
exclusion_tag_warning (name_buffer, tag_file_name,
|
||||
_("contents not dumped"));
|
||||
directory->children = NO_CHILDREN;
|
||||
break;
|
||||
|
||||
case exclusion_tag_under:
|
||||
exclusion_tag_warning (name_buffer, tag_file_name,
|
||||
_("contents not dumped"));
|
||||
directory->tagfile = tag_file_name;
|
||||
break;
|
||||
|
||||
case exclusion_tag_none:
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return size in bytes of the dumpdir array P */
|
||||
size_t
|
||||
dumpdir_size (const char *p)
|
||||
{
|
||||
size_t totsize = 0;
|
||||
|
||||
while (*p)
|
||||
{
|
||||
size_t size = strlen (p) + 1;
|
||||
totsize += size;
|
||||
p += size;
|
||||
}
|
||||
return totsize + 1;
|
||||
}
|
||||
|
||||
static int
|
||||
compare_dirnames (const void *first, const void *second)
|
||||
{
|
||||
return strcmp (*(const char**)first, *(const char**)second);
|
||||
return directory;
|
||||
}
|
||||
|
||||
/* Compare dumpdir array from DIRECTORY with directory listing DIR and
|
||||
@@ -386,10 +563,10 @@ compare_dirnames (const void *first, const void *second)
|
||||
|
||||
DIR must be returned by a previous call to savedir().
|
||||
|
||||
File names in DIRECTORY->contents must be sorted
|
||||
File names in DIRECTORY->dump->contents must be sorted
|
||||
alphabetically.
|
||||
|
||||
DIRECTORY->contents is replaced with the created template. Each entry is
|
||||
DIRECTORY->dump is replaced with the created template. Each entry is
|
||||
prefixed with ' ' if it was present in DUMP and with 'Y' otherwise. */
|
||||
|
||||
void
|
||||
@@ -401,15 +578,15 @@ makedumpdir (struct directory *directory, const char *dir)
|
||||
const char *p;
|
||||
char const **array;
|
||||
char *new_dump, *new_dump_ptr;
|
||||
const char *dump;
|
||||
struct dumpdir *dump;
|
||||
|
||||
if (directory->children == ALL_CHILDREN)
|
||||
dump = NULL;
|
||||
else if (DIR_IS_RENAMED (directory))
|
||||
dump = directory->orig->icontents ?
|
||||
directory->orig->icontents : directory->orig->contents;
|
||||
dump = directory->orig->idump ?
|
||||
directory->orig->idump : directory->orig->dump;
|
||||
else
|
||||
dump = directory->contents;
|
||||
dump = directory->dump;
|
||||
|
||||
/* Count the size of DIR and the number of elements it contains */
|
||||
dirsize = 0;
|
||||
@@ -435,9 +612,16 @@ makedumpdir (struct directory *directory, const char *dir)
|
||||
const char *loc = dumpdir_locate (dump, array[i]);
|
||||
if (loc)
|
||||
{
|
||||
*new_dump_ptr++ = ' ';
|
||||
dump = loc + strlen (loc) + 1;
|
||||
if (directory->tagfile)
|
||||
*new_dump_ptr = strcmp (directory->tagfile, array[i]) == 0 ?
|
||||
' ' : 'I';
|
||||
else
|
||||
*new_dump_ptr = ' ';
|
||||
new_dump_ptr++;
|
||||
}
|
||||
else if (directory->tagfile)
|
||||
*new_dump_ptr++ = strcmp (directory->tagfile, array[i]) == 0 ?
|
||||
' ' : 'I';
|
||||
else
|
||||
*new_dump_ptr++ = 'Y'; /* New entry */
|
||||
|
||||
@@ -446,16 +630,16 @@ makedumpdir (struct directory *directory, const char *dir)
|
||||
;
|
||||
}
|
||||
*new_dump_ptr = 0;
|
||||
directory->icontents = directory->contents;
|
||||
directory->contents = new_dump;
|
||||
directory->idump = directory->dump;
|
||||
directory->dump = dumpdir_create0 (new_dump, NULL);
|
||||
free (array);
|
||||
}
|
||||
|
||||
/* Recursively scan the given directory. */
|
||||
static char *
|
||||
scan_directory (char *dir_name, dev_t device)
|
||||
static const char *
|
||||
scan_directory (char *dir, dev_t device)
|
||||
{
|
||||
char *dirp = savedir (dir_name); /* for scanning directory */
|
||||
char *dirp = savedir (dir); /* for scanning directory */
|
||||
char *name_buffer; /* directory, `/', and directory member */
|
||||
size_t name_buffer_size; /* allocated size of name_buffer, minus 2 */
|
||||
size_t name_length; /* used length in name_buffer */
|
||||
@@ -463,12 +647,12 @@ scan_directory (char *dir_name, dev_t device)
|
||||
struct directory *directory;
|
||||
|
||||
if (! dirp)
|
||||
savedir_error (dir_name);
|
||||
savedir_error (dir);
|
||||
|
||||
name_buffer_size = strlen (dir_name) + NAME_FIELD_SIZE;
|
||||
name_buffer_size = strlen (dir) + NAME_FIELD_SIZE;
|
||||
name_buffer = xmalloc (name_buffer_size + 2);
|
||||
strcpy (name_buffer, dir_name);
|
||||
if (! ISSLASH (dir_name[strlen (dir_name) - 1]))
|
||||
strcpy (name_buffer, dir);
|
||||
if (! ISSLASH (dir[strlen (dir) - 1]))
|
||||
strcat (name_buffer, "/");
|
||||
name_length = strlen (name_buffer);
|
||||
|
||||
@@ -483,19 +667,22 @@ scan_directory (char *dir_name, dev_t device)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
directory = procdir (name_buffer, &stat_data, device, NO_CHILDREN, false);
|
||||
directory = procdir (name_buffer, &stat_data, device, NO_CHILDREN, false,
|
||||
NULL);
|
||||
|
||||
if (dirp && directory->children != NO_CHILDREN)
|
||||
{
|
||||
char *entry; /* directory entry being scanned */
|
||||
char *entry; /* directory entry being scanned */
|
||||
size_t entrylen; /* length of directory entry */
|
||||
dumpdir_iter_t itr;
|
||||
|
||||
makedumpdir (directory, dirp);
|
||||
|
||||
for (entry = directory->contents;
|
||||
(entrylen = strlen (entry)) != 0;
|
||||
entry += entrylen + 1)
|
||||
for (entry = dumpdir_first (directory->dump, 1, &itr);
|
||||
entry;
|
||||
entry = dumpdir_next (itr))
|
||||
{
|
||||
entrylen = strlen (entry);
|
||||
if (name_buffer_size <= entrylen - 1 + name_length)
|
||||
{
|
||||
do
|
||||
@@ -505,7 +692,9 @@ scan_directory (char *dir_name, dev_t device)
|
||||
}
|
||||
strcpy (name_buffer + name_length, entry + 1);
|
||||
|
||||
if (excluded_name (name_buffer))
|
||||
if (*entry == 'I') /* Ignored entry */
|
||||
*entry = 'N';
|
||||
else if (excluded_name (name_buffer))
|
||||
*entry = 'N';
|
||||
else
|
||||
{
|
||||
@@ -518,10 +707,10 @@ scan_directory (char *dir_name, dev_t device)
|
||||
|
||||
if (S_ISDIR (stat_data.st_mode))
|
||||
{
|
||||
*entry = 'D';
|
||||
procdir (name_buffer, &stat_data, device,
|
||||
directory->children,
|
||||
verbose_option);
|
||||
*entry = 'D';
|
||||
verbose_option, entry);
|
||||
}
|
||||
|
||||
else if (one_file_system_option && device != stat_data.st_dev)
|
||||
@@ -540,42 +729,47 @@ scan_directory (char *dir_name, dev_t device)
|
||||
*entry = 'Y';
|
||||
}
|
||||
}
|
||||
free (itr);
|
||||
}
|
||||
|
||||
free (name_buffer);
|
||||
if (dirp)
|
||||
free (dirp);
|
||||
|
||||
return directory->contents;
|
||||
return directory->dump ? directory->dump->contents : NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
get_directory_contents (char *dir_name, dev_t device)
|
||||
const char *
|
||||
get_directory_contents (char *dir, dev_t device)
|
||||
{
|
||||
return scan_directory (dir_name, device);
|
||||
return scan_directory (dir, device);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
obstack_code_rename (struct obstack *stk, char *from, char *to)
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = from[0] == 0 ? from :
|
||||
safer_name_suffix (from, false, absolute_names_option);
|
||||
obstack_1grow (stk, 'R');
|
||||
obstack_grow (stk, from, strlen (from) + 1);
|
||||
obstack_grow (stk, s, strlen (s) + 1);
|
||||
|
||||
s = to[0] == 0 ? to:
|
||||
safer_name_suffix (to, false, absolute_names_option);
|
||||
obstack_1grow (stk, 'T');
|
||||
obstack_grow (stk, to, strlen (to) + 1);
|
||||
obstack_grow (stk, s, strlen (s) + 1);
|
||||
}
|
||||
|
||||
static bool
|
||||
rename_handler (void *data, void *proc_data)
|
||||
static void
|
||||
store_rename (struct directory *dir, struct obstack *stk)
|
||||
{
|
||||
struct directory *dir = data;
|
||||
struct obstack *stk = proc_data;
|
||||
|
||||
if (DIR_IS_RENAMED (dir))
|
||||
{
|
||||
struct directory *prev, *p;
|
||||
|
||||
/* Detect eventual cycles and clear DIRF_RENAMED flag, so this entries
|
||||
/* Detect eventual cycles and clear DIRF_RENAMED flag, so these entries
|
||||
are ignored when hit by this function next time.
|
||||
If the chain forms a cycle, prev points to the entry DIR is renamed
|
||||
from. In this case it still retains DIRF_RENAMED flag, which will be
|
||||
@@ -609,7 +803,6 @@ rename_handler (void *data, void *proc_data)
|
||||
obstack_code_rename (stk, "", prev->name);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *
|
||||
@@ -617,8 +810,9 @@ append_incremental_renames (const char *dump)
|
||||
{
|
||||
struct obstack stk;
|
||||
size_t size;
|
||||
|
||||
if (directory_table == NULL)
|
||||
struct directory *dp;
|
||||
|
||||
if (dirhead == NULL)
|
||||
return dump;
|
||||
|
||||
obstack_init (&stk);
|
||||
@@ -630,7 +824,9 @@ append_incremental_renames (const char *dump)
|
||||
else
|
||||
size = 0;
|
||||
|
||||
hash_do_for_each (directory_table, rename_handler, &stk);
|
||||
for (dp = dirhead; dp; dp = dp->next)
|
||||
store_rename (dp, &stk);
|
||||
|
||||
if (obstack_object_size (&stk) != size)
|
||||
{
|
||||
obstack_1grow (&stk, 0);
|
||||
@@ -1114,14 +1310,16 @@ write_directory_file_entry (void *entry, void *data)
|
||||
fwrite (s, strlen (s) + 1, 1, fp);
|
||||
|
||||
fwrite (directory->name, strlen (directory->name) + 1, 1, fp);
|
||||
if (directory->contents)
|
||||
if (directory->dump)
|
||||
{
|
||||
char *p;
|
||||
for (p = directory->contents; *p; p += strlen (p) + 1)
|
||||
{
|
||||
if (strchr ("YND", *p))
|
||||
fwrite (p, strlen (p) + 1, 1, fp);
|
||||
}
|
||||
const char *p;
|
||||
dumpdir_iter_t itr;
|
||||
|
||||
for (p = dumpdir_first (directory->dump, 0, &itr);
|
||||
p;
|
||||
p = dumpdir_next (itr))
|
||||
fwrite (p, strlen (p) + 1, 1, fp);
|
||||
free (itr);
|
||||
}
|
||||
fwrite ("\0\0", 2, 1, fp);
|
||||
}
|
||||
@@ -1309,6 +1507,7 @@ try_purge_directory (char const *directory_name)
|
||||
char *current_dir;
|
||||
char *cur, *arc, *p;
|
||||
char *temp_stub = NULL;
|
||||
struct dumpdir *dump;
|
||||
|
||||
if (!is_dumpdir (¤t_stat_info))
|
||||
return false;
|
||||
@@ -1353,6 +1552,19 @@ try_purge_directory (char const *directory_name)
|
||||
arc += strlen (arc) + 1;
|
||||
dst = arc + 1;
|
||||
|
||||
/* Ensure that neither source nor destination are absolute file
|
||||
names (unless permitted by -P option), and that they do not
|
||||
contain dubious parts (e.g. ../).
|
||||
|
||||
This is an extra safety precaution. Besides, it might be
|
||||
necessary to extract from archives created with tar versions
|
||||
prior to 1.19. */
|
||||
|
||||
if (*src)
|
||||
src = safer_name_suffix (src, false, absolute_names_option);
|
||||
if (*dst)
|
||||
dst = safer_name_suffix (dst, false, absolute_names_option);
|
||||
|
||||
if (*src == 0)
|
||||
src = temp_stub;
|
||||
else if (*dst == 0)
|
||||
@@ -1372,6 +1584,7 @@ try_purge_directory (char const *directory_name)
|
||||
free (temp_stub);
|
||||
|
||||
/* Process deletes */
|
||||
dump = dumpdir_create (current_stat_info.dumpdir);
|
||||
p = NULL;
|
||||
for (cur = current_dir; *cur; cur += strlen (cur) + 1)
|
||||
{
|
||||
@@ -1393,7 +1606,7 @@ try_purge_directory (char const *directory_name)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(entry = dumpdir_locate (current_stat_info.dumpdir, cur))
|
||||
if (!(entry = dumpdir_locate (dump, cur))
|
||||
|| (*entry == 'D' && !S_ISDIR (st.st_mode))
|
||||
|| (*entry == 'Y' && S_ISDIR (st.st_mode)))
|
||||
{
|
||||
@@ -1419,7 +1632,8 @@ try_purge_directory (char const *directory_name)
|
||||
}
|
||||
}
|
||||
free (p);
|
||||
|
||||
dumpdir_free (dump);
|
||||
|
||||
free (current_dir);
|
||||
return true;
|
||||
}
|
||||
@@ -1434,6 +1648,7 @@ purge_directory (char const *directory_name)
|
||||
void
|
||||
list_dumpdir (char *buffer, size_t size)
|
||||
{
|
||||
int state = 0;
|
||||
while (size)
|
||||
{
|
||||
switch (*buffer)
|
||||
@@ -1444,7 +1659,12 @@ list_dumpdir (char *buffer, size_t size)
|
||||
case 'R':
|
||||
case 'T':
|
||||
case 'X':
|
||||
fprintf (stdlis, "%c ", *buffer);
|
||||
fprintf (stdlis, "%c", *buffer);
|
||||
if (state == 0)
|
||||
{
|
||||
fprintf (stdlis, " ");
|
||||
state = 1;
|
||||
}
|
||||
buffer++;
|
||||
size--;
|
||||
break;
|
||||
@@ -1453,6 +1673,7 @@ list_dumpdir (char *buffer, size_t size)
|
||||
fputc ('\n', stdlis);
|
||||
buffer++;
|
||||
size--;
|
||||
state = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
73
src/list.c
73
src/list.c
@@ -1,13 +1,13 @@
|
||||
/* List a tar archive, with support routines for reading a tar archive.
|
||||
|
||||
Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000,
|
||||
2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
2001, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
Written by John Gilmore, on 1985-08-26.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -76,7 +76,6 @@ read_and (void (*do_something) (void))
|
||||
{
|
||||
prev_status = status;
|
||||
tar_stat_destroy (¤t_stat_info);
|
||||
xheader_destroy (&extended_header);
|
||||
|
||||
status = read_header (false);
|
||||
switch (status)
|
||||
@@ -107,7 +106,6 @@ read_and (void (*do_something) (void))
|
||||
{
|
||||
case GNUTYPE_VOLHDR:
|
||||
case GNUTYPE_MULTIVOL:
|
||||
case GNUTYPE_NAMES:
|
||||
break;
|
||||
|
||||
case DIRTYPE:
|
||||
@@ -303,8 +301,8 @@ read_header_primitive (bool raw_extended_headers, struct tar_stat_info *info)
|
||||
size_t size, written;
|
||||
union block *next_long_name = 0;
|
||||
union block *next_long_link = 0;
|
||||
size_t next_long_name_blocks;
|
||||
size_t next_long_link_blocks;
|
||||
size_t next_long_name_blocks = 0;
|
||||
size_t next_long_link_blocks = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
@@ -388,12 +386,16 @@ read_header_primitive (bool raw_extended_headers, struct tar_stat_info *info)
|
||||
}
|
||||
else if (header->header.typeflag == XHDTYPE
|
||||
|| header->header.typeflag == SOLARIS_XHDTYPE)
|
||||
xheader_read (header, OFF_FROM_HEADER (header->header.size));
|
||||
xheader_read (&info->xhdr, header,
|
||||
OFF_FROM_HEADER (header->header.size));
|
||||
else if (header->header.typeflag == XGLTYPE)
|
||||
{
|
||||
xheader_read (header, OFF_FROM_HEADER (header->header.size));
|
||||
xheader_decode_global ();
|
||||
xheader_destroy (&extended_header);
|
||||
struct xheader xhdr;
|
||||
memset (&xhdr, 0, sizeof xhdr);
|
||||
xheader_read (&xhdr, header,
|
||||
OFF_FROM_HEADER (header->header.size));
|
||||
xheader_decode_global (&xhdr);
|
||||
xheader_destroy (&xhdr);
|
||||
}
|
||||
|
||||
/* Loop! */
|
||||
@@ -468,9 +470,29 @@ read_header (bool raw_extended_headers)
|
||||
}
|
||||
|
||||
static char *
|
||||
decode_xform (char *file_name)
|
||||
decode_xform (char *file_name, void *data)
|
||||
{
|
||||
file_name = safer_name_suffix (file_name, false, absolute_names_option);
|
||||
int type = *(int*)data;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case XFORM_SYMLINK:
|
||||
/* FIXME: It is not quite clear how and to which extent are the symbolic
|
||||
links subject to filename transformation. In the absence of another
|
||||
solution, symbolic links are exempt from component stripping and
|
||||
name suffix normalization, but subject to filename transformation
|
||||
proper. */
|
||||
return file_name;
|
||||
|
||||
case XFORM_LINK:
|
||||
file_name = safer_name_suffix (file_name, true, absolute_names_option);
|
||||
break;
|
||||
|
||||
case XFORM_REGFILE:
|
||||
file_name = safer_name_suffix (file_name, false, absolute_names_option);
|
||||
break;
|
||||
}
|
||||
|
||||
if (strip_name_components)
|
||||
{
|
||||
size_t prefix_len = stripped_prefix_len (file_name,
|
||||
@@ -482,6 +504,12 @@ decode_xform (char *file_name)
|
||||
return file_name;
|
||||
}
|
||||
|
||||
bool
|
||||
transform_member_name (char **pinput, int type)
|
||||
{
|
||||
return transform_name_fp (pinput, type, decode_xform, &type);
|
||||
}
|
||||
|
||||
#define ISOCTAL(c) ((c)>='0'&&(c)<='7')
|
||||
|
||||
/* Decode things from a file HEADER block into STAT_INFO, also setting
|
||||
@@ -511,7 +539,7 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
|
||||
&& ISOCTAL (header->star_header.ctime[0])
|
||||
&& header->star_header.ctime[11] == ' ')
|
||||
format = STAR_FORMAT;
|
||||
else if (extended_header.size)
|
||||
else if (stat_info->xhdr.size)
|
||||
format = POSIX_FORMAT;
|
||||
else
|
||||
format = USTAR_FORMAT;
|
||||
@@ -600,7 +628,16 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
|
||||
stat_info->is_dumpdir = true;
|
||||
}
|
||||
|
||||
transform_name_fp (&stat_info->file_name, decode_xform);
|
||||
transform_member_name (&stat_info->file_name, XFORM_REGFILE);
|
||||
switch (header->header.typeflag)
|
||||
{
|
||||
case SYMTYPE:
|
||||
transform_member_name (&stat_info->link_name, XFORM_SYMLINK);
|
||||
break;
|
||||
|
||||
case LNKTYPE:
|
||||
transform_member_name (&stat_info->link_name, XFORM_LINK);
|
||||
}
|
||||
}
|
||||
|
||||
/* Convert buffer at WHERE0 of size DIGS from external format to
|
||||
@@ -1047,10 +1084,6 @@ print_header (struct tar_stat_info *st, off_t block_ordinal)
|
||||
modes[0] = 'M';
|
||||
break;
|
||||
|
||||
case GNUTYPE_NAMES:
|
||||
modes[0] = 'N';
|
||||
break;
|
||||
|
||||
case GNUTYPE_LONGNAME:
|
||||
case GNUTYPE_LONGLINK:
|
||||
modes[0] = 'L';
|
||||
@@ -1234,10 +1267,6 @@ print_header (struct tar_stat_info *st, off_t block_ordinal)
|
||||
uintbuf));
|
||||
fprintf (stdlis, _("--Continued at byte %s--\n"), size);
|
||||
break;
|
||||
|
||||
case GNUTYPE_NAMES:
|
||||
fprintf (stdlis, _("--Mangled file names--\n"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
fflush (stdlis);
|
||||
|
||||
121
src/mangle.c
121
src/mangle.c
@@ -1,121 +0,0 @@
|
||||
/* Encode long filenames for GNU tar.
|
||||
Copyright 1988, 92, 94, 96, 97, 99, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <system.h>
|
||||
#include "common.h"
|
||||
#include <quotearg.h>
|
||||
|
||||
struct mangled
|
||||
{
|
||||
struct mangled *next;
|
||||
int type;
|
||||
char mangled[NAME_FIELD_SIZE];
|
||||
char *linked_to;
|
||||
char normal[1];
|
||||
};
|
||||
|
||||
/* Extract a GNUTYPE_NAMES record contents. It seems that such are
|
||||
not produced anymore by GNU tar, but we leave the reading code
|
||||
around nevertheless, for salvaging old tapes. */
|
||||
void
|
||||
extract_mangle (void)
|
||||
{
|
||||
off_t size = current_stat_info.stat.st_size;
|
||||
char *buffer = xmalloc ((size_t) (size + 1));
|
||||
char *copy = buffer;
|
||||
char *cursor = buffer;
|
||||
|
||||
if (size != (size_t) size || size == (size_t) -1)
|
||||
xalloc_die ();
|
||||
|
||||
buffer[size] = '\0';
|
||||
|
||||
while (size > 0)
|
||||
{
|
||||
union block *block = find_next_block ();
|
||||
size_t available;
|
||||
|
||||
if (!block)
|
||||
{
|
||||
ERROR ((0, 0, _("Unexpected EOF in mangled names")));
|
||||
return;
|
||||
}
|
||||
available = available_space_after (block);
|
||||
if (available > size)
|
||||
available = size;
|
||||
memcpy (copy, block->buffer, available);
|
||||
copy += available;
|
||||
size -= available;
|
||||
set_next_block_after ((union block *) (block->buffer + available - 1));
|
||||
}
|
||||
|
||||
while (*cursor)
|
||||
{
|
||||
char *next_cursor;
|
||||
char *name;
|
||||
char *name_end;
|
||||
|
||||
next_cursor = strchr (cursor, '\n');
|
||||
*next_cursor++ = '\0';
|
||||
|
||||
if (!strncmp (cursor, "Rename ", 7))
|
||||
{
|
||||
|
||||
name = cursor + 7;
|
||||
name_end = strchr (name, ' ');
|
||||
while (strncmp (name_end, " to ", 4))
|
||||
{
|
||||
name_end++;
|
||||
name_end = strchr (name_end, ' ');
|
||||
}
|
||||
*name_end = '\0';
|
||||
if (next_cursor[-2] == '/')
|
||||
next_cursor[-2] = '\0';
|
||||
unquote_string (name_end + 4);
|
||||
if (rename (name, name_end + 4))
|
||||
ERROR ((0, errno, _("%s: Cannot rename to %s"),
|
||||
quotearg_colon (name), quote_n (1, name_end + 4)));
|
||||
else if (verbose_option)
|
||||
WARN ((0, 0, _("Renamed %s to %s"), name, name_end + 4));
|
||||
}
|
||||
#ifdef HAVE_SYMLINK
|
||||
else if (!strncmp (cursor, "Symlink ", 8))
|
||||
{
|
||||
name = cursor + 8;
|
||||
name_end = strchr (name, ' ');
|
||||
while (strncmp (name_end, " to ", 4))
|
||||
{
|
||||
name_end++;
|
||||
name_end = strchr (name_end, ' ');
|
||||
}
|
||||
*name_end = '\0';
|
||||
unquote_string (name);
|
||||
unquote_string (name_end + 4);
|
||||
if (symlink (name, name_end + 4)
|
||||
&& (unlink (name_end + 4) || symlink (name, name_end + 4)))
|
||||
ERROR ((0, errno, _("%s: Cannot symlink to %s"),
|
||||
quotearg_colon (name), quote_n (1, name_end + 4)));
|
||||
else if (verbose_option)
|
||||
WARN ((0, 0, _("Symlinked %s to %s"), name, name_end + 4));
|
||||
}
|
||||
#endif
|
||||
else
|
||||
ERROR ((0, 0, _("Unknown demangling command %s"), cursor));
|
||||
|
||||
cursor = next_cursor;
|
||||
}
|
||||
}
|
||||
67
src/misc.c
67
src/misc.c
@@ -1,11 +1,11 @@
|
||||
/* Miscellaneous functions, not really specific to GNU tar.
|
||||
|
||||
Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
|
||||
2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -18,8 +18,6 @@
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <system.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <rmt.h>
|
||||
#include "common.h"
|
||||
#include <quotearg.h>
|
||||
@@ -518,7 +516,7 @@ set_file_atime (int fd, char const *file, struct timespec const timespec[2])
|
||||
}
|
||||
#endif
|
||||
|
||||
return futimens (fd, file, timespec);
|
||||
return gl_futimens (fd, file, timespec);
|
||||
}
|
||||
|
||||
/* A description of a working directory. */
|
||||
@@ -577,41 +575,13 @@ chdir_arg (char const *dir)
|
||||
return wds++;
|
||||
}
|
||||
|
||||
/* Return maximum number of open files */
|
||||
int
|
||||
get_max_open_files ()
|
||||
{
|
||||
#if defined _SC_OPEN_MAX
|
||||
return sysconf (_SC_OPEN_MAX);
|
||||
#elif defined RLIMIT_NOFILE
|
||||
struct rlimit rlim;
|
||||
|
||||
if (getrlimit(RLIMIT_NOFILE, &rlim) == 0)
|
||||
return rlim.rlim_max;
|
||||
#elif defined HAVE_GETDTABLESIZE
|
||||
return getdtablesize ();
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Close all descriptors, except the first three */
|
||||
void
|
||||
closeopen ()
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = get_max_open_files () - 1; i > 2; i--)
|
||||
close (i);
|
||||
}
|
||||
|
||||
/* Change to directory I. If I is 0, change to the initial working
|
||||
directory; otherwise, I must be a value returned by chdir_arg. */
|
||||
void
|
||||
chdir_do (int i)
|
||||
{
|
||||
static int previous;
|
||||
static int saved_count;
|
||||
|
||||
|
||||
if (previous != i)
|
||||
{
|
||||
struct wd *prev = &wd[previous];
|
||||
@@ -619,17 +589,30 @@ chdir_do (int i)
|
||||
|
||||
if (! prev->saved)
|
||||
{
|
||||
int err = 0;
|
||||
prev->saved = 1;
|
||||
saved_count++;
|
||||
/* Make sure we still have at least one descriptor available */
|
||||
if (saved_count >= get_max_open_files () - 4)
|
||||
if (save_cwd (&prev->saved_cwd) != 0)
|
||||
err = errno;
|
||||
else if (0 <= prev->saved_cwd.desc)
|
||||
{
|
||||
/* Force restore_cwd to use chdir_long */
|
||||
prev->saved_cwd.desc = -1;
|
||||
prev->saved_cwd.name = xgetcwd ();
|
||||
/* Make sure we still have at least one descriptor available. */
|
||||
int fd1 = prev->saved_cwd.desc;
|
||||
int fd2 = dup (fd1);
|
||||
if (0 <= fd2)
|
||||
close (fd2);
|
||||
else if (errno == EMFILE)
|
||||
{
|
||||
/* Force restore_cwd to use chdir_long. */
|
||||
close (fd1);
|
||||
prev->saved_cwd.desc = -1;
|
||||
prev->saved_cwd.name = xgetcwd ();
|
||||
}
|
||||
else
|
||||
err = errno;
|
||||
}
|
||||
else if (save_cwd (&prev->saved_cwd) != 0)
|
||||
FATAL_ERROR ((0, 0, _("Cannot save working directory")));
|
||||
|
||||
if (err)
|
||||
FATAL_ERROR ((0, err, _("Cannot save working directory")));
|
||||
}
|
||||
|
||||
if (curr->saved)
|
||||
|
||||
26
src/names.c
26
src/names.c
@@ -1,11 +1,11 @@
|
||||
/* Various processing of names.
|
||||
|
||||
Copyright (C) 1988, 1992, 1994, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -289,9 +289,8 @@ static int matching_flags; /* exclude_fnmatch options */
|
||||
static storage and can't be relied upon across two calls.
|
||||
|
||||
If CHANGE_DIRS is true, treat any entries of type NELT_CHDIR as
|
||||
the request to change to the given directory. If filename_terminator
|
||||
is NUL, CHANGE_DIRS is effectively always false.
|
||||
|
||||
the request to change to the given directory.
|
||||
|
||||
Entries of type NELT_FMASK cause updates of the matching_flags
|
||||
value. */
|
||||
struct name_elt *
|
||||
@@ -301,9 +300,6 @@ name_next_elt (int change_dirs)
|
||||
const char *source;
|
||||
char *cursor;
|
||||
|
||||
if (filename_terminator == '\0')
|
||||
change_dirs = 0;
|
||||
|
||||
while (name_index != names)
|
||||
{
|
||||
struct name_elt *ep;
|
||||
@@ -392,9 +388,7 @@ name_gather (void)
|
||||
if (allocated_size == 0)
|
||||
{
|
||||
allocated_size = offsetof (struct name, name) + NAME_FIELD_SIZE + 1;
|
||||
buffer = xmalloc (allocated_size);
|
||||
/* FIXME: This memset is overkill, and ugly... */
|
||||
memset (buffer, 0, allocated_size);
|
||||
buffer = xzalloc (allocated_size);
|
||||
}
|
||||
|
||||
while ((ep = name_next_elt (0)) && ep->type == NELT_CHDIR)
|
||||
@@ -572,8 +566,7 @@ all_names_found (struct tar_stat_info *p)
|
||||
len = strlen (p->file_name);
|
||||
for (cursor = namelist; cursor; cursor = cursor->next)
|
||||
{
|
||||
if (cursor->matching_flags /* FIXME: check this */
|
||||
|| (!WASFOUND (cursor) && cursor->name[0])
|
||||
if ((cursor->name[0] && !WASFOUND (cursor))
|
||||
|| (len >= cursor->length && ISSLASH (p->file_name[cursor->length])))
|
||||
return false;
|
||||
}
|
||||
@@ -735,7 +728,7 @@ static void
|
||||
add_hierarchy_to_namelist (struct name *name, dev_t device)
|
||||
{
|
||||
char *file_name = name->name;
|
||||
char *buffer = get_directory_contents (file_name, device);
|
||||
const char *buffer = get_directory_contents (file_name, device);
|
||||
|
||||
if (! buffer)
|
||||
name->dir_contents = "\0\0\0\0";
|
||||
@@ -747,7 +740,7 @@ add_hierarchy_to_namelist (struct name *name, dev_t device)
|
||||
: NAME_FIELD_SIZE);
|
||||
char *namebuf = xmalloc (allocated_length + 1);
|
||||
/* FIXME: + 2 above? */
|
||||
char *string;
|
||||
const char *string;
|
||||
size_t string_length;
|
||||
int change_dir = name->change_dir;
|
||||
|
||||
@@ -1013,11 +1006,10 @@ contains_dot_dot (char const *name)
|
||||
if (p[0] == '.' && p[1] == '.' && (ISSLASH (p[2]) || !p[2]))
|
||||
return 1;
|
||||
|
||||
do
|
||||
while (! ISSLASH (*p))
|
||||
{
|
||||
if (! *p++)
|
||||
return 0;
|
||||
}
|
||||
while (! ISSLASH (*p));
|
||||
}
|
||||
}
|
||||
|
||||
26
src/sparse.c
26
src/sparse.c
@@ -1,10 +1,10 @@
|
||||
/* Functions for dealing with sparse files
|
||||
|
||||
Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -466,7 +466,7 @@ sparse_skip_file (struct tar_stat_info *st)
|
||||
file.fd = -1;
|
||||
|
||||
rc = tar_sparse_decode_header (&file);
|
||||
skip_file (file.stat_info->archive_file_size);
|
||||
skip_file (file.stat_info->archive_file_size - file.dumped_size);
|
||||
return (tar_sparse_done (&file) && rc) ? dump_status_ok : dump_status_short;
|
||||
}
|
||||
|
||||
@@ -945,16 +945,19 @@ pax_dump_header_0 (struct tar_sparse_file *file)
|
||||
file->stat_info->file_name = xheader_format_name (file->stat_info,
|
||||
"%d/GNUSparseFile.%p/%f", 0);
|
||||
|
||||
xheader_string_begin ();
|
||||
xheader_string_begin (&file->stat_info->xhdr);
|
||||
for (i = 0; i < file->stat_info->sparse_map_avail; i++)
|
||||
{
|
||||
if (i)
|
||||
xheader_string_add (",");
|
||||
xheader_string_add (umaxtostr (map[i].offset, nbuf));
|
||||
xheader_string_add (",");
|
||||
xheader_string_add (umaxtostr (map[i].numbytes, nbuf));
|
||||
xheader_string_add (&file->stat_info->xhdr, ",");
|
||||
xheader_string_add (&file->stat_info->xhdr,
|
||||
umaxtostr (map[i].offset, nbuf));
|
||||
xheader_string_add (&file->stat_info->xhdr, ",");
|
||||
xheader_string_add (&file->stat_info->xhdr,
|
||||
umaxtostr (map[i].numbytes, nbuf));
|
||||
}
|
||||
if (!xheader_string_end ("GNU.sparse.map"))
|
||||
if (!xheader_string_end (&file->stat_info->xhdr,
|
||||
"GNU.sparse.map"))
|
||||
{
|
||||
free (file->stat_info->file_name);
|
||||
file->stat_info->file_name = save_file_name;
|
||||
@@ -1014,6 +1017,7 @@ pax_dump_header_1 (struct tar_sparse_file *file)
|
||||
}
|
||||
size = (size + BLOCKSIZE - 1) / BLOCKSIZE;
|
||||
file->stat_info->archive_file_size += size * BLOCKSIZE;
|
||||
file->dumped_size += size * BLOCKSIZE;
|
||||
|
||||
/* Store sparse file identification */
|
||||
xheader_store ("GNU.sparse.major", file->stat_info, NULL);
|
||||
@@ -1104,7 +1108,8 @@ pax_decode_header (struct tar_sparse_file *file)
|
||||
if (src == endp) \
|
||||
{ \
|
||||
set_next_block_after (b); \
|
||||
b = find_next_block (); \
|
||||
file->dumped_size += BLOCKSIZE; \
|
||||
b = find_next_block (); \
|
||||
src = b->buffer; \
|
||||
endp = b->buffer + BLOCKSIZE; \
|
||||
} \
|
||||
@@ -1115,6 +1120,7 @@ pax_decode_header (struct tar_sparse_file *file)
|
||||
} while (0)
|
||||
|
||||
set_next_block_after (current_header);
|
||||
file->dumped_size += BLOCKSIZE;
|
||||
blk = find_next_block ();
|
||||
p = blk->buffer;
|
||||
COPY_BUF (blk,nbuf,p);
|
||||
|
||||
79
src/suffix.c
Normal file
79
src/suffix.c
Normal file
@@ -0,0 +1,79 @@
|
||||
/* This file is part of GNU tar.
|
||||
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
|
||||
Written by Sergey Poznyakoff.
|
||||
|
||||
GNU tar is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
GNU tar is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||
Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with GNU tar. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#include <system.h>
|
||||
#include "common.h"
|
||||
|
||||
struct compression_suffix
|
||||
{
|
||||
const char *suffix;
|
||||
size_t length;
|
||||
const char *program;
|
||||
};
|
||||
|
||||
struct compression_suffix compression_suffixes[] = {
|
||||
#define S(s,p) #s, sizeof (#s) - 1, #p
|
||||
{ S(gz, gzip) },
|
||||
{ S(tgz, gzip) },
|
||||
{ S(taz, gzip) },
|
||||
{ S(Z, compress) },
|
||||
{ S(taZ, compress) },
|
||||
{ S(bz2, bzip2) },
|
||||
{ S(tbz, bzip2) },
|
||||
{ S(tbz2, bzip2) },
|
||||
{ S(tz2, bzip2) },
|
||||
{ S(lzma, lzma) },
|
||||
{ S(tlz, lzma) },
|
||||
{ S(lzo, lzop) },
|
||||
#undef S
|
||||
};
|
||||
|
||||
int nsuffixes = sizeof (compression_suffixes) /
|
||||
sizeof (compression_suffixes[0]);
|
||||
|
||||
static const char *
|
||||
find_compression_program (const char *name, const char *defprog)
|
||||
{
|
||||
char *suf = strrchr (name, '.');
|
||||
|
||||
if (suf)
|
||||
{
|
||||
int i;
|
||||
size_t len;
|
||||
|
||||
suf++;
|
||||
len = strlen (suf);
|
||||
|
||||
for (i = 0; i < nsuffixes; i++)
|
||||
{
|
||||
if (compression_suffixes[i].length == len
|
||||
&& memcmp (compression_suffixes[i].suffix, suf, len) == 0)
|
||||
return compression_suffixes[i].program;
|
||||
}
|
||||
}
|
||||
return defprog;
|
||||
}
|
||||
|
||||
void
|
||||
set_comression_program_by_suffix (const char *name, const char *defprog)
|
||||
{
|
||||
const char *program = find_compression_program (name, defprog);
|
||||
if (program)
|
||||
use_compress_program_option = program;
|
||||
}
|
||||
|
||||
121
src/system.c
121
src/system.c
@@ -1,10 +1,11 @@
|
||||
/* System-dependent calls for tar.
|
||||
|
||||
Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2004, 2005, 2006, 2007,
|
||||
2008 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -17,8 +18,6 @@
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||
|
||||
#include <system.h>
|
||||
#include <getline.h>
|
||||
#include <setenv.h>
|
||||
|
||||
#include "common.h"
|
||||
#include <rmt.h>
|
||||
@@ -53,12 +52,7 @@ sys_detect_dev_null_output (void)
|
||||
}
|
||||
|
||||
void
|
||||
sys_drain_input_pipe (void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
sys_wait_for_child (pid_t child_pid)
|
||||
sys_wait_for_child (pid_t child_pid, bool eof)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -162,26 +156,8 @@ sys_detect_dev_null_output (void)
|
||||
&& archive_stat.st_ino == dev_null_stat.st_ino));
|
||||
}
|
||||
|
||||
/* Manage to fully drain a pipe we might be reading, so to not break it on
|
||||
the producer after the EOF block. FIXME: one of these days, GNU tar
|
||||
might become clever enough to just stop working, once there is no more
|
||||
work to do, we might have to revise this area in such time. */
|
||||
|
||||
void
|
||||
sys_drain_input_pipe (void)
|
||||
{
|
||||
size_t r;
|
||||
|
||||
if (access_mode == ACCESS_READ
|
||||
&& ! _isrmt (archive)
|
||||
&& (S_ISFIFO (archive_stat.st_mode) || S_ISSOCK (archive_stat.st_mode)))
|
||||
while ((r = rmtread (archive, record_start->buffer, record_size)) != 0
|
||||
&& r != SAFE_READ_ERROR)
|
||||
continue;
|
||||
}
|
||||
|
||||
void
|
||||
sys_wait_for_child (pid_t child_pid)
|
||||
sys_wait_for_child (pid_t child_pid, bool eof)
|
||||
{
|
||||
if (child_pid)
|
||||
{
|
||||
@@ -195,8 +171,11 @@ sys_wait_for_child (pid_t child_pid)
|
||||
}
|
||||
|
||||
if (WIFSIGNALED (wait_status))
|
||||
ERROR ((0, 0, _("Child died with signal %d"),
|
||||
WTERMSIG (wait_status)));
|
||||
{
|
||||
int sig = WTERMSIG (wait_status);
|
||||
if (!(!eof && sig == SIGPIPE))
|
||||
ERROR ((0, 0, _("Child died with signal %d"), sig));
|
||||
}
|
||||
else if (WEXITSTATUS (wait_status) != 0)
|
||||
ERROR ((0, 0, _("Child returned status %d"),
|
||||
WEXITSTATUS (wait_status)));
|
||||
@@ -697,7 +676,7 @@ stat_to_env (char *name, char type, struct tar_stat_info *st)
|
||||
}
|
||||
}
|
||||
|
||||
static pid_t pid;
|
||||
static pid_t global_pid;
|
||||
static RETSIGTYPE (*pipe_handler) (int sig);
|
||||
|
||||
int
|
||||
@@ -708,9 +687,9 @@ sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st)
|
||||
|
||||
xpipe (p);
|
||||
pipe_handler = signal (SIGPIPE, SIG_IGN);
|
||||
pid = xfork ();
|
||||
global_pid = xfork ();
|
||||
|
||||
if (pid != 0)
|
||||
if (global_pid != 0)
|
||||
{
|
||||
xclose (p[PREAD]);
|
||||
return p[PWRITE];
|
||||
@@ -737,14 +716,14 @@ sys_wait_command (void)
|
||||
{
|
||||
int status;
|
||||
|
||||
if (pid < 0)
|
||||
if (global_pid < 0)
|
||||
return;
|
||||
|
||||
signal (SIGPIPE, pipe_handler);
|
||||
while (waitpid (pid, &status, 0) == -1)
|
||||
while (waitpid (global_pid, &status, 0) == -1)
|
||||
if (errno != EINTR)
|
||||
{
|
||||
pid = -1;
|
||||
global_pid = -1;
|
||||
waitpid_error (to_command_option);
|
||||
return;
|
||||
}
|
||||
@@ -753,18 +732,18 @@ sys_wait_command (void)
|
||||
{
|
||||
if (!ignore_command_error_option && WEXITSTATUS (status))
|
||||
ERROR ((0, 0, _("%lu: Child returned status %d"),
|
||||
(unsigned long) pid, WEXITSTATUS (status)));
|
||||
(unsigned long) global_pid, WEXITSTATUS (status)));
|
||||
}
|
||||
else if (WIFSIGNALED (status))
|
||||
{
|
||||
WARN ((0, 0, _("%lu: Child terminated on signal %d"),
|
||||
(unsigned long) pid, WTERMSIG (status)));
|
||||
(unsigned long) global_pid, WTERMSIG (status)));
|
||||
}
|
||||
else
|
||||
ERROR ((0, 0, _("%lu: Child terminated on unknown reason"),
|
||||
(unsigned long) pid));
|
||||
(unsigned long) global_pid));
|
||||
|
||||
pid = -1;
|
||||
global_pid = -1;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -774,9 +753,10 @@ sys_exec_info_script (const char **archive_name, int volume_number)
|
||||
char *argv[4];
|
||||
char uintbuf[UINTMAX_STRSIZE_BOUND];
|
||||
int p[2];
|
||||
|
||||
static RETSIGTYPE (*saved_handler) (int sig);
|
||||
|
||||
xpipe (p);
|
||||
pipe_handler = signal (SIGPIPE, SIG_IGN);
|
||||
saved_handler = signal (SIGPIPE, SIG_IGN);
|
||||
|
||||
pid = xfork ();
|
||||
|
||||
@@ -786,7 +766,7 @@ sys_exec_info_script (const char **archive_name, int volume_number)
|
||||
|
||||
int rc;
|
||||
int status;
|
||||
char *buf;
|
||||
char *buf = NULL;
|
||||
size_t size = 0;
|
||||
FILE *fp;
|
||||
|
||||
@@ -801,10 +781,13 @@ sys_exec_info_script (const char **archive_name, int volume_number)
|
||||
while (waitpid (pid, &status, 0) == -1)
|
||||
if (errno != EINTR)
|
||||
{
|
||||
signal (SIGPIPE, saved_handler);
|
||||
waitpid_error (info_script_option);
|
||||
return -1;
|
||||
}
|
||||
|
||||
signal (SIGPIPE, saved_handler);
|
||||
|
||||
if (WIFEXITED (status))
|
||||
{
|
||||
if (WEXITSTATUS (status) == 0 && rc > 0)
|
||||
@@ -822,13 +805,15 @@ sys_exec_info_script (const char **archive_name, int volume_number)
|
||||
setenv ("TAR_VERSION", PACKAGE_VERSION, 1);
|
||||
setenv ("TAR_ARCHIVE", *archive_name, 1);
|
||||
setenv ("TAR_VOLUME", STRINGIFY_BIGINT (volume_number, uintbuf), 1);
|
||||
setenv ("TAR_BLOCKING_FACTOR",
|
||||
STRINGIFY_BIGINT (blocking_factor, uintbuf), 1);
|
||||
setenv ("TAR_SUBCOMMAND", subcommand_string (subcommand_option), 1);
|
||||
setenv ("TAR_FORMAT",
|
||||
archive_format_string (current_format == DEFAULT_FORMAT ?
|
||||
archive_format : current_format), 1);
|
||||
setenv ("TAR_FD", STRINGIFY_BIGINT (p[PWRITE], uintbuf), 1);
|
||||
|
||||
xclose (p[PREAD]);
|
||||
xdup2 (p[PWRITE], 3);
|
||||
|
||||
argv[0] = "/bin/sh";
|
||||
argv[1] = "-c";
|
||||
@@ -840,5 +825,51 @@ sys_exec_info_script (const char **archive_name, int volume_number)
|
||||
exec_fatal (info_script_option);
|
||||
}
|
||||
|
||||
void
|
||||
sys_exec_checkpoint_script (const char *script_name,
|
||||
const char *archive_name,
|
||||
int checkpoint_number)
|
||||
{
|
||||
pid_t pid;
|
||||
char *argv[4];
|
||||
char uintbuf[UINTMAX_STRSIZE_BOUND];
|
||||
|
||||
pid = xfork ();
|
||||
|
||||
if (pid != 0)
|
||||
{
|
||||
/* Master */
|
||||
|
||||
int status;
|
||||
|
||||
while (waitpid (pid, &status, 0) == -1)
|
||||
if (errno != EINTR)
|
||||
{
|
||||
waitpid_error (script_name);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Child */
|
||||
setenv ("TAR_VERSION", PACKAGE_VERSION, 1);
|
||||
setenv ("TAR_ARCHIVE", archive_name, 1);
|
||||
setenv ("TAR_CHECKPOINT", STRINGIFY_BIGINT (checkpoint_number, uintbuf), 1);
|
||||
setenv ("TAR_BLOCKING_FACTOR",
|
||||
STRINGIFY_BIGINT (blocking_factor, uintbuf), 1);
|
||||
setenv ("TAR_SUBCOMMAND", subcommand_string (subcommand_option), 1);
|
||||
setenv ("TAR_FORMAT",
|
||||
archive_format_string (current_format == DEFAULT_FORMAT ?
|
||||
archive_format : current_format), 1);
|
||||
argv[0] = "/bin/sh";
|
||||
argv[1] = "-c";
|
||||
argv[2] = (char*) script_name;
|
||||
argv[3] = NULL;
|
||||
|
||||
execv (argv[0], argv);
|
||||
|
||||
exec_fatal (script_name);
|
||||
}
|
||||
|
||||
#endif /* not MSDOS */
|
||||
|
||||
355
src/tar.c
355
src/tar.c
@@ -1,13 +1,13 @@
|
||||
/* A tar (tape archiver) program.
|
||||
|
||||
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000,
|
||||
2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
2001, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
Written by John Gilmore, starting 1985-08-25.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <system.h>
|
||||
|
||||
#include <fnmatch.h>
|
||||
#include <getline.h>
|
||||
#include <argp.h>
|
||||
#include <argp-namefrob.h>
|
||||
#include <argp-fmtstream.h>
|
||||
@@ -41,10 +40,11 @@
|
||||
|
||||
#include <argmatch.h>
|
||||
#include <closeout.h>
|
||||
#include <configmake.h>
|
||||
#include <exitfail.h>
|
||||
#include <getdate.h>
|
||||
#include <localedir.h>
|
||||
#include <rmt.h>
|
||||
#include <rmt-command.h>
|
||||
#include <prepargs.h>
|
||||
#include <quotearg.h>
|
||||
#include <version-etc.h>
|
||||
@@ -249,11 +249,20 @@ enum
|
||||
ANCHORED_OPTION = CHAR_MAX + 1,
|
||||
ATIME_PRESERVE_OPTION,
|
||||
BACKUP_OPTION,
|
||||
CHECK_DEVICE_OPTION,
|
||||
CHECKPOINT_OPTION,
|
||||
CHECKPOINT_ACTION_OPTION,
|
||||
DELAY_DIRECTORY_RESTORE_OPTION,
|
||||
HARD_DEREFERENCE_OPTION,
|
||||
DELETE_OPTION,
|
||||
EXCLUDE_CACHES_OPTION,
|
||||
EXCLUDE_CACHES_UNDER_OPTION,
|
||||
EXCLUDE_CACHES_ALL_OPTION,
|
||||
EXCLUDE_OPTION,
|
||||
EXCLUDE_TAG_OPTION,
|
||||
EXCLUDE_TAG_UNDER_OPTION,
|
||||
EXCLUDE_TAG_ALL_OPTION,
|
||||
EXCLUDE_VCS_OPTION,
|
||||
FORCE_LOCAL_OPTION,
|
||||
GROUP_OPTION,
|
||||
HANG_OPTION,
|
||||
@@ -262,13 +271,17 @@ enum
|
||||
IGNORE_FAILED_READ_OPTION,
|
||||
INDEX_FILE_OPTION,
|
||||
KEEP_NEWER_FILES_OPTION,
|
||||
LZOP_OPTION,
|
||||
MODE_OPTION,
|
||||
MTIME_OPTION,
|
||||
NEWER_MTIME_OPTION,
|
||||
NO_ANCHORED_OPTION,
|
||||
NO_AUTO_COMPRESS_OPTION,
|
||||
NO_CHECK_DEVICE_OPTION,
|
||||
NO_DELAY_DIRECTORY_RESTORE_OPTION,
|
||||
NO_IGNORE_CASE_OPTION,
|
||||
NO_IGNORE_COMMAND_ERROR_OPTION,
|
||||
NO_NULL_OPTION,
|
||||
NO_OVERWRITE_DIR_OPTION,
|
||||
NO_QUOTE_CHARS_OPTION,
|
||||
NO_RECURSION_OPTION,
|
||||
@@ -339,7 +352,7 @@ The version control may be set with --backup or VERSION_CONTROL, values are:\n\n
|
||||
|
||||
/* NOTE:
|
||||
|
||||
Available option letters are DEIJQY and aeqy. Consider the following
|
||||
Available option letters are DEIQY and eqy. Consider the following
|
||||
assignments:
|
||||
|
||||
[For Solaris tar compatibility =/= Is it important at all?]
|
||||
@@ -402,6 +415,12 @@ static struct argp_option options[] = {
|
||||
" NUMBER defaults to 1"), GRID+1 },
|
||||
{"seek", 'n', NULL, 0,
|
||||
N_("archive is seekable"), GRID+1 },
|
||||
{"no-check-device", NO_CHECK_DEVICE_OPTION, NULL, 0,
|
||||
N_("do not check device numbers when creating incremental archives"),
|
||||
GRID+1 },
|
||||
{"check-device", CHECK_DEVICE_OPTION, NULL, 0,
|
||||
N_("check device numbers when creating incremental archives (default)"),
|
||||
GRID+1 },
|
||||
#undef GRID
|
||||
|
||||
#define GRID 30
|
||||
@@ -568,20 +587,34 @@ static struct argp_option options[] = {
|
||||
N_("control pax keywords"), GRID+8 },
|
||||
{"label", 'V', N_("TEXT"), 0,
|
||||
N_("create archive with volume name TEXT; at list/extract time, use TEXT as a globbing pattern for volume name"), GRID+8 },
|
||||
{"bzip2", 'j', 0, 0,
|
||||
N_("filter the archive through bzip2"), GRID+8 },
|
||||
{"gzip", 'z', 0, 0,
|
||||
N_("filter the archive through gzip"), GRID+8 },
|
||||
{"gunzip", 0, 0, OPTION_ALIAS, NULL, GRID+8 },
|
||||
{"ungzip", 0, 0, OPTION_ALIAS, NULL, GRID+8 },
|
||||
{"compress", 'Z', 0, 0,
|
||||
N_("filter the archive through compress"), GRID+8 },
|
||||
{"uncompress", 0, 0, OPTION_ALIAS, NULL, GRID+8 },
|
||||
{"use-compress-program", USE_COMPRESS_PROGRAM_OPTION, N_("PROG"), 0,
|
||||
N_("filter through PROG (must accept -d)"), GRID+8 },
|
||||
#undef GRID
|
||||
|
||||
#define GRID 90
|
||||
{NULL, 0, NULL, 0,
|
||||
N_("Compression options:"), GRID },
|
||||
{"auto-compress", 'a', 0, 0,
|
||||
N_("use archive suffix to determine the compression program"), GRID+1 },
|
||||
{"no-auto-compress", NO_AUTO_COMPRESS_OPTION, 0, 0,
|
||||
N_("do not use use archive suffix to determine the compression program"),
|
||||
GRID+1 },
|
||||
{"bzip2", 'j', 0, 0,
|
||||
N_("filter the archive through bzip2"), GRID+1 },
|
||||
{"gzip", 'z', 0, 0,
|
||||
N_("filter the archive through gzip"), GRID+1 },
|
||||
{"gunzip", 0, 0, OPTION_ALIAS, NULL, GRID+1 },
|
||||
{"ungzip", 0, 0, OPTION_ALIAS, NULL, GRID+1 },
|
||||
{"compress", 'Z', 0, 0,
|
||||
N_("filter the archive through compress"), GRID+1 },
|
||||
{"uncompress", 0, 0, OPTION_ALIAS, NULL, GRID+1 },
|
||||
{"lzma", 'J', 0, 0,
|
||||
N_("filter the archive through lzma"), GRID+1 },
|
||||
{"lzop", LZOP_OPTION, 0, 0,
|
||||
N_("filter the archive through lzop"), GRID+8 },
|
||||
{"use-compress-program", USE_COMPRESS_PROGRAM_OPTION, N_("PROG"), 0,
|
||||
N_("filter through PROG (must accept -d)"), GRID+1 },
|
||||
#undef GRID
|
||||
|
||||
#define GRID 100
|
||||
{NULL, 0, NULL, 0,
|
||||
N_("Local file selection:"), GRID },
|
||||
|
||||
@@ -593,6 +626,8 @@ static struct argp_option options[] = {
|
||||
N_("get names to extract or create from FILE"), GRID+1 },
|
||||
{"null", NULL_OPTION, 0, 0,
|
||||
N_("-T reads null-terminated names, disable -C"), GRID+1 },
|
||||
{"no-null", NO_NULL_OPTION, 0, 0,
|
||||
N_("disable the effect of the previous --null option"), GRID+1 },
|
||||
{"unquote", UNQUOTE_OPTION, 0, 0,
|
||||
N_("unquote filenames read with -T (default)"), GRID+1 },
|
||||
{"no-unquote", NO_UNQUOTE_OPTION, 0, 0,
|
||||
@@ -602,7 +637,22 @@ static struct argp_option options[] = {
|
||||
{"exclude-from", 'X', N_("FILE"), 0,
|
||||
N_("exclude patterns listed in FILE"), GRID+1 },
|
||||
{"exclude-caches", EXCLUDE_CACHES_OPTION, 0, 0,
|
||||
N_("exclude directories containing a cache tag"), GRID+1 },
|
||||
N_("exclude contents of directories containing CACHEDIR.TAG, "
|
||||
"except for the tag file itself"), GRID+1 },
|
||||
{"exclude-caches-under", EXCLUDE_CACHES_UNDER_OPTION, 0, 0,
|
||||
N_("exclude everything under directories containing CACHEDIR.TAG"),
|
||||
GRID+1 },
|
||||
{"exclude-caches-all", EXCLUDE_CACHES_ALL_OPTION, 0, 0,
|
||||
N_("exclude directories containing CACHEDIR.TAG"), GRID+1 },
|
||||
{"exclude-tag", EXCLUDE_TAG_OPTION, N_("FILE"), 0,
|
||||
N_("exclude contents of directories containing FILE, except"
|
||||
" for FILE itself"), GRID+1 },
|
||||
{"exclude-tag-under", EXCLUDE_TAG_UNDER_OPTION, N_("FILE"), 0,
|
||||
N_("exclude everything under directories containing FILE"), GRID+1 },
|
||||
{"exclude-tag-all", EXCLUDE_TAG_ALL_OPTION, N_("FILE"), 0,
|
||||
N_("exclude directories containing FILE"), GRID+1 },
|
||||
{"exclude-vcs", EXCLUDE_VCS_OPTION, NULL, 0,
|
||||
N_("exclude version control system directories"), GRID+1 },
|
||||
{"no-recursion", NO_RECURSION_OPTION, 0, 0,
|
||||
N_("avoid descending automatically in directories"), GRID+1 },
|
||||
{"one-file-system", ONE_FILE_SYSTEM_OPTION, 0, 0,
|
||||
@@ -613,6 +663,8 @@ static struct argp_option options[] = {
|
||||
N_("don't strip leading `/'s from file names"), GRID+1 },
|
||||
{"dereference", 'h', 0, 0,
|
||||
N_("follow symlinks; archive and dump the files they point to"), GRID+1 },
|
||||
{"hard-dereference", HARD_DEREFERENCE_OPTION, 0, 0,
|
||||
N_("follow hard links; archive and dump the files they refer to"), GRID+1 },
|
||||
{"starting-file", 'K', N_("MEMBER-NAME"), 0,
|
||||
N_("begin at member MEMBER-NAME in the archive"), GRID+1 },
|
||||
{"newer", 'N', N_("DATE-OR-FILE"), 0,
|
||||
@@ -626,7 +678,7 @@ static struct argp_option options[] = {
|
||||
N_("backup before removal, override usual suffix ('~' unless overridden by environment variable SIMPLE_BACKUP_SUFFIX)"), GRID+1 },
|
||||
#undef GRID
|
||||
|
||||
#define GRID 92
|
||||
#define GRID 110
|
||||
{NULL, 0, NULL, 0,
|
||||
N_("File name transformations:"), GRID },
|
||||
{"strip-components", STRIP_COMPONENTS_OPTION, N_("NUMBER"), 0,
|
||||
@@ -634,9 +686,10 @@ static struct argp_option options[] = {
|
||||
GRID+1 },
|
||||
{"transform", TRANSFORM_OPTION, N_("EXPRESSION"), 0,
|
||||
N_("use sed replace EXPRESSION to transform file names"), GRID+1 },
|
||||
{"xform", 0, 0, OPTION_ALIAS, NULL, GRID+1 },
|
||||
#undef GRID
|
||||
|
||||
#define GRID 95
|
||||
#define GRID 120
|
||||
{NULL, 0, NULL, 0,
|
||||
N_("File name matching options (affect both exclude and include patterns):"),
|
||||
GRID },
|
||||
@@ -658,15 +711,18 @@ static struct argp_option options[] = {
|
||||
N_("wildcards match `/' (default for exclusion)"), GRID+1 },
|
||||
#undef GRID
|
||||
|
||||
#define GRID 100
|
||||
#define GRID 130
|
||||
{NULL, 0, NULL, 0,
|
||||
N_("Informative output:"), GRID },
|
||||
|
||||
{"verbose", 'v', 0, 0,
|
||||
N_("verbosely list files processed"), GRID+1 },
|
||||
{"checkpoint", CHECKPOINT_OPTION, N_("[.]NUMBER"), OPTION_ARG_OPTIONAL,
|
||||
{"checkpoint", CHECKPOINT_OPTION, N_("NUMBER"), OPTION_ARG_OPTIONAL,
|
||||
N_("display progress messages every NUMBERth record (default 10)"),
|
||||
GRID+1 },
|
||||
{"checkpoint-action", CHECKPOINT_ACTION_OPTION, N_("ACTION"), 0,
|
||||
N_("execute ACTION on each checkpoint"),
|
||||
GRID+1 },
|
||||
{"check-links", 'l', 0, 0,
|
||||
N_("print a message if not all links are dumped"), GRID+1 },
|
||||
{"totals", TOTALS_OPTION, N_("SIGNAL"), OPTION_ARG_OPTIONAL,
|
||||
@@ -699,7 +755,7 @@ static struct argp_option options[] = {
|
||||
N_("disable quoting for characters from STRING"), GRID+1 },
|
||||
#undef GRID
|
||||
|
||||
#define GRID 110
|
||||
#define GRID 140
|
||||
{NULL, 0, NULL, 0,
|
||||
N_("Compatibility options:"), GRID },
|
||||
|
||||
@@ -707,7 +763,7 @@ static struct argp_option options[] = {
|
||||
N_("when creating, same as --old-archive; when extracting, same as --no-same-owner"), GRID+1 },
|
||||
#undef GRID
|
||||
|
||||
#define GRID 120
|
||||
#define GRID 150
|
||||
{NULL, 0, NULL, 0,
|
||||
N_("Other options:"), GRID },
|
||||
|
||||
@@ -764,8 +820,11 @@ struct tar_args /* Variables used during option parsing */
|
||||
char const *backup_suffix_string; /* --suffix option argument */
|
||||
char const *version_control_string; /* --backup option argument */
|
||||
bool input_files; /* True if some input files where given */
|
||||
int compress_autodetect; /* True if compression autodetection should
|
||||
be attempted when creating archives */
|
||||
};
|
||||
|
||||
|
||||
#define MAKE_EXCL_OPTIONS(args) \
|
||||
((((args)->wildcards != disable_wildcards) ? EXCLUDE_WILDCARDS : 0) \
|
||||
| (args)->matching_flags \
|
||||
@@ -777,6 +836,47 @@ struct tar_args /* Variables used during option parsing */
|
||||
| (args)->matching_flags \
|
||||
| recursion_option)
|
||||
|
||||
void
|
||||
exclude_vcs_files ()
|
||||
{
|
||||
int i;
|
||||
static char *vcs_file[] = {
|
||||
/* CVS: */
|
||||
"CVS",
|
||||
".cvsignore",
|
||||
/* RCS: */
|
||||
"RCS",
|
||||
/* SCCS: */
|
||||
"SCCS",
|
||||
/* SVN: */
|
||||
".svn",
|
||||
/* git: */
|
||||
".git",
|
||||
".gitignore",
|
||||
/* Arch: */
|
||||
".arch-ids",
|
||||
"{arch}",
|
||||
"=RELEASE-ID",
|
||||
"=meta-update",
|
||||
"=update",
|
||||
/* Bazaar */
|
||||
".bzr",
|
||||
".bzrignore",
|
||||
".bzrtags",
|
||||
/* Mercurial */
|
||||
".hg",
|
||||
".hgignore",
|
||||
".hgtags",
|
||||
/* darcs */
|
||||
"_darcs",
|
||||
NULL
|
||||
};
|
||||
|
||||
for (i = 0; vcs_file[i]; i++)
|
||||
add_exclude (excluded, vcs_file[i], 0);
|
||||
}
|
||||
|
||||
|
||||
#ifdef REMOTE_SHELL
|
||||
# define DECL_SHOW_DEFAULT_SETTINGS(stream, printer) \
|
||||
{ \
|
||||
@@ -949,35 +1049,41 @@ report_textual_dates (struct tar_args *args)
|
||||
|
||||
static volatile int _argp_hang;
|
||||
|
||||
/* Either NL or NUL, as decided by the --null option. */
|
||||
static char filename_terminator;
|
||||
|
||||
enum read_file_list_state /* Result of reading file name from the list file */
|
||||
{
|
||||
file_list_success, /* OK, name read successfully */
|
||||
file_list_end, /* End of list file */
|
||||
file_list_zero /* Zero separator encountered where it should not */
|
||||
file_list_zero, /* Zero separator encountered where it should not */
|
||||
file_list_skip /* Empty (zero-length) entry encountered, skip it */
|
||||
};
|
||||
|
||||
/* Read from FP a sequence of characters up to FILENAME_TERMINATOR and put them
|
||||
/* Read from FP a sequence of characters up to TERM and put them
|
||||
into STK.
|
||||
*/
|
||||
static enum read_file_list_state
|
||||
read_name_from_file (FILE *fp, struct obstack *stk)
|
||||
read_name_from_file (FILE *fp, struct obstack *stk, int term)
|
||||
{
|
||||
int c;
|
||||
size_t counter = 0;
|
||||
|
||||
for (c = getc (fp); c != EOF && c != filename_terminator; c = getc (fp))
|
||||
for (c = getc (fp); c != EOF && c != term; c = getc (fp))
|
||||
{
|
||||
if (c == 0)
|
||||
{
|
||||
/* We have read a zero separator. The file possibly is
|
||||
zero-separated */
|
||||
/* FATAL_ERROR((0, 0, N_("file name contains null character"))); */
|
||||
return file_list_zero;
|
||||
}
|
||||
obstack_1grow (stk, c);
|
||||
counter++;
|
||||
}
|
||||
|
||||
if (counter == 0 && c != EOF)
|
||||
return file_list_skip;
|
||||
|
||||
obstack_1grow (stk, 0);
|
||||
|
||||
return (counter == 0 && c == EOF) ? file_list_end : file_list_success;
|
||||
@@ -1044,7 +1150,8 @@ update_argv (const char *filename, struct argp_state *state)
|
||||
size_t new_argc;
|
||||
bool is_stdin = false;
|
||||
enum read_file_list_state read_state;
|
||||
|
||||
int term = filename_terminator;
|
||||
|
||||
if (!strcmp (filename, "-"))
|
||||
{
|
||||
is_stdin = true;
|
||||
@@ -1058,31 +1165,43 @@ update_argv (const char *filename, struct argp_state *state)
|
||||
open_fatal (filename);
|
||||
}
|
||||
|
||||
while ((read_state = read_name_from_file (fp, &argv_stk)) == file_list_success)
|
||||
count++;
|
||||
|
||||
if (read_state == file_list_zero)
|
||||
while ((read_state = read_name_from_file (fp, &argv_stk, term))
|
||||
!= file_list_end)
|
||||
{
|
||||
size_t size;
|
||||
switch (read_state)
|
||||
{
|
||||
case file_list_success:
|
||||
count++;
|
||||
break;
|
||||
|
||||
WARN ((0, 0, N_("%s: file name read contains nul character"),
|
||||
quotearg_colon (filename)));
|
||||
case file_list_end: /* won't happen, just to pacify gcc */
|
||||
break;
|
||||
|
||||
/* Prepare new stack contents */
|
||||
size = obstack_object_size (&argv_stk);
|
||||
p = obstack_finish (&argv_stk);
|
||||
for (; size > 0; size--, p++)
|
||||
if (*p)
|
||||
obstack_1grow (&argv_stk, *p);
|
||||
else
|
||||
obstack_1grow (&argv_stk, '\n');
|
||||
obstack_1grow (&argv_stk, 0);
|
||||
count = 1;
|
||||
case file_list_zero:
|
||||
{
|
||||
size_t size;
|
||||
|
||||
/* Read rest of files using new filename terminator */
|
||||
filename_terminator = 0;
|
||||
while (read_name_from_file (fp, &argv_stk) == file_list_success)
|
||||
count++;
|
||||
WARN ((0, 0, N_("%s: file name read contains nul character"),
|
||||
quotearg_colon (filename)));
|
||||
|
||||
/* Prepare new stack contents */
|
||||
size = obstack_object_size (&argv_stk);
|
||||
p = obstack_finish (&argv_stk);
|
||||
for (; size > 0; size--, p++)
|
||||
if (*p)
|
||||
obstack_1grow (&argv_stk, *p);
|
||||
else
|
||||
obstack_1grow (&argv_stk, '\n');
|
||||
obstack_1grow (&argv_stk, 0);
|
||||
count = 1;
|
||||
/* Read rest of files using new filename terminator */
|
||||
term = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
case file_list_skip:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_stdin)
|
||||
@@ -1093,7 +1212,7 @@ update_argv (const char *filename, struct argp_state *state)
|
||||
|
||||
start = obstack_finish (&argv_stk);
|
||||
|
||||
if (filename_terminator == 0)
|
||||
if (term == 0)
|
||||
for (p = start; *p; p += strlen (p) + 1)
|
||||
if (p[0] == '-')
|
||||
count++;
|
||||
@@ -1109,7 +1228,7 @@ update_argv (const char *filename, struct argp_state *state)
|
||||
|
||||
for (i = state->next, p = start; *p; p += strlen (p) + 1, i++)
|
||||
{
|
||||
if (filename_terminator == 0 && p[0] == '-')
|
||||
if (term == 0 && p[0] == '-')
|
||||
state->argv[i++] = "--add-file";
|
||||
state->argv[i] = p;
|
||||
}
|
||||
@@ -1145,16 +1264,24 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case ARGP_KEY_ARG:
|
||||
/* File name or non-parsed option, because of ARGP_IN_ORDER */
|
||||
name_add_name (arg, MAKE_INCL_OPTIONS (args));
|
||||
args->input_files = true;
|
||||
break;
|
||||
case ARGP_KEY_ARG:
|
||||
/* File name or non-parsed option, because of ARGP_IN_ORDER */
|
||||
name_add_name (arg, MAKE_INCL_OPTIONS (args));
|
||||
args->input_files = true;
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
set_subcommand_option (CAT_SUBCOMMAND);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
args->compress_autodetect = true;
|
||||
break;
|
||||
|
||||
case NO_AUTO_COMPRESS_OPTION:
|
||||
args->compress_autodetect = false;
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
{
|
||||
uintmax_t u;
|
||||
@@ -1225,6 +1352,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
dereference_option = true;
|
||||
break;
|
||||
|
||||
case HARD_DEREFERENCE_OPTION:
|
||||
hard_dereference_option = true;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
/* Ignore zero blocks (eofs). This can't be the default,
|
||||
because Unix tar writes two blocks of zeros, then pads out
|
||||
@@ -1243,6 +1374,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
set_use_compress_program_option ("bzip2");
|
||||
break;
|
||||
|
||||
case 'J':
|
||||
set_use_compress_program_option ("lzma");
|
||||
break;
|
||||
|
||||
case 'k':
|
||||
/* Don't replace existing files. */
|
||||
old_files_option = KEEP_OLD_FILES;
|
||||
@@ -1274,6 +1409,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
}
|
||||
break;
|
||||
|
||||
case LZOP_OPTION:
|
||||
set_use_compress_program_option ("lzop");
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
touch_option = true;
|
||||
break;
|
||||
@@ -1447,6 +1586,14 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
" on this platform")));
|
||||
break;
|
||||
|
||||
case CHECK_DEVICE_OPTION:
|
||||
check_device_option = true;
|
||||
break;
|
||||
|
||||
case NO_CHECK_DEVICE_OPTION:
|
||||
check_device_option = false;
|
||||
break;
|
||||
|
||||
case CHECKPOINT_OPTION:
|
||||
if (arg)
|
||||
{
|
||||
@@ -1454,7 +1601,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
|
||||
if (*arg == '.')
|
||||
{
|
||||
checkpoint_style = checkpoint_dot;
|
||||
checkpoint_compile_action (".");
|
||||
arg++;
|
||||
}
|
||||
checkpoint_option = strtoul (arg, &p, 0);
|
||||
@@ -1463,9 +1610,13 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
_("--checkpoint value is not an integer")));
|
||||
}
|
||||
else
|
||||
checkpoint_option = 10;
|
||||
checkpoint_option = DEFAULT_CHECKPOINT;
|
||||
break;
|
||||
|
||||
case CHECKPOINT_ACTION_OPTION:
|
||||
checkpoint_compile_action (arg);
|
||||
break;
|
||||
|
||||
case BACKUP_OPTION:
|
||||
backup_option = true;
|
||||
if (arg)
|
||||
@@ -1489,9 +1640,36 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
break;
|
||||
|
||||
case EXCLUDE_CACHES_OPTION:
|
||||
exclude_caches_option = true;
|
||||
add_exclusion_tag ("CACHEDIR.TAG", exclusion_tag_contents,
|
||||
cachedir_file_p);
|
||||
break;
|
||||
|
||||
case EXCLUDE_CACHES_UNDER_OPTION:
|
||||
add_exclusion_tag ("CACHEDIR.TAG", exclusion_tag_under,
|
||||
cachedir_file_p);
|
||||
break;
|
||||
|
||||
case EXCLUDE_CACHES_ALL_OPTION:
|
||||
add_exclusion_tag ("CACHEDIR.TAG", exclusion_tag_all,
|
||||
cachedir_file_p);
|
||||
break;
|
||||
|
||||
case EXCLUDE_TAG_OPTION:
|
||||
add_exclusion_tag (arg, exclusion_tag_contents, NULL);
|
||||
break;
|
||||
|
||||
case EXCLUDE_TAG_UNDER_OPTION:
|
||||
add_exclusion_tag (arg, exclusion_tag_under, NULL);
|
||||
break;
|
||||
|
||||
case EXCLUDE_TAG_ALL_OPTION:
|
||||
add_exclusion_tag (arg, exclusion_tag_all, NULL);
|
||||
break;
|
||||
|
||||
case EXCLUDE_VCS_OPTION:
|
||||
exclude_vcs_files ();
|
||||
break;
|
||||
|
||||
case FORCE_LOCAL_OPTION:
|
||||
force_local_option = true;
|
||||
break;
|
||||
@@ -1576,6 +1754,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
filename_terminator = '\0';
|
||||
break;
|
||||
|
||||
case NO_NULL_OPTION:
|
||||
filename_terminator = '\n';
|
||||
break;
|
||||
|
||||
case NUMERIC_OWNER_OPTION:
|
||||
numeric_owner_option = true;
|
||||
break;
|
||||
@@ -1638,6 +1820,8 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||
/* FIXME: What it is good for? */
|
||||
same_permissions_option = true;
|
||||
same_order_option = true;
|
||||
WARN ((0, 0, _("The --preserve option is deprecated, "
|
||||
"use --preserve-permissions --preserve-order instead")));
|
||||
break;
|
||||
|
||||
case RECORD_SIZE_OPTION:
|
||||
@@ -1878,23 +2062,23 @@ usage (int status)
|
||||
/* Parse the options for tar. */
|
||||
|
||||
static struct argp_option *
|
||||
find_argp_option (struct argp_option *options, int letter)
|
||||
find_argp_option (struct argp_option *o, int letter)
|
||||
{
|
||||
for (;
|
||||
!(options->name == NULL
|
||||
&& options->key == 0
|
||||
&& options->arg == 0
|
||||
&& options->flags == 0
|
||||
&& options->doc == NULL); options++)
|
||||
if (options->key == letter)
|
||||
return options;
|
||||
!(o->name == NULL
|
||||
&& o->key == 0
|
||||
&& o->arg == 0
|
||||
&& o->flags == 0
|
||||
&& o->doc == NULL); o++)
|
||||
if (o->key == letter)
|
||||
return o;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
decode_options (int argc, char **argv)
|
||||
{
|
||||
int index;
|
||||
int idx;
|
||||
struct tar_args args;
|
||||
|
||||
/* Set some default option values. */
|
||||
@@ -1907,7 +2091,8 @@ decode_options (int argc, char **argv)
|
||||
args.backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
|
||||
args.version_control_string = 0;
|
||||
args.input_files = false;
|
||||
|
||||
args.compress_autodetect = false;
|
||||
|
||||
subcommand_option = UNKNOWN_SUBCOMMAND;
|
||||
archive_format = DEFAULT_FORMAT;
|
||||
blocking_factor = DEFAULT_BLOCKING;
|
||||
@@ -1923,6 +2108,8 @@ decode_options (int argc, char **argv)
|
||||
owner_option = -1;
|
||||
group_option = -1;
|
||||
|
||||
check_device_option = true;
|
||||
|
||||
/* Convert old-style tar call by exploding option element and rearranging
|
||||
options accordingly. */
|
||||
|
||||
@@ -1985,7 +2172,7 @@ decode_options (int argc, char **argv)
|
||||
prepend_default_options (getenv ("TAR_OPTIONS"), &argc, &argv);
|
||||
|
||||
if (argp_parse (&argp, argc, argv, ARGP_IN_ORDER|ARGP_NO_HELP,
|
||||
&index, &args))
|
||||
&idx, &args))
|
||||
exit (TAREXIT_FAILURE);
|
||||
|
||||
|
||||
@@ -2013,9 +2200,9 @@ decode_options (int argc, char **argv)
|
||||
}
|
||||
|
||||
/* Handle operands after any "--" argument. */
|
||||
for (; index < argc; index++)
|
||||
for (; idx < argc; idx++)
|
||||
{
|
||||
name_add_name (argv[index], MAKE_INCL_OPTIONS (&args));
|
||||
name_add_name (argv[idx], MAKE_INCL_OPTIONS (&args));
|
||||
args.input_files = true;
|
||||
}
|
||||
|
||||
@@ -2159,6 +2346,13 @@ decode_options (int argc, char **argv)
|
||||
else if (utc_option)
|
||||
verbose_option = 2;
|
||||
|
||||
if (tape_length_option && tape_length_option < record_size)
|
||||
USAGE_ERROR ((0, 0, _("Volume length cannot be less than record size")));
|
||||
|
||||
if (same_order_option && listed_incremental_option)
|
||||
USAGE_ERROR ((0, 0, _("--preserve-order is not compatible with "
|
||||
"--listed-incremental")));
|
||||
|
||||
/* Forbid using -c with no input files whatsoever. Check that `-f -',
|
||||
explicit or implied, is used correctly. */
|
||||
|
||||
@@ -2168,6 +2362,10 @@ decode_options (int argc, char **argv)
|
||||
if (!args.input_files && !files_from_option)
|
||||
USAGE_ERROR ((0, 0,
|
||||
_("Cowardly refusing to create an empty archive")));
|
||||
if (args.compress_autodetect && archive_names
|
||||
&& strcmp (archive_name_array[0], "-"))
|
||||
set_comression_program_by_suffix (archive_name_array[0],
|
||||
use_compress_program_option);
|
||||
break;
|
||||
|
||||
case EXTRACT_SUBCOMMAND:
|
||||
@@ -2220,6 +2418,8 @@ decode_options (int argc, char **argv)
|
||||
backup_option = false;
|
||||
}
|
||||
|
||||
checkpoint_finish_compile ();
|
||||
|
||||
if (verbose_option)
|
||||
report_textual_dates (&args);
|
||||
}
|
||||
@@ -2246,9 +2446,6 @@ main (int argc, char **argv)
|
||||
/* Make sure we have first three descriptors available */
|
||||
stdopen ();
|
||||
|
||||
/* Close all inherited open descriptors, except for the first three */
|
||||
closeopen ();
|
||||
|
||||
/* Pre-allocate a few structures. */
|
||||
|
||||
allocated_archive_names = 10;
|
||||
@@ -2266,6 +2463,7 @@ main (int argc, char **argv)
|
||||
/* Decode options. */
|
||||
|
||||
decode_options (argc, argv);
|
||||
|
||||
name_init ();
|
||||
|
||||
/* Main command execution. */
|
||||
@@ -2328,11 +2526,11 @@ main (int argc, char **argv)
|
||||
name_term ();
|
||||
|
||||
if (exit_status == TAREXIT_FAILURE)
|
||||
error (0, 0, _("Error exit delayed from previous errors"));
|
||||
error (0, 0, _("Exiting with failure status due to previous errors"));
|
||||
|
||||
if (stdlis == stdout)
|
||||
close_stdout ();
|
||||
else if (ferror (stderr) || fclose (stderr) != 0)
|
||||
else if (ferror (stderr) || fclose (stderr) != 0)
|
||||
exit_status = TAREXIT_FAILURE;
|
||||
|
||||
return exit_status;
|
||||
@@ -2354,6 +2552,7 @@ tar_stat_destroy (struct tar_stat_info *st)
|
||||
free (st->gname);
|
||||
free (st->sparse_map);
|
||||
free (st->dumpdir);
|
||||
xheader_destroy (&st->xhdr);
|
||||
memset (st, 0, sizeof (*st));
|
||||
}
|
||||
|
||||
|
||||
21
src/tar.h
21
src/tar.h
@@ -1,11 +1,11 @@
|
||||
/* GNU tar Archive Format description.
|
||||
|
||||
Copyright (C) 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
|
||||
2000, 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -165,6 +165,7 @@ struct oldgnu_header
|
||||
'A' Solaris Access Control List
|
||||
'E' Solaris Extended Attribute File
|
||||
'I' Inode only, as in 'star'
|
||||
'N' Obsolete GNU tar, for file names that do not fit into the main header.
|
||||
'X' POSIX 1003.1-2001 eXtended (VU version) */
|
||||
|
||||
/* This is a dir entry that contains the names of files that were in the
|
||||
@@ -180,9 +181,6 @@ struct oldgnu_header
|
||||
/* This is the continuation of a file that began on another volume. */
|
||||
#define GNUTYPE_MULTIVOL 'M'
|
||||
|
||||
/* For storing filenames that do not fit into the main header. */
|
||||
#define GNUTYPE_NAMES 'N'
|
||||
|
||||
/* This is for sparse files. */
|
||||
#define GNUTYPE_SPARSE 'S'
|
||||
|
||||
@@ -270,6 +268,14 @@ struct sp_array
|
||||
size_t numbytes;
|
||||
};
|
||||
|
||||
struct xheader
|
||||
{
|
||||
struct obstack *stk;
|
||||
size_t size;
|
||||
char *buffer;
|
||||
uintmax_t string_length;
|
||||
};
|
||||
|
||||
struct tar_stat_info
|
||||
{
|
||||
char *orig_file_name; /* name of file read from the archive header */
|
||||
@@ -303,6 +309,9 @@ struct tar_stat_info
|
||||
size_t sparse_map_size; /* Size of the sparse map */
|
||||
struct sp_array *sparse_map;
|
||||
|
||||
/* Extended headers */
|
||||
struct xheader xhdr;
|
||||
|
||||
/* For dumpdirs */
|
||||
bool is_dumpdir; /* Is the member a dumpdir? */
|
||||
bool skipped; /* The member contents is already read
|
||||
@@ -320,5 +329,3 @@ union block
|
||||
struct star_in_header star_in_header;
|
||||
struct star_ext_header star_ext_header;
|
||||
};
|
||||
|
||||
|
||||
|
||||
284
src/transform.c
284
src/transform.c
@@ -1,9 +1,9 @@
|
||||
/* This file is part of GNU tar.
|
||||
Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -19,16 +19,11 @@
|
||||
#include <regex.h>
|
||||
#include "common.h"
|
||||
|
||||
static enum transform_type
|
||||
enum transform_type
|
||||
{
|
||||
transform_none,
|
||||
transform_first,
|
||||
transform_global
|
||||
}
|
||||
transform_type = transform_none;
|
||||
static unsigned match_number = 0;
|
||||
static regex_t regex;
|
||||
static struct obstack stk;
|
||||
};
|
||||
|
||||
enum replace_segm_type
|
||||
{
|
||||
@@ -62,31 +57,56 @@ struct replace_segm
|
||||
} v;
|
||||
};
|
||||
|
||||
/* Compiled replacement expression */
|
||||
static struct replace_segm *repl_head, *repl_tail;
|
||||
static size_t segm_count; /* Number of elements in the above list */
|
||||
struct transform
|
||||
{
|
||||
struct transform *next;
|
||||
enum transform_type transform_type;
|
||||
int flags;
|
||||
unsigned match_number;
|
||||
regex_t regex;
|
||||
/* Compiled replacement expression */
|
||||
struct replace_segm *repl_head, *repl_tail;
|
||||
size_t segm_count; /* Number of elements in the above list */
|
||||
};
|
||||
|
||||
|
||||
|
||||
int transform_flags = XFORM_ALL;
|
||||
static struct transform *transform_head, *transform_tail;
|
||||
|
||||
static struct transform *
|
||||
new_transform ()
|
||||
{
|
||||
struct transform *p = xzalloc (sizeof *p);
|
||||
if (transform_tail)
|
||||
transform_tail->next = p;
|
||||
else
|
||||
transform_head = p;
|
||||
transform_tail = p;
|
||||
return p;
|
||||
}
|
||||
|
||||
static struct replace_segm *
|
||||
add_segment (void)
|
||||
add_segment (struct transform *tf)
|
||||
{
|
||||
struct replace_segm *segm = xmalloc (sizeof *segm);
|
||||
segm->next = NULL;
|
||||
if (repl_tail)
|
||||
repl_tail->next = segm;
|
||||
if (tf->repl_tail)
|
||||
tf->repl_tail->next = segm;
|
||||
else
|
||||
repl_head = segm;
|
||||
repl_tail = segm;
|
||||
segm_count++;
|
||||
tf->repl_head = segm;
|
||||
tf->repl_tail = segm;
|
||||
tf->segm_count++;
|
||||
return segm;
|
||||
}
|
||||
|
||||
static void
|
||||
add_literal_segment (char *str, char *end)
|
||||
add_literal_segment (struct transform *tf, char *str, char *end)
|
||||
{
|
||||
size_t len = end - str;
|
||||
if (len)
|
||||
{
|
||||
struct replace_segm *segm = add_segment ();
|
||||
struct replace_segm *segm = add_segment (tf);
|
||||
segm->type = segm_literal;
|
||||
segm->v.literal.ptr = xmalloc (len + 1);
|
||||
memcpy (segm->v.literal.ptr, str, len);
|
||||
@@ -96,9 +116,9 @@ add_literal_segment (char *str, char *end)
|
||||
}
|
||||
|
||||
static void
|
||||
add_char_segment (int chr)
|
||||
add_char_segment (struct transform *tf, int chr)
|
||||
{
|
||||
struct replace_segm *segm = add_segment ();
|
||||
struct replace_segm *segm = add_segment (tf);
|
||||
segm->type = segm_literal;
|
||||
segm->v.literal.ptr = xmalloc (2);
|
||||
segm->v.literal.ptr[0] = chr;
|
||||
@@ -107,41 +127,87 @@ add_char_segment (int chr)
|
||||
}
|
||||
|
||||
static void
|
||||
add_backref_segment (size_t ref)
|
||||
add_backref_segment (struct transform *tf, size_t ref)
|
||||
{
|
||||
struct replace_segm *segm = add_segment ();
|
||||
struct replace_segm *segm = add_segment (tf);
|
||||
segm->type = segm_backref;
|
||||
segm->v.ref = ref;
|
||||
}
|
||||
|
||||
static void
|
||||
add_case_ctl_segment (enum case_ctl_type ctl)
|
||||
static int
|
||||
parse_xform_flags (int *pflags, int c)
|
||||
{
|
||||
struct replace_segm *segm = add_segment ();
|
||||
switch (c)
|
||||
{
|
||||
case 'r':
|
||||
*pflags |= XFORM_REGFILE;
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
*pflags &= ~XFORM_REGFILE;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
*pflags |= XFORM_LINK;
|
||||
break;
|
||||
|
||||
case 'H':
|
||||
*pflags &= ~XFORM_LINK;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
*pflags |= XFORM_SYMLINK;
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
*pflags &= ~XFORM_SYMLINK;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
add_case_ctl_segment (struct transform *tf, enum case_ctl_type ctl)
|
||||
{
|
||||
struct replace_segm *segm = add_segment (tf);
|
||||
segm->type = segm_case_ctl;
|
||||
segm->v.ctl = ctl;
|
||||
}
|
||||
|
||||
void
|
||||
set_transform_expr (const char *expr)
|
||||
static const char *
|
||||
parse_transform_expr (const char *expr)
|
||||
{
|
||||
int delim;
|
||||
int i, j, rc;
|
||||
char *str, *beg, *cur;
|
||||
const char *p;
|
||||
int cflags = 0;
|
||||
|
||||
if (transform_type == transform_none)
|
||||
obstack_init (&stk);
|
||||
else
|
||||
{
|
||||
/* Redefinition of the transform expression */
|
||||
regfree (®ex);
|
||||
}
|
||||
struct transform *tf = new_transform ();
|
||||
|
||||
if (expr[0] != 's')
|
||||
USAGE_ERROR ((0, 0, _("Invalid transform expression")));
|
||||
|
||||
{
|
||||
if (strncmp (expr, "flags=", 6) == 0)
|
||||
{
|
||||
transform_flags = 0;
|
||||
for (expr += 6; *expr; expr++)
|
||||
{
|
||||
if (*expr == ';')
|
||||
{
|
||||
expr++;
|
||||
break;
|
||||
}
|
||||
if (parse_xform_flags (&transform_flags, *expr))
|
||||
USAGE_ERROR ((0, 0, _("Unknown transform flag: %c"),
|
||||
*expr));
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
USAGE_ERROR ((0, 0, _("Invalid transform expression")));
|
||||
}
|
||||
|
||||
delim = expr[1];
|
||||
|
||||
/* Scan regular expression */
|
||||
@@ -161,12 +227,13 @@ set_transform_expr (const char *expr)
|
||||
USAGE_ERROR ((0, 0, _("Invalid transform expression")));
|
||||
|
||||
/* Check flags */
|
||||
transform_type = transform_first;
|
||||
for (p = expr + j + 1; *p; p++)
|
||||
tf->transform_type = transform_first;
|
||||
tf->flags = transform_flags;
|
||||
for (p = expr + j + 1; *p && *p != ';'; p++)
|
||||
switch (*p)
|
||||
{
|
||||
case 'g':
|
||||
transform_type = transform_global;
|
||||
tf->transform_type = transform_global;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
@@ -176,33 +243,38 @@ set_transform_expr (const char *expr)
|
||||
case 'x':
|
||||
cflags |= REG_EXTENDED;
|
||||
break;
|
||||
|
||||
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
match_number = strtoul (p, (char**) &p, 0);
|
||||
tf->match_number = strtoul (p, (char**) &p, 0);
|
||||
p--;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
USAGE_ERROR ((0, 0, _("Unknown flag in transform expression")));
|
||||
if (parse_xform_flags (&tf->flags, *p))
|
||||
USAGE_ERROR ((0, 0, _("Unknown flag in transform expression: %c"),
|
||||
*p));
|
||||
}
|
||||
|
||||
if (*p == ';')
|
||||
p++;
|
||||
|
||||
/* Extract and compile regex */
|
||||
str = xmalloc (i - 1);
|
||||
memcpy (str, expr + 2, i - 2);
|
||||
str[i - 2] = 0;
|
||||
|
||||
rc = regcomp (®ex, str, cflags);
|
||||
rc = regcomp (&tf->regex, str, cflags);
|
||||
|
||||
if (rc)
|
||||
{
|
||||
char errbuf[512];
|
||||
regerror (rc, ®ex, errbuf, sizeof (errbuf));
|
||||
regerror (rc, &tf->regex, errbuf, sizeof (errbuf));
|
||||
USAGE_ERROR ((0, 0, _("Invalid transform expression: %s"), errbuf));
|
||||
}
|
||||
|
||||
if (str[0] == '^' || str[strlen (str) - 1] == '$')
|
||||
transform_type = transform_first;
|
||||
tf->transform_type = transform_first;
|
||||
|
||||
free (str);
|
||||
|
||||
@@ -218,91 +290,91 @@ set_transform_expr (const char *expr)
|
||||
{
|
||||
size_t n;
|
||||
|
||||
add_literal_segment (beg, cur);
|
||||
add_literal_segment (tf, beg, cur);
|
||||
switch (*++cur)
|
||||
{
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
n = strtoul (cur, &cur, 10);
|
||||
if (n > regex.re_nsub)
|
||||
if (n > tf->regex.re_nsub)
|
||||
USAGE_ERROR ((0, 0, _("Invalid transform replacement: back reference out of range")));
|
||||
add_backref_segment (n);
|
||||
add_backref_segment (tf, n);
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
add_char_segment ('\\');
|
||||
add_char_segment (tf, '\\');
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
add_char_segment ('\a');
|
||||
add_char_segment (tf, '\a');
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
add_char_segment ('\b');
|
||||
add_char_segment (tf, '\b');
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
add_char_segment ('\f');
|
||||
add_char_segment (tf, '\f');
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
add_char_segment ('\n');
|
||||
add_char_segment (tf, '\n');
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
add_char_segment ('\r');
|
||||
add_char_segment (tf, '\r');
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
add_char_segment ('\t');
|
||||
add_char_segment (tf, '\t');
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
add_char_segment ('\v');
|
||||
add_char_segment (tf, '\v');
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case '&':
|
||||
add_char_segment ('&');
|
||||
add_char_segment (tf, '&');
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
/* Turn the replacement to lowercase until a `\U' or `\E'
|
||||
is found, */
|
||||
add_case_ctl_segment (ctl_locase);
|
||||
add_case_ctl_segment (tf, ctl_locase);
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
/* Turn the next character to lowercase, */
|
||||
add_case_ctl_segment (ctl_locase_next);
|
||||
add_case_ctl_segment (tf, ctl_locase_next);
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
/* Turn the replacement to uppercase until a `\L' or `\E'
|
||||
is found, */
|
||||
add_case_ctl_segment (ctl_upcase);
|
||||
add_case_ctl_segment (tf, ctl_upcase);
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case 'u':
|
||||
/* Turn the next character to uppercase, */
|
||||
add_case_ctl_segment (ctl_upcase_next);
|
||||
add_case_ctl_segment (tf, ctl_upcase_next);
|
||||
cur++;
|
||||
break;
|
||||
|
||||
case 'E':
|
||||
/* Stop case conversion started by `\L' or `\U'. */
|
||||
add_case_ctl_segment (ctl_stop);
|
||||
add_case_ctl_segment (tf, ctl_stop);
|
||||
cur++;
|
||||
break;
|
||||
|
||||
@@ -312,7 +384,7 @@ set_transform_expr (const char *expr)
|
||||
char buf[2];
|
||||
buf[0] = '\\';
|
||||
buf[1] = *cur;
|
||||
add_literal_segment (buf, buf + 2);
|
||||
add_literal_segment (tf, buf, buf + 2);
|
||||
}
|
||||
cur++;
|
||||
break;
|
||||
@@ -321,15 +393,23 @@ set_transform_expr (const char *expr)
|
||||
}
|
||||
else if (*cur == '&')
|
||||
{
|
||||
add_literal_segment (beg, cur);
|
||||
add_backref_segment (0);
|
||||
add_literal_segment (tf, beg, cur);
|
||||
add_backref_segment (tf, 0);
|
||||
beg = ++cur;
|
||||
}
|
||||
else
|
||||
cur++;
|
||||
}
|
||||
add_literal_segment (beg, cur);
|
||||
|
||||
add_literal_segment (tf, beg, cur);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
set_transform_expr (const char *expr)
|
||||
{
|
||||
while (*expr)
|
||||
expr = parse_transform_expr (expr);
|
||||
}
|
||||
|
||||
/* Run case conversion specified by CASE_CTL on array PTR of SIZE
|
||||
@@ -373,8 +453,12 @@ run_case_conv (enum case_ctl_type case_ctl, char *ptr, size_t size)
|
||||
return case_ctl_buffer;
|
||||
}
|
||||
|
||||
bool
|
||||
_transform_name_to_obstack (char *input)
|
||||
|
||||
static struct obstack stk;
|
||||
static bool stk_init;
|
||||
|
||||
void
|
||||
_single_transform_name_to_obstack (struct transform *tf, char *input)
|
||||
{
|
||||
regmatch_t *rmp;
|
||||
int rc;
|
||||
@@ -390,17 +474,14 @@ _transform_name_to_obstack (char *input)
|
||||
save_ctl = ctl_stop; \
|
||||
}
|
||||
|
||||
if (transform_type == transform_none)
|
||||
return false;
|
||||
|
||||
rmp = xmalloc ((regex.re_nsub + 1) * sizeof (*rmp));
|
||||
rmp = xmalloc ((tf->regex.re_nsub + 1) * sizeof (*rmp));
|
||||
|
||||
while (*input)
|
||||
{
|
||||
size_t disp;
|
||||
char *ptr;
|
||||
|
||||
rc = regexec (®ex, input, regex.re_nsub + 1, rmp, 0);
|
||||
rc = regexec (&tf->regex, input, tf->regex.re_nsub + 1, rmp, 0);
|
||||
|
||||
if (rc == 0)
|
||||
{
|
||||
@@ -412,14 +493,14 @@ _transform_name_to_obstack (char *input)
|
||||
obstack_grow (&stk, input, rmp[0].rm_so);
|
||||
|
||||
nmatches++;
|
||||
if (match_number && nmatches < match_number)
|
||||
if (tf->match_number && nmatches < tf->match_number)
|
||||
{
|
||||
obstack_grow (&stk, input, disp);
|
||||
input += disp;
|
||||
continue;
|
||||
}
|
||||
|
||||
for (segm = repl_head; segm; segm = segm->next)
|
||||
for (segm = tf->repl_head; segm; segm = segm->next)
|
||||
{
|
||||
switch (segm->type)
|
||||
{
|
||||
@@ -485,7 +566,7 @@ _transform_name_to_obstack (char *input)
|
||||
|
||||
input += disp;
|
||||
|
||||
if (transform_type == transform_first)
|
||||
if (tf->transform_type == transform_first)
|
||||
{
|
||||
obstack_grow (&stk, input, strlen (input));
|
||||
break;
|
||||
@@ -494,25 +575,48 @@ _transform_name_to_obstack (char *input)
|
||||
|
||||
obstack_1grow (&stk, 0);
|
||||
free (rmp);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
_transform_name_to_obstack (int flags, char *input, char **output)
|
||||
{
|
||||
struct transform *tf;
|
||||
bool alloced = false;
|
||||
|
||||
if (!stk_init)
|
||||
{
|
||||
obstack_init (&stk);
|
||||
stk_init = true;
|
||||
}
|
||||
|
||||
for (tf = transform_head; tf; tf = tf->next)
|
||||
{
|
||||
if (tf->flags & flags)
|
||||
{
|
||||
_single_transform_name_to_obstack (tf, input);
|
||||
input = obstack_finish (&stk);
|
||||
alloced = true;
|
||||
}
|
||||
}
|
||||
*output = input;
|
||||
return alloced;
|
||||
}
|
||||
|
||||
bool
|
||||
transform_name_fp (char **pinput, char *(*fun)(char *))
|
||||
transform_name_fp (char **pinput, int flags,
|
||||
char *(*fun)(char *, void *), void *dat)
|
||||
{
|
||||
char *str;
|
||||
bool ret = _transform_name_to_obstack (*pinput);
|
||||
bool ret = _transform_name_to_obstack (flags, *pinput, &str);
|
||||
if (ret)
|
||||
{
|
||||
str = obstack_finish (&stk);
|
||||
assign_string (pinput, fun ? fun (str) : str);
|
||||
assign_string (pinput, fun ? fun (str, dat) : str);
|
||||
obstack_free (&stk, str);
|
||||
}
|
||||
else if (fun)
|
||||
{
|
||||
str = *pinput;
|
||||
*pinput = NULL;
|
||||
assign_string (pinput, fun (str));
|
||||
assign_string (pinput, fun (str, dat));
|
||||
free (str);
|
||||
ret = true;
|
||||
}
|
||||
@@ -520,8 +624,8 @@ transform_name_fp (char **pinput, char *(*fun)(char *))
|
||||
}
|
||||
|
||||
bool
|
||||
transform_name (char **pinput)
|
||||
transform_name (char **pinput, int type)
|
||||
{
|
||||
return transform_name_fp (pinput, NULL);
|
||||
return transform_name_fp (pinput, type, NULL, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/* Update a tar archive.
|
||||
|
||||
Copyright (C) 1988, 1992, 1994, 1996, 1997, 1999, 2000, 2001, 2003,
|
||||
2004, 2005 Free Software Foundation, Inc.
|
||||
2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -110,7 +110,7 @@ update_archive (void)
|
||||
|
||||
name_gather ();
|
||||
open_archive (ACCESS_UPDATE);
|
||||
xheader_write_global ();
|
||||
buffer_write_global_xheader ();
|
||||
|
||||
while (!found_end)
|
||||
{
|
||||
@@ -181,7 +181,6 @@ update_archive (void)
|
||||
}
|
||||
|
||||
tar_stat_destroy (¤t_stat_info);
|
||||
xheader_destroy (&extended_header);
|
||||
previous_status = status;
|
||||
}
|
||||
|
||||
|
||||
13
src/utf8.c
13
src/utf8.c
@@ -1,10 +1,10 @@
|
||||
/* Charset handling for GNU tar.
|
||||
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -28,7 +28,7 @@
|
||||
# define ICONV_CONST
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ICONV
|
||||
#ifndef HAVE_ICONV
|
||||
|
||||
# undef iconv_open
|
||||
# define iconv_open(tocode, fromcode) ((iconv_t) -1)
|
||||
@@ -39,7 +39,7 @@
|
||||
# undef iconv_close
|
||||
# define iconv_close(cd) 0
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -88,11 +88,10 @@ utf8_convert (bool to_utf, char const *input, char **output)
|
||||
|
||||
|
||||
bool
|
||||
string_ascii_p (const char *str)
|
||||
string_ascii_p (char const *p)
|
||||
{
|
||||
const unsigned char *p = (const unsigned char *)str;
|
||||
for (; *p; p++)
|
||||
if (*p > 127)
|
||||
if (*p & ~0x7f)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
136
src/xheader.c
136
src/xheader.c
@@ -1,10 +1,10 @@
|
||||
/* POSIX extended headers for tar.
|
||||
|
||||
Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, or (at your option) any later
|
||||
Free Software Foundation; either version 3, or (at your option) any later
|
||||
version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
@@ -22,12 +22,9 @@
|
||||
#include <hash.h>
|
||||
#include <inttostr.h>
|
||||
#include <quotearg.h>
|
||||
#include <stpcpy.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <fnmatch.h>
|
||||
|
||||
static bool xheader_protected_pattern_p (char const *pattern);
|
||||
static bool xheader_protected_keyword_p (char const *keyword);
|
||||
static void xheader_set_single_keyword (char *) __attribute__ ((noreturn));
|
||||
@@ -35,7 +32,6 @@ static void xheader_set_single_keyword (char *) __attribute__ ((noreturn));
|
||||
/* Used by xheader_finish() */
|
||||
static void code_string (char const *string, char const *keyword,
|
||||
struct xheader *xhdr);
|
||||
static void extended_header_init (void);
|
||||
|
||||
/* Number of global headers written so far. */
|
||||
static size_t global_header_count;
|
||||
@@ -225,7 +221,7 @@ xheader_set_option (char *string)
|
||||
to the result of the basename
|
||||
utility on the translated file name.
|
||||
%p The process ID of the pax process.
|
||||
%n The value of the 3rd argument.
|
||||
%n The value of the 3rd argument.
|
||||
%% A '%' character. */
|
||||
|
||||
char *
|
||||
@@ -264,7 +260,7 @@ xheader_format_name (struct tar_stat_info *st, const char *fmt, size_t n)
|
||||
case 'f':
|
||||
if (st)
|
||||
{
|
||||
base = base_name (st->orig_file_name);
|
||||
base = last_component (st->orig_file_name);
|
||||
len += strlen (base) - 2;
|
||||
}
|
||||
break;
|
||||
@@ -331,7 +327,7 @@ xheader_format_name (struct tar_stat_info *st, const char *fmt, size_t n)
|
||||
}
|
||||
|
||||
free (dirp);
|
||||
|
||||
|
||||
/* Do not allow it to end in a slash */
|
||||
while (q > buf && ISSLASH (q[-1]))
|
||||
q--;
|
||||
@@ -405,7 +401,7 @@ xheader_write (char type, char *name, struct xheader *xhdr)
|
||||
}
|
||||
|
||||
void
|
||||
xheader_write_global (void)
|
||||
xheader_write_global (struct xheader *xhdr)
|
||||
{
|
||||
char *name;
|
||||
struct keyword_list *kp;
|
||||
@@ -413,12 +409,11 @@ xheader_write_global (void)
|
||||
if (!keyword_global_override_list)
|
||||
return;
|
||||
|
||||
extended_header_init ();
|
||||
xheader_init (xhdr);
|
||||
for (kp = keyword_global_override_list; kp; kp = kp->next)
|
||||
code_string (kp->value, kp->pattern, &extended_header);
|
||||
xheader_finish (&extended_header);
|
||||
xheader_write (XGLTYPE, name = xheader_ghdr_name (),
|
||||
&extended_header);
|
||||
code_string (kp->value, kp->pattern, xhdr);
|
||||
xheader_finish (xhdr);
|
||||
xheader_write (XGLTYPE, name = xheader_ghdr_name (), xhdr);
|
||||
free (name);
|
||||
}
|
||||
|
||||
@@ -478,7 +473,8 @@ xheader_protected_keyword_p (const char *keyword)
|
||||
/* Decode a single extended header record, advancing *PTR to the next record.
|
||||
Return true on success, false otherwise. */
|
||||
static bool
|
||||
decode_record (char **ptr,
|
||||
decode_record (struct xheader *xhdr,
|
||||
char **ptr,
|
||||
void (*handler) (void *, char const *, char const *, size_t),
|
||||
void *data)
|
||||
{
|
||||
@@ -489,7 +485,7 @@ decode_record (char **ptr,
|
||||
char *len_lim;
|
||||
char const *keyword;
|
||||
char *nextp;
|
||||
size_t len_max = extended_header.buffer + extended_header.size - start;
|
||||
size_t len_max = xhdr->buffer + xhdr->size - start;
|
||||
|
||||
while (*p == ' ' || *p == '\t')
|
||||
p++;
|
||||
@@ -508,7 +504,7 @@ decode_record (char **ptr,
|
||||
ERROR ((0, 0, _("Extended header length is out of allowed range")));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (len_max < len)
|
||||
{
|
||||
int len_len = len_lim - p;
|
||||
@@ -575,8 +571,8 @@ decx (void *data, char const *keyword, char const *value, size_t size)
|
||||
if (t)
|
||||
t->decoder (st, keyword, value, size);
|
||||
else
|
||||
ERROR((0, 0, _("Ignoring unknown extended header keyword `%s'"),
|
||||
keyword));
|
||||
WARN((0, 0, _("Ignoring unknown extended header keyword `%s'"),
|
||||
keyword));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -585,10 +581,10 @@ xheader_decode (struct tar_stat_info *st)
|
||||
run_override_list (keyword_global_override_list, st);
|
||||
run_override_list (global_header_override_list, st);
|
||||
|
||||
if (extended_header.size)
|
||||
if (st->xhdr.size)
|
||||
{
|
||||
char *p = extended_header.buffer + BLOCKSIZE;
|
||||
while (decode_record (&p, decx, st))
|
||||
char *p = st->xhdr.buffer + BLOCKSIZE;
|
||||
while (decode_record (&st->xhdr, &p, decx, st))
|
||||
continue;
|
||||
}
|
||||
run_override_list (keyword_override_list, st);
|
||||
@@ -603,35 +599,35 @@ decg (void *data, char const *keyword, char const *value,
|
||||
}
|
||||
|
||||
void
|
||||
xheader_decode_global (void)
|
||||
xheader_decode_global (struct xheader *xhdr)
|
||||
{
|
||||
if (extended_header.size)
|
||||
if (xhdr->size)
|
||||
{
|
||||
char *p = extended_header.buffer + BLOCKSIZE;
|
||||
char *p = xhdr->buffer + BLOCKSIZE;
|
||||
|
||||
xheader_list_destroy (&global_header_override_list);
|
||||
while (decode_record (&p, decg, &global_header_override_list))
|
||||
while (decode_record (xhdr, &p, decg, &global_header_override_list))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
extended_header_init (void)
|
||||
void
|
||||
xheader_init (struct xheader *xhdr)
|
||||
{
|
||||
if (!extended_header.stk)
|
||||
if (!xhdr->stk)
|
||||
{
|
||||
extended_header.stk = xmalloc (sizeof *extended_header.stk);
|
||||
obstack_init (extended_header.stk);
|
||||
xhdr->stk = xmalloc (sizeof *xhdr->stk);
|
||||
obstack_init (xhdr->stk);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
xheader_store (char const *keyword, struct tar_stat_info const *st,
|
||||
xheader_store (char const *keyword, struct tar_stat_info *st,
|
||||
void const *data)
|
||||
{
|
||||
struct xhdr_tab const *t;
|
||||
|
||||
if (extended_header.buffer)
|
||||
if (st->xhdr.buffer)
|
||||
return;
|
||||
t = locate_handler (keyword);
|
||||
if (!t || !t->coder)
|
||||
@@ -639,22 +635,20 @@ xheader_store (char const *keyword, struct tar_stat_info const *st,
|
||||
if (xheader_keyword_deleted_p (keyword)
|
||||
|| xheader_keyword_override_p (keyword))
|
||||
return;
|
||||
extended_header_init ();
|
||||
t->coder (st, keyword, &extended_header, data);
|
||||
xheader_init (&st->xhdr);
|
||||
t->coder (st, keyword, &st->xhdr, data);
|
||||
}
|
||||
|
||||
void
|
||||
xheader_read (union block *p, size_t size)
|
||||
xheader_read (struct xheader *xhdr, union block *p, size_t size)
|
||||
{
|
||||
size_t j = 0;
|
||||
size_t nblocks;
|
||||
|
||||
free (extended_header.buffer);
|
||||
xheader_init (xhdr);
|
||||
size += BLOCKSIZE;
|
||||
extended_header.size = size;
|
||||
nblocks = (size + BLOCKSIZE - 1) / BLOCKSIZE;
|
||||
extended_header.buffer = xmalloc (size + 1);
|
||||
extended_header.buffer[size] = '\0';
|
||||
xhdr->size = size;
|
||||
xhdr->buffer = xmalloc (size + 1);
|
||||
xhdr->buffer[size] = '\0';
|
||||
|
||||
do
|
||||
{
|
||||
@@ -663,7 +657,7 @@ xheader_read (union block *p, size_t size)
|
||||
if (len > BLOCKSIZE)
|
||||
len = BLOCKSIZE;
|
||||
|
||||
memcpy (&extended_header.buffer[j], p->buffer, len);
|
||||
memcpy (&xhdr->buffer[j], p->buffer, len);
|
||||
set_next_block_after (p);
|
||||
|
||||
p = find_next_block ();
|
||||
@@ -734,26 +728,25 @@ xheader_destroy (struct xheader *xhdr)
|
||||
|
||||
|
||||
/* Buildable strings */
|
||||
static uintmax_t string_length;
|
||||
|
||||
void
|
||||
xheader_string_begin ()
|
||||
xheader_string_begin (struct xheader *xhdr)
|
||||
{
|
||||
string_length = 0;
|
||||
xhdr->string_length = 0;
|
||||
}
|
||||
|
||||
void
|
||||
xheader_string_add (char const *s)
|
||||
xheader_string_add (struct xheader *xhdr, char const *s)
|
||||
{
|
||||
if (extended_header.buffer)
|
||||
if (xhdr->buffer)
|
||||
return;
|
||||
extended_header_init ();
|
||||
string_length += strlen (s);
|
||||
x_obstack_grow (&extended_header, s, strlen (s));
|
||||
xheader_init (xhdr);
|
||||
xhdr->string_length += strlen (s);
|
||||
x_obstack_grow (xhdr, s, strlen (s));
|
||||
}
|
||||
|
||||
bool
|
||||
xheader_string_end (char const *keyword)
|
||||
xheader_string_end (struct xheader *xhdr, char const *keyword)
|
||||
{
|
||||
uintmax_t len;
|
||||
uintmax_t p;
|
||||
@@ -763,11 +756,11 @@ xheader_string_end (char const *keyword)
|
||||
char const *np;
|
||||
char *cp;
|
||||
|
||||
if (extended_header.buffer)
|
||||
if (xhdr->buffer)
|
||||
return false;
|
||||
extended_header_init ();
|
||||
xheader_init (xhdr);
|
||||
|
||||
len = strlen (keyword) + string_length + 3; /* ' ' + '=' + '\n' */
|
||||
len = strlen (keyword) + xhdr->string_length + 3; /* ' ' + '=' + '\n' */
|
||||
|
||||
do
|
||||
{
|
||||
@@ -784,13 +777,13 @@ xheader_string_end (char const *keyword)
|
||||
ERROR ((0, 0,
|
||||
_("Generated keyword/value pair is too long (keyword=%s, length=%s)"),
|
||||
keyword, nbuf));
|
||||
obstack_free (extended_header.stk, obstack_finish (extended_header.stk));
|
||||
obstack_free (xhdr->stk, obstack_finish (xhdr->stk));
|
||||
return false;
|
||||
}
|
||||
x_obstack_blank (&extended_header, p);
|
||||
x_obstack_1grow (&extended_header, '\n');
|
||||
cp = obstack_next_free (extended_header.stk) - string_length - p - 1;
|
||||
memmove (cp + p, cp, string_length);
|
||||
x_obstack_blank (xhdr, p);
|
||||
x_obstack_1grow (xhdr, '\n');
|
||||
cp = obstack_next_free (xhdr->stk) - xhdr->string_length - p - 1;
|
||||
memmove (cp + p, cp, xhdr->string_length);
|
||||
cp = stpcpy (cp, np);
|
||||
*cp++ = ' ';
|
||||
cp = stpcpy (cp, keyword);
|
||||
@@ -956,7 +949,7 @@ decode_time (struct timespec *ts, char const *arg, char const *keyword)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
code_num (uintmax_t value, char const *keyword, struct xheader *xhdr)
|
||||
@@ -1094,9 +1087,10 @@ ctime_decoder (struct tar_stat_info *st,
|
||||
|
||||
static void
|
||||
mtime_coder (struct tar_stat_info const *st, char const *keyword,
|
||||
struct xheader *xhdr, void const *data __attribute__ ((unused)))
|
||||
struct xheader *xhdr, void const *data)
|
||||
{
|
||||
code_time (st->mtime, keyword, xhdr);
|
||||
struct timespec const *mtime = data;
|
||||
code_time (mtime ? *mtime : st->mtime, keyword, xhdr);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1380,8 +1374,8 @@ static void
|
||||
volume_size_coder (struct tar_stat_info const *st, char const *keyword,
|
||||
struct xheader *xhdr, void const *data)
|
||||
{
|
||||
off_t v = *(off_t*)data;
|
||||
code_num (v, keyword, xhdr);
|
||||
off_t const *v = data;
|
||||
code_num (*v, keyword, xhdr);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1399,8 +1393,8 @@ static void
|
||||
volume_offset_coder (struct tar_stat_info const *st, char const *keyword,
|
||||
struct xheader *xhdr, void const *data)
|
||||
{
|
||||
off_t v = *(off_t*)data;
|
||||
code_num (v, keyword, xhdr);
|
||||
off_t const *v = data;
|
||||
code_num (*v, keyword, xhdr);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1439,12 +1433,12 @@ sparse_major_decoder (struct tar_stat_info *st,
|
||||
if (decode_num (&u, arg, TYPE_MAXIMUM (unsigned), keyword))
|
||||
st->sparse_major = u;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sparse_minor_coder (struct tar_stat_info const *st, char const *keyword,
|
||||
struct xheader *xhdr, void const *data)
|
||||
{
|
||||
code_num (st->sparse_minor, keyword, xhdr);
|
||||
code_num (st->sparse_minor, keyword, xhdr);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1457,7 +1451,7 @@ sparse_minor_decoder (struct tar_stat_info *st,
|
||||
if (decode_num (&u, arg, TYPE_MAXIMUM (unsigned), keyword))
|
||||
st->sparse_minor = u;
|
||||
}
|
||||
|
||||
|
||||
struct xhdr_tab const xhdr_tab[] = {
|
||||
{ "atime", atime_coder, atime_decoder, false },
|
||||
{ "comment", dummy_coder, dummy_decoder, false },
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
# Makefile for GNU tar regression tests.
|
||||
|
||||
# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2003, 2004, 2005,
|
||||
# 2006 Free Software Foundation, Inc.
|
||||
# 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# François Pinard <pinard@iro.umontreal.ca>, 1988.
|
||||
# Sergey Poznyakoff <gray@mirddin.farlep.net>, 2004.
|
||||
|
||||
## This program is free software; you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation; either version 2, or (at your option)
|
||||
## the Free Software Foundation; either version 3, or (at your option)
|
||||
## any later version.
|
||||
|
||||
## This program is distributed in the hope that it will be useful,
|
||||
@@ -46,6 +46,8 @@ $(srcdir)/package.m4: $(top_srcdir)/configure.ac
|
||||
## ------------ ##
|
||||
|
||||
TESTSUITE_AT = \
|
||||
T-empty.at\
|
||||
T-null.at\
|
||||
testsuite.at\
|
||||
append.at\
|
||||
append01.at\
|
||||
@@ -57,12 +59,14 @@ TESTSUITE_AT = \
|
||||
delete03.at\
|
||||
delete04.at\
|
||||
delete05.at\
|
||||
exclude.at\
|
||||
extrac01.at\
|
||||
extrac02.at\
|
||||
extrac03.at\
|
||||
extrac04.at\
|
||||
extrac05.at\
|
||||
extrac06.at\
|
||||
extrac07.at\
|
||||
gzip.at\
|
||||
grow.at\
|
||||
incremental.at\
|
||||
@@ -85,6 +89,7 @@ TESTSUITE_AT = \
|
||||
multiv03.at\
|
||||
multiv04.at\
|
||||
multiv05.at\
|
||||
multiv06.at\
|
||||
old.at\
|
||||
options.at\
|
||||
options02.at\
|
||||
@@ -93,8 +98,12 @@ TESTSUITE_AT = \
|
||||
rename01.at\
|
||||
rename02.at\
|
||||
rename03.at\
|
||||
rename04.at\
|
||||
rename05.at\
|
||||
same-order01.at\
|
||||
same-order02.at\
|
||||
shortfile.at\
|
||||
shortupd.at\
|
||||
shortrec.at\
|
||||
sparse01.at\
|
||||
sparse02.at\
|
||||
|
||||
52
tests/T-empty.at
Normal file
52
tests/T-empty.at
Normal file
@@ -0,0 +1,52 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
# Tar 1.16 coredumped if a filelist file contained empty (zero-length)
|
||||
# entries
|
||||
# Reported by: Karl Berry <karl@freefriends.org>
|
||||
# References: <200610301353.k9UDr1O30680@f7.net>
|
||||
|
||||
AT_SETUP([files-from: empty entries])
|
||||
AT_KEYWORDS([files-from empty])
|
||||
|
||||
AT_DATA([file-list],
|
||||
[jeden
|
||||
dwa
|
||||
|
||||
trzy
|
||||
])
|
||||
|
||||
AT_TAR_CHECK([
|
||||
AT_SORT_PREREQ
|
||||
|
||||
genfile --file jeden
|
||||
genfile --file dwa
|
||||
genfile --file trzy
|
||||
|
||||
tar cfvT archive ../file-list | sort
|
||||
],
|
||||
[0],
|
||||
[dwa
|
||||
jeden
|
||||
trzy
|
||||
],
|
||||
[],[],[],[ustar]) # Testing one format is enough
|
||||
|
||||
AT_CLEANUP
|
||||
48
tests/T-null.at
Normal file
48
tests/T-null.at
Normal file
@@ -0,0 +1,48 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
AT_SETUP([files-from: 0-separated file without -0])
|
||||
AT_KEYWORDS([files-from null T-null])
|
||||
|
||||
AT_DATA([expout],[jeden\ndwa
|
||||
trzy
|
||||
])
|
||||
|
||||
AT_TAR_CHECK([
|
||||
AT_SORT_PREREQ
|
||||
|
||||
echo dwa > temp
|
||||
echo trzy >> temp
|
||||
cat temp | tr '\n' '\0' > temp1
|
||||
echo jeden > file-list
|
||||
cat temp1 >> file-list
|
||||
|
||||
genfile -f "jeden
|
||||
dwa" || AT_SKIP_TEST
|
||||
genfile -f trzy
|
||||
|
||||
tar cfTv archive file-list | sort
|
||||
],
|
||||
[0],
|
||||
[expout],
|
||||
[tar: file-list: file name read contains nul character
|
||||
],[],[],[ustar]) # Testing one format is enough
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -44,19 +44,22 @@ AT_TAR_CHECK([
|
||||
genfile --file file1
|
||||
genfile --file file2
|
||||
|
||||
# Make sure file timestamps in the archive will not differ
|
||||
MTIME="--mtime=@0"
|
||||
|
||||
# For PAX archives, we need to make sure extended header names are
|
||||
# reproducible.
|
||||
# reproducible and that their contents won't change with time
|
||||
if test $[]TEST_TAR_FORMAT = posix; then
|
||||
TAR_OPTIONS="$TAR_OPTIONS --pax-option=exthdr.name=%d/PaxHeaders/%f"
|
||||
TAR_OPTIONS="$TAR_OPTIONS --pax-option=exthdr.name=%d/PaxHeaders/%f,delete=mtime,delete=atime,delete=ctime"
|
||||
fi
|
||||
|
||||
echo Creating archive.1
|
||||
tar cf archive.1 file1 file2
|
||||
tar $MTIME -cf archive.1 file1 file2
|
||||
|
||||
echo Creating archive.2
|
||||
tar cfT archive.2 /dev/null
|
||||
tar rf archive.2 file1
|
||||
tar rf archive.2 file2
|
||||
tar $MTIME -cf archive.2 -T /dev/null
|
||||
tar $MTIME -rf archive.2 file1
|
||||
tar $MTIME -rf archive.2 file2
|
||||
|
||||
echo Comparing archives
|
||||
cmp archive.1 archive.2
|
||||
|
||||
@@ -13,7 +13,7 @@ if test -z "$TEST_DATA_DIR"; then
|
||||
TEST_DATA_DIR=$abs_builddir
|
||||
fi
|
||||
|
||||
STAR_DATA_URL=http://download.berlios.de/pub/star/testscripts
|
||||
STAR_DATA_URL=ftp://ftp.berlios.de/pub/star/testscripts
|
||||
if test -z "$STAR_TESTSCRIPTS"; then
|
||||
STAR_TESTSCRIPTS=$TEST_DATA_DIR
|
||||
fi
|
||||
@@ -27,7 +27,11 @@ tarball_prereq() {
|
||||
wget -q --directory-prefix=$3 $4/$1
|
||||
fi
|
||||
fi
|
||||
echo "$2 $3/$1" | md5sum --status --check -
|
||||
echo "$2 $3/$1" | md5sum --status --check - >/dev/null 2>&1
|
||||
}
|
||||
|
||||
decho() {
|
||||
echo $*
|
||||
echo >&2 $*
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -42,7 +42,7 @@ tar tf archive
|
||||
to
|
||||
],
|
||||
[tar: tre: Not found in archive
|
||||
tar: Error exit delayed from previous errors
|
||||
tar: Exiting with failure status due to previous errors
|
||||
])
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
163
tests/exclude.at
Normal file
163
tests/exclude.at
Normal file
@@ -0,0 +1,163 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
# Test the functioning of --exclude-caches and --exclude-tag option families
|
||||
|
||||
AT_SETUP([exclude])
|
||||
AT_KEYWORDS([exclude])
|
||||
|
||||
AT_TAR_CHECK([
|
||||
AT_SORT_PREREQ
|
||||
|
||||
mkdir dir
|
||||
echo blues > dir/blues
|
||||
echo jazz > dir/jazz
|
||||
mkdir dir/folk
|
||||
echo tagfile > dir/folk/tagfile
|
||||
echo sanjuan > dir/folk/sanjuan
|
||||
mkdir dir/rock
|
||||
echo "Signature: 8a477f597d28d172789f06886806bc55" > dir/rock/CACHEDIR.TAG
|
||||
echo "test" > dir/rock/file
|
||||
|
||||
for option in exclude-caches exclude-caches-under exclude-caches-all
|
||||
do
|
||||
echo OPTION $option
|
||||
tar -cf archive.tar --$option -v dir 2>err | sort
|
||||
cat err
|
||||
echo ARCHIVE
|
||||
tar tf archive.tar | sort
|
||||
done
|
||||
|
||||
for option in exclude-tag exclude-tag-under exclude-tag-all
|
||||
do
|
||||
echo OPTION $option
|
||||
tar -cf archive.tar --${option}=tagfile -v dir 2>err | sort
|
||||
cat err
|
||||
echo ARCHIVE
|
||||
tar tf archive.tar | sort
|
||||
done
|
||||
],
|
||||
[0],
|
||||
[OPTION exclude-caches
|
||||
dir/
|
||||
dir/blues
|
||||
dir/folk/
|
||||
dir/folk/sanjuan
|
||||
dir/folk/tagfile
|
||||
dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
tar: dir/rock/: contains a cache directory tag CACHEDIR.TAG; contents not dumped
|
||||
ARCHIVE
|
||||
dir/
|
||||
dir/blues
|
||||
dir/folk/
|
||||
dir/folk/sanjuan
|
||||
dir/folk/tagfile
|
||||
dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
OPTION exclude-caches-under
|
||||
dir/
|
||||
dir/blues
|
||||
dir/folk/
|
||||
dir/folk/sanjuan
|
||||
dir/folk/tagfile
|
||||
dir/jazz
|
||||
dir/rock/
|
||||
tar: dir/rock/: contains a cache directory tag CACHEDIR.TAG; contents not dumped
|
||||
ARCHIVE
|
||||
dir/
|
||||
dir/blues
|
||||
dir/folk/
|
||||
dir/folk/sanjuan
|
||||
dir/folk/tagfile
|
||||
dir/jazz
|
||||
dir/rock/
|
||||
OPTION exclude-caches-all
|
||||
dir/
|
||||
dir/blues
|
||||
dir/folk/
|
||||
dir/folk/sanjuan
|
||||
dir/folk/tagfile
|
||||
dir/jazz
|
||||
tar: dir/rock/: contains a cache directory tag CACHEDIR.TAG; directory not dumped
|
||||
ARCHIVE
|
||||
dir/
|
||||
dir/blues
|
||||
dir/folk/
|
||||
dir/folk/sanjuan
|
||||
dir/folk/tagfile
|
||||
dir/jazz
|
||||
OPTION exclude-tag
|
||||
dir/
|
||||
dir/blues
|
||||
dir/folk/
|
||||
dir/folk/tagfile
|
||||
dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
dir/rock/file
|
||||
tar: dir/folk/: contains a cache directory tag tagfile; contents not dumped
|
||||
ARCHIVE
|
||||
dir/
|
||||
dir/blues
|
||||
dir/folk/
|
||||
dir/folk/tagfile
|
||||
dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
dir/rock/file
|
||||
OPTION exclude-tag-under
|
||||
dir/
|
||||
dir/blues
|
||||
dir/folk/
|
||||
dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
dir/rock/file
|
||||
tar: dir/folk/: contains a cache directory tag tagfile; contents not dumped
|
||||
ARCHIVE
|
||||
dir/
|
||||
dir/blues
|
||||
dir/folk/
|
||||
dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
dir/rock/file
|
||||
OPTION exclude-tag-all
|
||||
dir/
|
||||
dir/blues
|
||||
dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
dir/rock/file
|
||||
tar: dir/folk/: contains a cache directory tag tagfile; directory not dumped
|
||||
ARCHIVE
|
||||
dir/
|
||||
dir/blues
|
||||
dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
dir/rock/file
|
||||
],
|
||||
[],[],[],[ustar])
|
||||
|
||||
AT_CLEANUP
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -21,7 +21,7 @@
|
||||
# Could not extract symlinks over an existing file.
|
||||
|
||||
AT_SETUP([extracting symlinks over an existing file])
|
||||
AT_KEYWORDS([extract extract02])
|
||||
AT_KEYWORDS([extract extract02 symlink])
|
||||
|
||||
# FIXME: Skip if symlinks are not supported on the system
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -21,7 +21,7 @@
|
||||
# Check for fnmatch problems in glibc 2.1.95.
|
||||
|
||||
AT_SETUP([extract + fnmatch])
|
||||
AT_KEYWORDS([extract extract04])
|
||||
AT_KEYWORDS([extract extract04 fnmatch])
|
||||
|
||||
AT_TAR_CHECK([
|
||||
AT_SORT_PREREQ
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -31,7 +31,7 @@
|
||||
#
|
||||
|
||||
AT_SETUP([mode of extracted directories])
|
||||
AT_KEYWORDS([extract extract06])
|
||||
AT_KEYWORDS([extract extract06 directory mode])
|
||||
|
||||
AT_TAR_CHECK([
|
||||
|
||||
|
||||
59
tests/extrac07.at
Normal file
59
tests/extrac07.at
Normal file
@@ -0,0 +1,59 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
|
||||
# Tar 1.16 failed to extract archives that have symlinks
|
||||
# in read-only directories.
|
||||
#
|
||||
# Reported-by: Eelco Dolstra <eelco@cs.uu.nl>
|
||||
# References: <45475D78.8050708@cs.uu.nl>
|
||||
|
||||
AT_SETUP([extracting symlinks to a read-only dir])
|
||||
AT_KEYWORDS([extract extract07 read-only symlink])
|
||||
|
||||
AT_TAR_CHECK([
|
||||
echo Prepare the directory
|
||||
mkdir dir
|
||||
genfile -f foo
|
||||
cd dir
|
||||
ln -s ../foo .
|
||||
cd ..
|
||||
chmod -w dir
|
||||
|
||||
echo Create the archive
|
||||
tar cf archive dir || exit 1
|
||||
|
||||
chmod +w dir
|
||||
|
||||
echo Extract
|
||||
mkdir out
|
||||
tar -C out -xvf archive
|
||||
],
|
||||
[0],
|
||||
[Prepare the directory
|
||||
Create the archive
|
||||
Extract
|
||||
dir/
|
||||
dir/foo
|
||||
],
|
||||
[],[],[ustar]) # Testing one format is enough
|
||||
|
||||
AT_CLEANUP
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -35,7 +35,7 @@ test $? = 2 || exit 1
|
||||
[
|
||||
gzip: stdin: unexpected end of file
|
||||
tar: Child returned status 1
|
||||
tar: Error exit delayed from previous errors
|
||||
tar: Exiting with failure status due to previous errors
|
||||
],
|
||||
[],[])
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -64,12 +64,12 @@ test $status = 0
|
||||
[
|
||||
-----
|
||||
tar: file: Cannot open: Permission denied
|
||||
tar: Error exit delayed from previous errors
|
||||
tar: Exiting with failure status due to previous errors
|
||||
-----
|
||||
tar: file: Warning: Cannot open: Permission denied
|
||||
-----
|
||||
tar: directory: Cannot open: Permission denied
|
||||
tar: Error exit delayed from previous errors
|
||||
tar: Exiting with failure status due to previous errors
|
||||
-----
|
||||
tar: directory: Warning: Cannot open: Permission denied
|
||||
])
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -34,6 +34,8 @@ mkdir directory
|
||||
genfile --file=directory/x
|
||||
genfile --file=directory/y
|
||||
|
||||
sleep 1
|
||||
|
||||
tar -cf archive.1 -g db directory
|
||||
|
||||
mv directory/x directory/z
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -38,6 +38,8 @@ awk 'BEGIN {
|
||||
printf("NAME_PREFIX[%03d]\n", i);
|
||||
}' < /dev/null | genfile --files-from -
|
||||
|
||||
sleep 1
|
||||
|
||||
echo "Initial dump"
|
||||
tar cvf a0.tar -g a.sna a
|
||||
mv a/b a/c
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -44,7 +44,10 @@ sleep 1
|
||||
tar cf archive --listed=list structure
|
||||
tar cfv archive --listed=list structure
|
||||
echo separator
|
||||
sleep 1
|
||||
# ReiserFS often offsets the timestamps of newly created files
|
||||
# 1 second to the past. Try to compensate for it, until a better
|
||||
# solution is found.
|
||||
sleep 2
|
||||
echo y >structure/file
|
||||
tar cfv archive --listed=list structure
|
||||
],
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -39,7 +39,7 @@ tar --create \
|
||||
|
||||
tar tf archive.1 || exit 1
|
||||
|
||||
sleep 1
|
||||
sleep 2
|
||||
|
||||
genfile --length 10240 --pattern zeros --file directory/file2
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Process this file with autom4te to create testsuite. -*- Autotest -*-
|
||||
|
||||
# Test suite for GNU tar.
|
||||
# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# the Free Software Foundation; either version 3, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
@@ -40,7 +40,7 @@ tar tf archive
|
||||
DIR/
|
||||
],
|
||||
[tar: DIR/FILE: file name is too long (max 99); not dumped
|
||||
tar: Error exit delayed from previous errors
|
||||
tar: Exiting with failure status due to previous errors
|
||||
],
|
||||
[],[],[v7])
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user