120 Commits

Author SHA1 Message Date
Sergey Poznyakoff
b94eed6d03 Version 1.20.
* 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-05-05 21:30:57 +00:00
Sergey Poznyakoff
192860abb8 Update 2008-03-31 08:03:00 +00:00
Sergey Poznyakoff
c2d2e806a1 (dump_file0): Count links only for actually dumped files 2008-03-31 08:02:53 +00:00
Sergey Poznyakoff
2a89f7a0a8 * 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.
2008-03-27 10:11:05 +00:00
Sergey Poznyakoff
71d2a66f42 * 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.
2008-03-27 08:56:26 +00:00
Sergey Poznyakoff
e496c1b529 * 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-03-06 08:17:33 +00:00
Sergey Poznyakoff
6667fa7fb8 Update 2008-02-09 10:36:40 +00:00
Sergey Poznyakoff
a16ad3112e Fix a typo 2008-02-09 10:35:55 +00:00
Sergey Poznyakoff
7efe3850f6 * 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-08 14:12:22 +00:00
Sergey Poznyakoff
d0694ee604 Update the description 2008-02-08 10:32:15 +00:00
Sergey Poznyakoff
37f0faf1c0 (dump_file0): Apply transform_name to symlink targets. 2008-02-07 15:46:41 +00:00
Sergey Poznyakoff
b893aee6d2 Update 2008-02-07 15:46:28 +00:00
Sergey Poznyakoff
f60d655908 Update 2008-02-04 10:39:05 +00:00
Sergey Poznyakoff
549481a0a7 Update 2008-02-04 10:38:27 +00:00
Sergey Poznyakoff
e08afc2002 Document changes to the --transform option. 2008-02-04 10:38:18 +00:00
Sergey Poznyakoff
338591a486 Support multiple --transform options. Support semicolon-separated lists of replace expressions. 2008-02-04 10:35:20 +00:00
Paul Eggert
c0e0d06e69 * 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.
2008-01-31 00:50:12 +00:00
Sergey Poznyakoff
6e85425618 Update 2007-12-05 09:48:37 +00:00
Sergey Poznyakoff
336519aa4f Add shortupd.at. 2007-12-05 09:45:35 +00:00
Sergey Poznyakoff
5f4d99491d (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.
2007-12-05 09:45:22 +00:00
Paul Eggert
48d83be336 Don't read from name[-1].
* src/incremen.c (make_directory): Handle namelen == 0, since
find_directory_meta calls make_directory ("").
2007-11-13 07:01:26 +00:00
Sergey Poznyakoff
60d351cc5a Update 2007-11-07 08:48:39 +00:00
Sergey Poznyakoff
e33be3d0a1 Add fseeko and snprintf. 2007-11-07 08:48:28 +00:00
Sergey Poznyakoff
32562b9412 (checkout): Use URL of the gnulib CVS mirror. 2007-11-07 08:48:19 +00:00
Sergey Poznyakoff
dfd87ba1d0 (magic): Fix lzma option 2007-10-31 13:10:55 +00:00
Sergey Poznyakoff
5d4a682a55 Update 2007-10-31 12:57:04 +00:00
Sergey Poznyakoff
8e3a2a520d (sys_exec_info_script,sys_exec_checkpoint_script): pass the current blocking factor in TAR_BLOCKING_FACTOR environment variable. 2007-10-31 12:56:46 +00:00
Sergey Poznyakoff
745832a280 New actions: bell and ttyout 2007-10-31 12:56:27 +00:00
Sergey Poznyakoff
458efab23b Minor fix 2007-10-30 14:58:52 +00:00
Sergey Poznyakoff
23dcaa117f Update 2007-10-30 14:09:20 +00:00
Sergey Poznyakoff
5099ddf6cc Document --hard-dereference and --checkpoint-action options. Improve documentation of --check-links. 2007-10-30 14:09:04 +00:00
Sergey Poznyakoff
8476145508 Use texi2html and the CVS version of gendocs.sh to create HTML versions of the manual 2007-10-30 14:08:41 +00:00
Sergey Poznyakoff
362492fe70 Use texi2html and the CVS version of gendocs.sh to create HTML versions of the manual 2007-10-30 14:08:21 +00:00
Sergey Poznyakoff
7111008659 Update 2007-10-29 16:57:32 +00:00
Sergey Poznyakoff
ec4741d732 (parse_opt): New options --hard-dereference, --checkpoint-action.
(decode_options): Call checkpoint_finish_compile.
2007-10-29 16:56:56 +00:00
Sergey Poznyakoff
bed7de0271 (sys_exec_checkpoint_script): New function.
(sys_exec_info_script): Restore SIGPIPE handler.
2007-10-29 16:56:33 +00:00
Sergey Poznyakoff
eaaadcfd36 (file_count_links): do nothing if hard_dereference_option is set. 2007-10-29 16:56:13 +00:00
Sergey Poznyakoff
a8830fbb86 (enum checkpoint_style): Remove.
(checkpoint_style): Remove.
(DEFAULT_CHECKPOINT): New define.
(hard_dereference_option): New variable.
(sys_exec_checkpoint_script): New declaration.
2007-10-29 16:55:58 +00:00
Sergey Poznyakoff
848659f1c6 (checkpoint, do_checkpoint): Remove.
(_flush_write, simple_flush_read, _gnu_flush_read): Use
checkpoint_run.
2007-10-29 16:55:37 +00:00
Sergey Poznyakoff
17cbd4862c checkpoint handling 2007-10-29 16:55:16 +00:00
Sergey Poznyakoff
64ded9e702 (tar_SOURCES): add checkpoint.c 2007-10-29 16:54:51 +00:00
Sergey Poznyakoff
ccd0a527e4 Version 1.19.1 2007-10-29 16:54:38 +00:00
Sergey Poznyakoff
3f869877a4 Version 1.19.1 2007-10-29 16:53:28 +00:00
Sergey Poznyakoff
8c528937a9 Update 2007-10-29 16:53:20 +00:00
Sergey Poznyakoff
460f4ec146 Update 2007-10-29 08:53:58 +00:00
Sergey Poznyakoff
eb59c14a1f (sys_exec_info_script): Initialize buf. Problem reported by Bengt-Arne Fjellner. 2007-10-29 08:51:46 +00:00
Paul Eggert
3c4f4ca423 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".

expired.
SCALAR(0x830b08c)
2007-10-18 21:36:38 +00:00
Sergey Poznyakoff
506b4db5d0 Update 2007-10-18 07:59:48 +00:00
Sergey Poznyakoff
5bfb6c5f9d (gzip): Remove compression patent warning. According to Brett Smith, the patent is expired. 2007-10-18 07:59:39 +00:00
Sergey Poznyakoff
3725b5606f Update 2007-10-17 09:12:54 +00:00
Sergey Poznyakoff
d1a7eebc30 Update 2007-10-17 09:12:03 +00:00
Sergey Poznyakoff
dfe280dcca Add Lasse Collin and Jean-Pierre Demailly. 2007-10-17 09:11:50 +00:00
Sergey Poznyakoff
620a136e74 New options --auto-compress (-a) and --lzma 2007-10-17 09:11:34 +00:00
Sergey Poznyakoff
3fb5d67b28 (set_comression_program_by_suffix): New prototype. 2007-10-17 09:11:23 +00:00
Sergey Poznyakoff
c30a794679 (magic): Add an entry for new lzma format. Proposed by Lasse Collin 2007-10-17 09:11:08 +00:00
Sergey Poznyakoff
00bb0d8f5c Add suffix.c 2007-10-17 09:10:46 +00:00
Sergey Poznyakoff
af3e05b6af New file. Determine compression algorithm by archive file name suffix. Suggested by Jean-Pierre Demailly. 2007-10-17 09:10:34 +00:00
Paul Eggert
6060d613d1 * 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-13 05:49:18 +00:00
Paul Eggert
3f12066739 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.

SCALAR(0x830b0dc)
directories.

SCALAR(0x831ad2c)
2007-10-11 22:04:44 +00:00
Sergey Poznyakoff
3b74fbfc3b Update 2007-10-10 11:04:25 +00:00
Sergey Poznyakoff
14d39a2c14 Update 2007-10-10 11:03:42 +00:00
Sergey Poznyakoff
7b57922073 Version 1.19 2007-10-10 11:03:14 +00:00
Sergey Poznyakoff
05c6da4c62 Update 2007-10-05 11:21:40 +00:00
Sergey Poznyakoff
4ece30109d (dump_regular_file): Fix file padding in case of truncation to zero size. 2007-10-05 11:20:27 +00:00
Sergey Poznyakoff
55f1eadbf2 Update 2007-10-04 07:16:52 +00:00
Sergey Poznyakoff
9b22262fc6 Use AT_DATA for sample output. 2007-10-04 07:16:39 +00:00
Sergey Poznyakoff
2de140fa95 Update 2007-10-03 20:18:47 +00:00
Sergey Poznyakoff
6f6864df13 (try_purge_directory): Ensure that arguments to T and R are safe. 2007-10-03 20:18:32 +00:00
Sergey Poznyakoff
519a7c0c75 Update 2007-09-29 00:48:08 +00:00
Sergey Poznyakoff
1ef212d0fb (obstack_code_rename): Apply safer_name_suffix to name arguments before storing them in T and R records. Reported by Nicholas Cole. 2007-09-29 00:47:59 +00:00
Sergey Poznyakoff
333780b227 Update 2007-09-27 09:16:38 +00:00
Sergey Poznyakoff
2c56ca0e7f Raise version number to 1.18.90 2007-09-27 09:16:24 +00:00
Sergey Poznyakoff
63f8de655b Update 2007-09-27 08:05:38 +00:00
Sergey Poznyakoff
2743e1ba5b Document version 2 2007-09-27 08:05:31 +00:00
Sergey Poznyakoff
40ece6bf4d Update 2007-09-26 22:08:51 +00:00
Sergey Poznyakoff
63e835f5c0 New option --exclude-vcs
(exclude_vcs_files): New function
2007-09-26 22:08:36 +00:00
Sergey Poznyakoff
efe6609cd9 (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.
2007-09-26 22:08:13 +00:00
Sergey Poznyakoff
b0d5935cb0 (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.
2007-09-26 22:07:44 +00:00
Sergey Poznyakoff
a1b1b7cc8a (exclusion_tag_warning, check_exclusion_tags): New prototypes 2007-09-26 22:06:43 +00:00
Sergey Poznyakoff
8940247418 Update 2007-09-26 22:06:24 +00:00
Paul Eggert
0dacafbbb0 * AUTHORS: Remove unnecessary information. Just list the
principal authors.
* THANKS: Remove info duplicated from AUTHORS.

SCALAR(0x82892dc)


SCALAR(0x8279918)

SCALAR(0x8289444)


stripping and name suffix normalization.
2007-09-14 21:00:37 +00:00
Sergey Poznyakoff
e3e50c987b Minor rewording 2007-09-08 08:49:35 +00:00
Sergey Poznyakoff
923f0cda43 Update 2007-08-26 09:02:09 +00:00
Sergey Poznyakoff
c485b7984d (apply_nonancestor_delayed_set_stat): Rename st->sb to avoid shadowing another local. 2007-08-26 09:01:38 +00:00
Sergey Poznyakoff
d769b724f4 (diff_dumpdir): Rename stat->stat_data to avoid shadowing the syscall. 2007-08-26 09:01:08 +00:00
Sergey Poznyakoff
a0eb52da3f (check_exclusion_tags): Remove declaration of unused local, "ret". 2007-08-26 08:59:28 +00:00
Sergey Poznyakoff
87ac3207fb Don't include <getline.h>. No longer needed. 2007-08-26 08:59:08 +00:00
Sergey Poznyakoff
c634f2c6f1 Raise version number to 1.18.1 2007-08-24 12:23:19 +00:00
Sergey Poznyakoff
5416153391 Update 2007-08-24 12:08:58 +00:00
Sergey Poznyakoff
5bb69a88d8 Add shortfile.at 2007-08-24 12:08:47 +00:00
Sergey Poznyakoff
0a848ff669 New test case for the today's change in src/buffer.c (1.111) 2007-08-24 12:08:35 +00:00
Sergey Poznyakoff
7c0b81cbb9 (check_compressed_archive): Detect files smaller than 512 bytes. 2007-08-24 12:07:32 +00:00
Sergey Poznyakoff
862770bf91 Update 2007-08-19 09:17:32 +00:00
Sergey Poznyakoff
89d682d0b9 Gnulib initialization destroyed paxutils m4 files.
Initialize paxutils structure after that of gnulib.
2007-08-19 09:17:21 +00:00
Sergey Poznyakoff
764174dc1d Update 2007-08-12 08:25:35 +00:00
Sergey Poznyakoff
5ab30f709a (symlink_to_gnulib): Make sure the target directory exists and create it if it does not. 2007-08-12 08:25:27 +00:00
Sergey Poznyakoff
e2b8c8fa9f (contains_dot_dot): Fix double-dot recognition in case of duplicate /. Patch by Dmitry V. Levin. 2007-08-12 08:25:00 +00:00
Sergey Poznyakoff
42250f5010 Update 2007-08-12 07:15:11 +00:00
Sergey Poznyakoff
62571aa7c3 Fix a typo 2007-08-12 07:14:29 +00:00
Sergey Poznyakoff
32f7047037 Update 2007-06-29 20:23:05 +00:00
Sergey Poznyakoff
a69be0adce Add to the repository 2007-06-29 20:22:48 +00:00
Sergey Poznyakoff
1fb35e7374 Final update for GPLv3 2007-06-29 20:20:02 +00:00
Sergey Poznyakoff
7e69b14775 Update 2007-06-28 17:01:18 +00:00
Sergey Poznyakoff
625c45d304 Update for the change of the TP URL 2007-06-28 17:00:35 +00:00
Sergey Poznyakoff
3fe0f0d7f8 Update 2007-06-27 14:06:55 +00:00
Sergey Poznyakoff
c3d4fee823 Restore after an accidental remove 2007-06-27 13:46:15 +00:00
Sergey Poznyakoff
a0fb51e136 Relicense under GPLv3 2007-06-27 13:30:12 +00:00
Sergey Poznyakoff
ac8690fc4e Update copyright year 2007-06-21 08:52:22 +00:00
Sergey Poznyakoff
395df04927 Update 2007-06-21 08:51:15 +00:00
Sergey Poznyakoff
89a91c7b44 Skip test if genfile is unable to create the file 2007-06-21 08:51:03 +00:00
Sergey Poznyakoff
5635a428ab (AT_TAR_MKHIER): Skip test if genfile is unable to create the file 2007-06-21 08:50:09 +00:00
Sergey Poznyakoff
8b5f10a6c4 Resolve testsuite failures 40-42 on cygwin. 2007-06-21 07:12:09 +00:00
Sergey Poznyakoff
6e98015774 Update 2007-06-16 12:10:24 +00:00
Sergey Poznyakoff
bd13e18a63 Add back write permissions on dir 2007-06-16 12:10:14 +00:00
Sergey Poznyakoff
01cf5c5315 New file 2007-06-16 12:09:59 +00:00
Sergey Poznyakoff
0dd814fac2 (Fixing Snapshot Files): New appendix 2007-06-16 12:09:50 +00:00
Sergey Poznyakoff
b27b516b68 (tar_TEXINFOS): Add tar-snapshot-edit.texi 2007-06-16 12:09:34 +00:00
Sergey Poznyakoff
c7f69c265b Update 2007-06-09 17:07:54 +00:00
Sergey Poznyakoff
bc00f45420 Sort the output 2007-06-09 17:07:46 +00:00
Paul Eggert
57304e8b0a Fix typo: occurence -> occurrence. 2007-06-08 18:49:19 +00:00
141 changed files with 3882 additions and 2318 deletions

View File

@@ -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
View File

@@ -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
View 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>.

338
ChangeLog
View File

@@ -1,3 +1,326 @@
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
@@ -10,21 +333,21 @@
* 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.
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,
@@ -8257,7 +8580,7 @@
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,
@@ -8269,3 +8592,8 @@
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
version-control: never
End:

View File

@@ -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,

130
NEWS
View File

@@ -1,37 +1,145 @@
GNU tar NEWS - User visible changes. 2007-06-08
GNU tar NEWS - User visible changes. 2008-03-27
Please send GNU tar bug reports to <bug-tar@gnu.org>
version 1.19.90 (CVS)
* 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.
* 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 --occurence. In previous versions it continued scanning the archive
* 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.
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
* 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.
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'.
@@ -45,7 +153,7 @@ version 1.16.1 - Sergey Poznyakoff, 2006-12-09
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
* After creating an archive, tar exits with code 1 if some files were
@@ -886,13 +994,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, 2007 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,

6
PORTS
View File

@@ -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
View File

@@ -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,

View File

@@ -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,

View File

@@ -51,12 +51,12 @@ Enjoy!
-----
Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
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 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,

14
THANKS
View File

@@ -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
@@ -222,10 +217,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 +292,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

4
TODO
View File

@@ -45,13 +45,13 @@ Suggestions for improving GNU tar.
* 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,

205
bootstrap
View File

@@ -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,
@@ -49,9 +49,9 @@ Options:
--force Attempt to bootstrap even if the sources seem
not to have been checked out.
--skip-po Do not download po files.
--update-po[=LANG] Update po file(s) and exit.
--update-po Update po files and exit.
--cvs-user=USERNAME Set the CVS username to be used when accessing
the gnulib repository.
the paxutils repository.
If the file bootstrap.conf exists in the current working directory, its
contents are read as shell variables to configure the bootstrap.
@@ -69,24 +69,34 @@ checkout() {
if [ ! -d $1 ]; then
echo "$0: getting $1 files..."
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 $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;;
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 ${CVS_PREFIX}cvs.savannah.gnu.org:/cvsroot/"$1" co $1 ||
cleanup $1
cvs -z3 -q -d $CVSURL co $1 || cleanup $1
trap - 1 2 13 15
fi
@@ -106,10 +116,13 @@ gnulib_modules=
# Any gnulib files needed that are not in modules.
gnulib_files=
# Translation Project URL, for the registry of all projects
# and for the translation-team master directory.
TP_URL='http://www.iro.umontreal.ca/translation/registry.cgi?domain='
TP_PO_URL='http://www.iro.umontreal.ca/translation/teams/PO/'
# 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(/{
@@ -212,76 +225,60 @@ echo "$0: Bootstrapping CVS $package..."
# Get translations.
get_translations() {
download_po_files() {
subdir=$1
domain=$2
po_file=$3
case $WGET_COMMAND in
'')
echo "$0: wget not available; skipping translations";;
?*)
echo "$0: getting ${po_file:-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
ver = $2
urlfmt = ""
printf "{ $WGET_COMMAND -O %s/%s.po '\'"$TP_PO_URL"'/%s/%s-%s.%s.po'\'' &&\n", subdir, lang, lang, domain, ver, lang
printf " msgfmt -c -o /dev/null %s/%s.po || {\n", subdir, lang
printf " echo >&2 '\'"$0"': omitting translation for %s'\''\n", lang
printf " rm -f %s/%s.po; }; } &&\n", subdir, lang
}
END { print ":" }
' | WGET_COMMAND="$WGET_COMMAND" sh;;
esac &&
ls "$subdir"/*.po 2>/dev/null |
sed 's|.*/||; s|\.po$||' >"$subdir/LINGUAS" &&
rm -f "$subdir/$domain.html"
echo "$0: getting translations into $subdir for $domain..."
cmd=`printf "$po_download_command_format" "$domain" "$subdir"`
eval "$cmd"
}
case `wget --help` in
*'--no-cache'*)
WGET_COMMAND='wget -nv --no-cache';;
*'--cache=on/off'*)
WGET_COMMAND='wget -nv --cache=off';;
*'--non-verbose'*)
WGET_COMMAND='wget -nv';;
*)
WGET_COMMAND='';;
esac
# 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')
;;
'')
get_translations po $package || exit
if test -d po; then
update_po_files po $package || exit
fi
;;
'only')
get_translations po $package
if test -d po; then
update_po_files po $package || exit
fi
exit
;;
*.po)
get_translations po $package "$DOWNLOAD_PO"
exit
;;
*)
get_translations po $package "${DOWNLOAD_PO}.po"
exit
esac
# Get paxutils files.
@@ -336,28 +333,6 @@ copy_files() {
done
}
copy_files ${PAXUTILS_SRCDIR}/m4 m4
echo "$0: Creating m4/paxutils.m4"
(echo "# This file is generated automatically. Please, do not edit."
echo "#"
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
:
else
mkdir rmt
fi
for dir in doc rmt lib tests
do
copy_files ${PAXUTILS_SRCDIR}/$dir $dir
done
copy_files ${PAXUTILS_SRCDIR}/paxlib lib pax
# Get gnulib files.
case ${GNULIB_SRCDIR--} in
@@ -369,6 +344,12 @@ 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
@@ -385,6 +366,7 @@ symlink_to_gnulib()
test -f "$dst" &&
cmp -s "$src" "$dst" || {
echo "$0: cp -fp $src $dst" &&
ensure_dir_exists $dst &&
cp -fp "$src" "$dst"
}
else
@@ -407,6 +389,7 @@ symlink_to_gnulib()
esac
echo "$0: ln -fs $dot_dots$src $dst" &&
ensure_dir_exists $dst &&
ln -fs "$dot_dots$src" "$dst"
}
fi
@@ -589,6 +572,28 @@ 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."
echo "#"
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
:
else
mkdir rmt
fi
for dir in doc rmt lib tests
do
copy_files ${PAXUTILS_SRCDIR}/$dir $dir
done
copy_files ${PAXUTILS_SRCDIR}/paxlib lib pax
# Reconfigure, getting other files.

View File

@@ -1,10 +1,10 @@
# Bootstrap configuration.
# 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,
@@ -23,7 +23,6 @@
avoided_gnulib_modules='
--avoid=lock
--avoid=size_max
--avoid=xsize
'
# gnulib modules used by this package.
@@ -57,5 +56,4 @@ excluded_files='
m4/uintmax_t.m4
m4/ulonglong.m4
m4/visibility.m4
m4/xsize.m4
'

View File

@@ -1,11 +1,11 @@
# Configure template for GNU tar.
# Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006, 2007 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,7 +18,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
AC_INIT([GNU tar], [1.17], [bug-tar@gnu.org])
AC_INIT([GNU tar], [1.20], [bug-tar@gnu.org])
AC_CONFIG_SRCDIR([src/tar.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h:config.hin])
@@ -87,7 +87,7 @@ 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>])

View File

@@ -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'

View File

@@ -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

View File

@@ -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.3 2007/01/19 15:41:39 gray 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,23 +30,40 @@
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
(%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> -
with one web page per node.</li>
%%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
@@ -99,7 +116,7 @@ permitted in any medium, provided this notice is preserved.
<p>
Updated:
<!-- timestamp start -->
$Date: 2007/01/19 15:41:39 $ $Author: gray $
$Date: 2007/10/30 14:58:52 $ $Author: gray $
<!-- timestamp end -->
</p>
</div>

View File

@@ -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.
@@ -108,11 +106,11 @@ group permission could be copied from the @emph{other} permission.
The @code{uid} and @code{gid} fields are the numeric user and group
@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.
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

View File

@@ -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,

View File

@@ -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

View File

@@ -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

View 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

View File

@@ -35,7 +35,7 @@ This manual is for @acronym{GNU} @command{tar} (version
from archives.
Copyright @copyright{} 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -45,9 +45,9 @@ Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
and with the Back-Cover Texts as in (a) below. A copy of the license
is included in the section entitled "GNU Free Documentation License".
(a) The FSF's Back-Cover Text is: ``You are free to copy and modify
this GNU Manual. Buying copies from GNU Press supports the FSF in
developing GNU and promoting software freedom.''
(a) The FSF's Back-Cover Text is: ``You have the freedom to
copy and modify this GNU manual. Buying copies from the FSF
supports it in developing GNU and promoting software freedom.''
@end quotation
@end copying
@@ -109,6 +109,7 @@ Appendices
* Changes::
* Configuring Help Summary::
* Fixing Snapshot Files::
* Tar Internals::
* Genfile::
* Free Software Needs Free Documentation::
@@ -175,6 +176,7 @@ Invoking @GNUTAR{}
* help::
* defaults::
* verbose::
* checkpoints::
* interactive::
The Three Option Styles
@@ -315,15 +317,21 @@ Date input formats
Controlling the Archive Format
* Portability:: Making @command{tar} Archives More Portable
* Compression:: Using Less Space through Compression
* Attributes:: Handling File Attributes
* Portability:: Making @command{tar} Archives More Portable
* cpio:: Comparison of @command{tar} and @command{cpio}
Using Less Space through Compression
* gzip:: Creating and Reading Compressed Archives
* sparse:: Archiving Sparse Files
Making @command{tar} Archives More Portable
* Portable Names:: Portable Names
* dereference:: Symbolic Links
* hard links:: Hard Links
* old:: Old V7 Archives
* ustar:: Ustar Archives
* gnu:: GNU and old GNU format archives.
@@ -342,11 +350,6 @@ How to Extract GNU-Specific Data Using Other @command{tar} Implementations
* Split Recovery:: Members Split Between Volumes
* Sparse Recovery:: Sparse Members
Using Less Space through Compression
* gzip:: Creating and Reading Compressed Archives
* sparse:: Archiving Sparse Files
Tapes and Other Archive Media
* Device:: Device selection and switching
@@ -450,11 +453,8 @@ concepts of using a Unix-type operating system; @pxref{Tutorial}.)
The third chapter presents the remaining five operations, and
information about using @command{tar} options and option syntax.
@FIXME{this sounds more like a @acronym{GNU} Project Manuals Concept [tm] more
than the reality. should think about whether this makes sense to say
here, or not.} The other chapters are meant to be used as a
reference. Each chapter presents everything that needs to be said
about a specific topic.
The other chapters are meant to be used as a reference. Each chapter
presents everything that needs to be said about a specific topic.
One of the chapters (@pxref{Date input formats}) exists in its
entirety in other @acronym{GNU} manuals, and is mostly self-contained.
@@ -684,7 +684,7 @@ change between directories; and how to figure out where you are in the
file system. You should have some basic understanding of directory
structure and how files are named according to which directory they are
in. You should understand concepts such as standard output and standard
input, what various definitions of the term ``argument'' mean, and the
input, what various definitions of the term @samp{argument} mean, and the
differences between relative and absolute file names. @FIXME{and what
else?}
@@ -749,10 +749,9 @@ You can write most of the @command{tar} operations and options in any
of three forms: long (mnemonic) form, short form, and old style. Some
of the operations and options have no short or ``old'' forms; however,
the operations and options which we will cover in this tutorial have
corresponding abbreviations. @FIXME{make sure this is still the case,
at the end}We will indicate those abbreviations appropriately to get
you used to seeing them. (Note that the ``old style'' option forms
exist in @GNUTAR{} for compatibility with Unix
corresponding abbreviations. We will indicate those abbreviations
appropriately to get you used to seeing them. (Note that the ``old
style'' option forms exist in @GNUTAR{} for compatibility with Unix
@command{tar}. In this book we present a full discussion of this way
of writing options and operations (@pxref{Old Options}), and we discuss
the other two styles of writing options (@xref{Long Options}, and
@@ -1762,6 +1761,7 @@ use @w{@kbd{tar --list --verbose}} to list them correctly.
@node going further
@section Going Further Ahead in this Manual
@UNREVISED
@FIXME{need to write up a node here about the things that are going to
be in the rest of the manual.}
@@ -1800,6 +1800,7 @@ and @option{--interactive} options (@pxref{interactive}).
* help::
* defaults::
* verbose::
* checkpoints::
* interactive::
@end menu
@@ -2401,6 +2402,13 @@ a read-only loopback mount, or use the @samp{noatime} mount option
available on some systems. However, mounting typically requires
superuser privileges and can be a pain to manage.
@opsummary{auto-compress}
@item --auto-compress
@itemx -a
During a @option{--create} operation, enables automatic compressed
format recognition based on the archive suffix. @xref{gzip}.
@opsummary{backup}
@item --backup=@var{backup-type}
@@ -2429,14 +2437,63 @@ record. @xref{Blocking Factor}.
This option tells @command{tar} to read or write archives through
@code{bzip2}. @xref{gzip}.
@opsummary{check-device}
@item --check-device
Check device numbers when creating a list of modified files for
incremental archiving. This is the default. @xref{device numbers},
for a detailed description.
@opsummary{checkpoint}
@item --checkpoint[=@var{number}]
This option directs @command{tar} to print periodic checkpoint
messages as it reads through the archive. It is intended for when you
want a visual indication that @command{tar} is still running, but
don't want to see @option{--verbose} output. For a detailed
description, see @ref{Progress information}.
don't want to see @option{--verbose} output. You can also instruct
@command{tar} to execute a list of actions on each checkpoint, see
@option{--checklist-action} below. For a detailed description, see
@ref{checkpoints}.
@opsummary{checkpoint-action}
@item --checkpoint-action=@var{action}
Instruct @command{tar} to execute an action upon hitting a
breakpoint. Here we give only a brief outline. @xref{checkpoints},
for a complete description.
The @var{action} argument can be one of the following:
@table @asis
@item bell
Produce an audible bell on the console.
@item dot
@itemx .
Print a single dot on the standard listing stream.
@item echo
Display a textual message on the standard error, with the status and
number of the checkpoint. This is the default.
@item echo=@var{string}
Display @var{string} on the standard error. Before output, the string
is subject to meta-character expansion.
@item exec=@var{command}
Execute the given @var{command}.
@item sleep=@var{time}
Wait for @var{time} seconds.
@item ttyout=@var{string}
Output @var{string} on the current console (@file{/dev/tty}).
@end table
Several @option{--checkpoint-action} options can be specified. The
supplied actions will be executed in order of their appearance in the
command line.
Using @option{--checkpoint-action} without @option{--checkpoint}
assumes default checkpoint frequency of one checkpoint per 10 records.
@opsummary{check-links}
@item --check-links
@@ -2449,6 +2506,8 @@ synonym for @option{--one-file-system}. The current semantics, which
complies to UNIX98, was introduced with version
1.15.91. @xref{Changes}, for more information.}.
@xref{hard links}.
@opsummary{compress}
@opsummary{uncompress}
@item --compress
@@ -2537,7 +2596,15 @@ named @var{file}, but dump the directory node itself. @xref{exclude}.
@item --exclude-tag-all=@var{file}
Exclude from dump any directory containing file named @var{file}.
@xref{exclude}.
@xref{exclude}.
@opsummary{exclude-vcs}
@item --exclude-vcs
Exclude from dump directories and files, that are internal for some
widely used version control systems.
@xref{exclude}.
@opsummary{file}
@item --file=@var{archive}
@@ -2614,6 +2681,13 @@ This option tells @command{tar} to read or write archives through
@command{gzip}, allowing @command{tar} to directly operate on several
kinds of compressed archives transparently. @xref{gzip}.
@opsummary{hard-dereference}
@item --hard-dereference
When creating an archive, dereference hard links and store the files
they refer to, instead of creating usual hard link members.
@xref{hard links}.
@opsummary{help}
@item --help
@itemx -?
@@ -2709,6 +2783,12 @@ backup, using @var{snapshot-file} to determine which files to backup.
With other operations, informs @command{tar} that the archive is in
incremental format. @xref{Incremental Dumps}.
@opsummary{lzma}
@item --lzma
This option tells @command{tar} to read or write archives through
@command{lzma}. @xref{gzip}.
@opsummary{mode}
@item --mode=@var{permissions}
@@ -2763,6 +2843,12 @@ changed). @xref{after}.
An exclude pattern can match any subsequence of the name's components.
@xref{controlling pattern-matching}.
@opsummary{no-check-device}
@item --no-check-device
Do not check device numbers when creating a list of modified files
for incremental archiving. @xref{device numbers}, for
a detailed description.
@opsummary{no-delay-directory-restore}
@item --no-delay-directory-restore
@@ -2884,9 +2970,7 @@ Synonym for @option{--format=v7}.
@item --one-file-system
Used when creating an archive. Prevents @command{tar} from recursing into
directories that are on different file systems from the current
directory @footnote{Earlier versions of @GNUTAR{} understood @option{-l} as a
synonym for @option{--one-file-system}. This has changed in version
1.15.91. @xref{Changes}, for more information.}.
directory.
@opsummary{overwrite}
@item --overwrite
@@ -3365,7 +3449,7 @@ successfully. For example, @w{@samp{tar --version}} might print:
@smallexample
tar (GNU tar) @value{VERSION}
Copyright (C) 2006 Free Software Foundation, Inc.
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms
of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
@@ -3587,7 +3671,6 @@ after finishing the extraction, as well as when receiving signal
@anchor{Progress information}
@cindex Progress information
@opindex checkpoint
The @option{--checkpoint} option prints an occasional message
as @command{tar} reads or writes the archive. It is designed for
those who don't need the more detailed (and voluminous) output of
@@ -3605,13 +3688,19 @@ tar: Write checkpoint 3000
This example shows the default checkpoint message used by
@command{tar}. If you place a dot immediately after the equal
sign, it will print a @samp{.} at each checkpoint. For example:
sign, it will print a @samp{.} at each checkpoint@footnote{This is
actually a shortcut for @option{--checkpoint=@var{n}
--checkpoint-action=dot}. @xref{checkpoints, dot}.}. For example:
@smallexample
$ @kbd{tar -c --checkpoint=.1000} /var
...
@end smallexample
The @option{--checkpoint} option provides a flexible mechanism for
executing arbitrary actions upon hitting checkpoints, see the next
section (@pxref{checkpoints}), for more information on it.
@opindex show-omitted-dirs
@anchor{show-omitted-dirs}
The @option{--show-omitted-dirs} option, when reading an archive---with
@@ -3644,6 +3733,196 @@ choose among several backup tapes when retrieving a file later, in
favor of the tape where the file appears earliest (closest to the
front of the tape). @xref{backup}.
@node checkpoints
@section Checkpoints
@cindex checkpoints, defined
@opindex checkpoint
@opindex checkpoint-action
A @dfn{checkpoint} is a moment of time before writing @var{n}th record to
the archive (a @dfn{write checkpoint}), or before reading @var{n}th record
from the archive (a @dfn{read checkpoint}). Checkpoints allow to
periodically execute arbitrary actions.
The checkpoint facility is enabled using the following option:
@table @option
@xopindex{checkpoint, defined}
@item --checkpoint[=@var{n}]
Schedule checkpoints before writing or reading each @var{n}th record.
The default value for @var{n} is 10.
@end table
A list of arbitrary @dfn{actions} can be executed at each checkpoint.
These actions include: pausing, displaying textual messages, and
executing arbitrary external programs. Actions are defined using
the @option{--checkpoint-action} option.
@table @option
@xopindex{checkpoint-action, defined}
@item --checkpoint-action=@var{action}
Execute an @var{action} at each checkpoint.
@end table
@cindex @code{echo}, checkpoint action
The simplest value of @var{action} is @samp{echo}. It instructs
@command{tar} to display the default message on the standard error
stream upon arriving at each checkpoint. The default message is (in
@acronym{POSIX} locale) @samp{Write checkpoint @var{n}}, for write
checkpoints, and @samp{Read checkpoint @var{n}}, for read checkpoints.
Here, @var{n} represents ordinal number of the checkpoint.
In another locales, translated versions of this message are used.
This is the default action, so running:
@smallexample
$ @kbd{tar -c --checkpoint=1000 --checkpoint-action=echo} /var
@end smallexample
@noindent
is equivalent to:
@smallexample
$ @kbd{tar -c --checkpoint=1000} /var
@end smallexample
The @samp{echo} action also allows to supply a customized message.
You do so by placing an equals sign and the message right after it,
e.g.:
@smallexample
--checkpoint-action="echo=Hit %s checkpoint #%u"
@end smallexample
The @samp{%s} and @samp{%u} in the above example are
@dfn{meta-characters}. The @samp{%s} meta-character is replaced with
the @dfn{type} of the checkpoint: @samp{write} or
@samp{read} (or a corresponding translated version in locales other
than @acronym{POSIX}). The @samp{%u} meta-character is replaced with
the ordinal number of the checkpoint. Thus, the above example could
produce the following output when used with the @option{--create}
option:
@smallexample
tar: Hit write checkpoint #10
tar: Hit write checkpoint #20
tar: Hit write checkpoint #30
@end smallexample
Aside from meta-character expansion, the message string is subject to
@dfn{unquoting}, during which the backslash @dfn{escape sequences} are
replaced with their corresponding @acronym{ASCII} characters
(@pxref{escape sequences}). E.g. the following action will produce an
audible bell and the message described above at each checkpoint:
@smallexample
--checkpoint-action='echo=\aHit %s checkpoint #%u'
@end smallexample
@cindex @code{bell}, checkpoint action
There is also a special action which produces an audible signal:
@samp{bell}. It is not equivalent to @samp{echo='\a'}, because
@samp{bell} sends the bell directly to the console (@file{/dev/tty}),
whereas @samp{echo='\a'} sends it to the standard error.
@cindex @code{ttyout}, checkpoint action
The @samp{ttyout=@var{string}} action outputs @var{string} to
@file{/dev/tty}, so it can be used even if the standard output is
redirected elsewhere. The @var{string} is subject to the same
modifications as with @samp{echo} action. In contrast to the latter,
@samp{ttyout} does not prepend @command{tar} executable name to the
string, nor does it output a newline after it. For example, the
following action will print the checkpoint message at the same screen
line, overwriting any previous message:
@smallexample
--checkpoint-action="ttyout=\rHit %s checkpoint #%u"
@end smallexample
@cindex @code{dot}, checkpoint action
Another available checkpoint action is @samp{dot} (or @samp{.}). It
instructs @command{tar} to print a single dot on the standard listing
stream, e.g.:
@smallexample
$ @kbd{tar -c --checkpoint=1000 --checkpoint-action=dot} /var
...
@end smallexample
For compatibility with previous @GNUTAR{} versions, this action can
be abbreviated by placing a dot in front of the checkpoint frequency,
as shown in the previous section.
@cindex @code{sleep}, checkpoint action
Yet another action, @samp{sleep}, pauses @command{tar} for a specified
amount of seconds. The following example will stop for 30 seconds at each
checkpoint:
@smallexample
$ @kbd{tar -c --checkpoint=1000 --checkpoint-action=sleep=30}
@end smallexample
@cindex @code{exec}, checkpoint action
Finally, the @code{exec} action executes a given external program.
For example:
@smallexample
$ @kbd{tar -c --checkpoint=1000 --checkpoint-action=exec=/sbin/cpoint}
@end smallexample
This program is executed using @command{/bin/sh -c}, with no
additional arguments. Its exit code is ignored. It gets a copy of
@command{tar}'s environment plus the following variables:
@table @env
@vrindex TAR_VERSION, checkpoint script environment
@item TAR_VERSION
@GNUTAR{} version number.
@vrindex TAR_ARCHIVE, checkpoint script environment
@item TAR_ARCHIVE
The name of the archive @command{tar} is processing.
@vrindex TAR_BLOCKING_FACTOR, checkpoint script environment
@item TAR_BLOCKING_FACTOR
Current blocking factor (@pxref{Blocking}.
@vrindex TAR_CHECKPOINT, checkpoint script environment
@item TAR_CHECKPOINT
The checkpoint number.
@vrindex TAR_SUBCOMMAND, checkpoint script environment
@item TAR_SUBCOMMAND
A short option describing the operation @command{tar} is executing
@xref{Operations}, for a complete list of subcommand options.
@vrindex TAR_FORMAT, checkpoint script environment
@item TAR_FORMAT
Format of the archive being processed. @xref{Formats}, for a complete
list of archive format names.
@end table
Any number of actions can be defined, by supplying several
@option{--checkpoint-action} options in the command line. For
example, the command below displays two messages, pauses
execution for 30 seconds and executes the @file{/sbin/cpoint} script:
@example
@group
$ @kbd{tar -c -f arc.tar \
--checkpoint-action='\aecho=Hit %s checkpoint #%u' \
--checkpoint-action='echo=Sleeping for 30 seconds' \
--checkpoint-action='sleep=30' \
--checkpoint-action='exec=/sbin/cpoint'}
@end group
@end example
This example also illustrates the fact that
@option{--checkpoint-action} can be used without
@option{--checkpoint}. In this case, the default checkpoint frequency
(at each 10th record) is assumed.
@node interactive
@section Asking for Confirmation During Operations
@cindex Interactive operation
@@ -4865,7 +5144,7 @@ option is used.
The command can obtain the information about the file it processes
from the following environment variables:
@table @var
@table @env
@vrindex TAR_FILETYPE, to-command environment
@item TAR_FILETYPE
Type of the file. It is a single letter with the following meaning:
@@ -5406,15 +5685,40 @@ unreliable if you modify a file's time stamps during dumping (e.g.,
with the @option{--atime-preserve=replace} option), or if you set the clock
backwards.
@anchor{device numbers}
@cindex Device numbers, using in incremental backups
Metadata stored in snapshot files include device numbers, which,
obviously is supposed to be a non-volatile value. However, it turns
out that NFS devices have undependable values when an automounter
obviously are supposed to be a non-volatile values. However, it turns
out that @acronym{NFS} devices have undependable values when an automounter
gets in the picture. This can lead to a great deal of spurious
redumping in incremental dumps, so it is somewhat useless to compare
two NFS devices numbers over time. The solution implemented currently
is to considers all NFS devices as being equal when it comes to
comparing directories; this is fairly gross, but there does not seem
to be a better way to go.
two @acronym{NFS} devices numbers over time. The solution implemented
currently is to considers all @acronym{NFS} devices as being equal
when it comes to comparing directories; this is fairly gross, but
there does not seem to be a better way to go.
Apart from using @acronym{NFS}, there are a number of cases where
relying on device numbers can cause spurious redumping of unmodified
files. For example, this occurs when archiving @acronym{LVM} snapshot
volumes. To avoid this, use @option{--no-check-device} option:
@table @option
@xopindex{no-check-device, described}
@item --no-check-device
Do not rely on device numbers when preparing a list of changed files
for an incremental dump.
@xopindex{check-device, described}
@item --check-device
Use device numbers when preparing a list of changed files
for an incremental dump. This is the default behavior. The purpose
of this option is to undo the effect of the @option{--no-check-device}
if it was given in @env{TAR_OPTIONS} environment variable
(@pxref{TAR_OPTIONS}).
@end table
There is also another way to cope with changing device numbers. It is
described in detail in @ref{Fixing Snapshot Files}.
Note that incremental archives use @command{tar} extensions and may
not be readable by non-@acronym{GNU} versions of the @command{tar} program.
@@ -5625,7 +5929,7 @@ their support files using the same file name that is used on the
machine where the scripts are run (i.e., what @command{pwd} will print
when in that directory on that machine). If the host that contains
the file system does not have this capability, you can specify another
host as long as it can access the file system through NFS.
host as long as it can access the file system through @acronym{NFS}.
If the list of file systems is very long you may wish to put it
in a separate file. This file is usually named
@@ -6499,6 +6803,42 @@ called as @w{@samp{tar -c -X foo .}} and the file @file{foo} contains a
single line @file{*.o}, no files whose names end in @file{.o} will be
added to the archive.
Notice, that lines from @var{file} are read verbatim. One of the
frequent errors is leaving some extra whitespace after a file name,
which is difficult to catch using text editors.
However, empty lines are OK.
@cindex version control system, excluding files
@cindex VCS, excluding files
@cindex SCCS, excluding files
@cindex RCS, excluding files
@cindex CVS, excluding files
@cindex SVN, excluding files
@cindex git, excluding files
@table @option
@opindex exclude-vcs
@item --exclude-vcs
Exclude files and directories used by some version control systems.
@end table
As of version @value{VERSION}, the following files are excluded:
@itemize @bullet
@item @file{CVS/}, and everything under it
@item @file{RCS/}, and everything under it
@item @file{SCCS/}, and everything under it
@item @file{.git/}, and everything under it
@item @file{.gitignore}
@item @file{.cvsignore}
@item @file{.svn/}, and everything under it
@item @file{.arch-ids/}, and everything under it
@item @file{@{arch@}/}, and everything under it
@item @file{=RELEASE-ID}
@item @file{=meta-update}
@item @file{=update}
@end itemize
@findex exclude-caches
When creating an archive, the @option{--exclude-caches} option family
causes @command{tar} to exclude all directories that contain a @dfn{cache
@@ -6509,7 +6849,7 @@ Various applications write cache directory tags into directories they
use to hold regenerable, non-precious data, so that such data can be
more easily excluded from backups.
There are three @samp{exclude-caches} option, providing a different
There are three @samp{exclude-caches} options, each providing a different
exclusion semantics:
@table @option
@@ -6884,7 +7224,7 @@ quoting}. The characters in question are:
@itemize @bullet
@item Non-printable control characters:
@anchor{escape sequences}
@multitable @columnfractions 0.20 0.10 0.60
@headitem Character @tab @acronym{ASCII} @tab Character name
@item \a @tab 7 @tab Audible bell
@@ -6972,7 +7312,7 @@ $ @kbd{tar tf arch.tar --quoting-style=literal}
./a'single'quote
./a"double"quote
./a\backslash
./a tab
./a tab
./a
newline
@end group
@@ -6994,7 +7334,7 @@ $ @kbd{tar tf arch.tar --quoting-style=shell}
'./a'\''single'\''quote'
'./a"double"quote'
'./a\backslash'
'./a tab'
'./a tab'
'./a
newline'
@end group
@@ -7012,7 +7352,7 @@ $ @kbd{tar tf arch.tar --quoting-style=shell-always}
'./a'\''single'\''quote'
'./a"double"quote'
'./a\backslash'
'./a tab'
'./a tab'
'./a
newline'
@end group
@@ -7253,6 +7593,9 @@ replacement for each file name part that matches @var{regexp}. Both
@var{regexp} and @var{replace} are described in detail in
@ref{The "s" Command, The "s" Command, The `s' Command, sed, GNU sed}.
As in @command{sed}, you can give several replace expressions,
separated by a semicolon.
Supported @var{flags} are:
@table @samp
@@ -7346,6 +7689,18 @@ If both @option{--strip-components} and @option{--transform} are used
together, then @option{--transform} is applied first, and the required
number of components is then stripped from its result.
You can use as many @option{--transform} options in a single command
line as you want. The specified expressions will then be applied in
order of their appearance. For example, the following two invocations
are equivalent:
@smallexample
$ @kbd{tar -cf arch.tar --transform='s,/usr/var,/var/' \
--transform='s,/usr/local,/usr/,'}
$ @kbd{tar -cf arch.tar \
--transform='s,/usr/var,/var/;s,/usr/local,/usr/,'}
@end smallexample
@node after
@section Operating Only on New Files
@UNREVISED
@@ -7890,18 +8245,18 @@ switch to @samp{posix}.
@cindex Storing archives in compressed format
@GNUTAR{} is able to create and read compressed archives. It supports
@command{gzip} and @command{bzip2} compression programs. For backward
compatibility, it also supports @command{compress} command, although
we strongly recommend against using it, since there is a patent
covering the algorithm it uses and you could be sued for patent
infringement merely by running @command{compress}! Besides, it is less
effective than @command{gzip} and @command{bzip2}.
@command{gzip}, @command{bzip2} and @command{lzma} compression
programs. For backward compatibility, it also supports
@command{compress} command, although we strongly recommend against
using it, because it is by far less effective than other compression
programs@footnote{It also had patent problems in the past.}.
Creating a compressed archive is simple: you just specify a
@dfn{compression option} along with the usual archive creation
commands. The compression option is @option{-z} (@option{--gzip}) to
create a @command{gzip} compressed archive, @option{-j}
(@option{--bzip2}) to create a @command{bzip2} compressed archive, and
(@option{--bzip2}) to create a @command{bzip2} compressed archive,
@option{--lzma} to create an @asis{LZMA} compressed archive and
@option{-Z} (@option{--compress}) to use @command{compress} program.
For example:
@@ -7909,6 +8264,26 @@ For example:
$ @kbd{tar cfz archive.tar.gz .}
@end smallexample
You can also let @GNUTAR{} select the compression program basing on
the suffix of the archive file name. This is done using
@option{--auto-compress} (@option{-a}) command line option. For
example, the following invocation will use @command{bzip2} for
compression:
@smallexample
$ @kbd{tar cfa archive.tar.bz2 .}
@end smallexample
@noindent
whereas the following one will use @command{lzma}:
@smallexample
$ @kbd{tar cfa archive.tar.lzma .}
@end smallexample
For a complete list of file name suffixes recognized by @GNUTAR{},
@ref{auto-compress}.
Reading compressed archive is even simpler: you don't need to specify
any additional options as @GNUTAR{} recognizes its format
automatically. Thus, the following commands will list and extract the
@@ -7941,15 +8316,38 @@ $ @kbd{cat archive.tar.gz | tar tfz -}
Notice also, that there are several restrictions on operations on
compressed archives. First of all, compressed archives cannot be
modified, i.e., you cannot update (@option{--update} (@option{-u})) them or delete
(@option{--delete}) members from them. Likewise, you cannot append
another @command{tar} archive to a compressed archive using
@option{--append} (@option{-r})). Secondly, multi-volume archives cannot be
compressed.
modified, i.e., you cannot update (@option{--update} (@option{-u}))
them or delete (@option{--delete}) members from them or
add (@option{--append} (@option{-r})) members to them. Likewise, you
cannot append another @command{tar} archive to a compressed archive using
@option{--concatenate} (@option{-A})). Secondly, multi-volume
archives cannot be compressed.
The following table summarizes compression options used by @GNUTAR{}.
@table @option
@anchor{auto-compress}
@opindex auto-compress
@item --auto-compress
@itemx -a
Select a compression program to use by the archive file name
suffix. The following suffixes are recognized:
@multitable @columnfractions 0.3 0.6
@headitem Suffix @tab Compression program
@item @samp{.gz} @tab @command{gzip}
@item @samp{.tgz} @tab @command{gzip}
@item @samp{.taz} @tab @command{gzip}
@item @samp{.Z} @tab @command{compress}
@item @samp{.taZ} @tab @command{compress}
@item @samp{.bz2} @tab @command{bzip2}
@item @samp{.tz2} @tab @command{bzip2}
@item @samp{.tbz2} @tab @command{bzip2}
@item @samp{.tbz} @tab @command{bzip2}
@item @samp{.lzma} @tab @command{lzma}
@item @samp{.tlz} @tab @command{lzma}
@end multitable
@opindex gzip
@opindex ungzip
@item -z
@@ -7996,6 +8394,10 @@ So, there are pros and cons. We'll see!
@itemx --bzip2
Filter the archive through @code{bzip2}. Otherwise like @option{--gzip}.
@opindex lzma
@item --lzma
Filter the archive through @command{lzma}. Otherwise like @option{--gzip}.
@opindex compress
@opindex uncompress
@item -Z
@@ -8003,11 +8405,6 @@ Filter the archive through @code{bzip2}. Otherwise like @option{--gzip}.
@itemx --uncompress
Filter the archive through @command{compress}. Otherwise like @option{--gzip}.
The @acronym{GNU} Project recommends you not use
@command{compress}, because there is a patent covering the algorithm it
uses. You could be sued for patent infringement merely by running
@command{compress}.
@opindex use-compress-program
@item --use-compress-program=@var{prog}
Use external compression program @var{prog}. Use this option if you
@@ -8357,6 +8754,7 @@ archives and archive labels) in GNU and PAX formats.}
@menu
* Portable Names:: Portable Names
* dereference:: Symbolic Links
* hard links:: Hard Links
* old:: Old V7 Archives
* ustar:: Ustar Archives
* gnu:: GNU and old GNU format archives.
@@ -8414,6 +8812,100 @@ and use @option{--dereference} (@option{-h}): many systems do not support
symbolic links, and moreover, your distribution might be unusable if
it contains unresolved symbolic links.
@node hard links
@subsection Hard Links
@UNREVISED{}
@cindex File names, using hard links
@cindex hard links, dereferencing
@cindex dereferencing hard links
Normally, when @command{tar} archives a hard link, it writes a
block to the archive naming the target of the link (a @samp{1} type
block). In that way, the actual file contents is stored in file only
once. For example, consider the following two files:
@smallexample
@group
$ ls
-rw-r--r-- 2 gray staff 4 2007-10-30 15:11 one
-rw-r--r-- 2 gray staff 4 2007-10-30 15:11 jeden
@end group
@end smallexample
Here, @file{jeden} is a link to @file{one}. When archiving this
directory with a verbose level 2, you will get an output similar to
the following:
@smallexample
$ tar cfvv ../archive.tar .
drwxr-xr-x gray/staff 0 2007-10-30 15:13 ./
-rw-r--r-- gray/staff 4 2007-10-30 15:11 ./jeden
hrw-r--r-- gray/staff 0 2007-10-30 15:11 ./one link to ./jeden
@end smallexample
The last line shows that, instead of storing two copies of the file,
@command{tar} stored it only once, under the name @file{jeden}, and
stored file @file{one} as a hard link to this file.
It may be important to know that all hard links to the given file are
stored in the archive. For example, this may be necessary for exact
reproduction of the file system. The following option does that:
@table @option
@xopindex{check-links, described}
@item --check-links
@itemx -l
Check the number of links dumped for each processed file. If this
number does not match the total number of hard links for the file, print
a warning message.
@end table
For example, trying to archive only file @file{jeden} with this option
produces the following diagnostics:
@smallexample
$ tar -c -f ../archive.tar jeden
tar: Missing links to `jeden'.
@end smallexample
Although creating special records for hard links helps keep a faithful
record of the file system contents and makes archives more compact, it
may present some difficulties when extracting individual members from
the archive. For example, trying to extract file @file{one} from the
archive created in previous examples produces, in the absense of file
@file{jeden}:
@smallexample
$ tar xf archive.tar ./one
tar: ./one: Cannot hard link to `./jeden': No such file or directory
tar: Error exit delayed from previous errors
@end smallexample
The reason for this behavior is that @command{tar} cannot seek back in
the archive to the previous member (in this case, @file{one}), to
extract it@footnote{There are plans to fix this in future releases.}.
If you wish to avoid such problems at the cost of a bigger archive,
use the following option:
@table @option
@xopindex{hard-dereference, described}
@item --hard-dereference
Dereference hard links and store the files they refer to.
@end table
For example, trying this option on our two sample files, we get two
copies in the archive, each of which can then be extracted
independently of the other:
@smallexample
@group
$ tar -c -vv -f ../archive.tar --hard-dereference .
drwxr-xr-x gray/staff 0 2007-10-30 15:13 ./
-rw-r--r-- gray/staff 4 2007-10-30 15:11 ./jeden
-rw-r--r-- gray/staff 4 2007-10-30 15:11 ./one
@end group
@end smallexample
@node old
@subsection Old V7 Archives
@cindex Format, old style
@@ -8540,7 +9032,7 @@ from @var{string} after making the following substitutions:
result of the @command{dirname} utility on the translated file name.
@item %f @tab The name of the file with the directory information
stripped, equivalent to the result of the @command{basename} utility
on the translated file name.
on the translated file name.
@item %p @tab The process @acronym{ID} of the @command{tar} process.
@item %% @tab A @samp{%} character.
@end multitable
@@ -10203,13 +10695,17 @@ environment variables:
@item TAR_ARCHIVE
The name of the archive @command{tar} is processing.
@vrindex TAR_BLOCKING_FACTOR, info script environment variable
@item TAR_BLOCKING_FACTOR
Current blocking factor (@pxref{Blocking}.
@vrindex TAR_VOLUME, info script environment variable
@item TAR_VOLUME
Ordinal number of the volume @command{tar} is about to start.
@vrindex TAR_SUBCOMMAND, info script environment variable
@item TAR_SUBCOMMAND
Short option describing the operation @command{tar} is executing
A short option describing the operation @command{tar} is executing
@xref{Operations}, for a complete list of subcommand options.
@vrindex TAR_FORMAT, info script environment variable
@@ -10264,7 +10760,7 @@ name=`expr $TAR_ARCHIVE : '\(.*\)-.*'`
case $TAR_SUBCOMMAND in
-c) ;;
-d|-x|-t) test -r $@{name:-$TAR_ARCHIVE@}-$TAR_VOLUME || exit 1
;;
;;
*) exit 1
esac
@@ -10272,7 +10768,7 @@ echo $@{name:-$TAR_ARCHIVE@}-$TAR_VOLUME >&$TAR_FD
@end group
@end smallexample
The same script cant be used while listing, comparing or extracting
The same script can be used while listing, comparing or extracting
from the created archive. For example:
@smallexample
@@ -10914,6 +11410,10 @@ output. Default is 12.
Right margin of the text output. Used for wrapping.
@end deftypevr
@node Fixing Snapshot Files
@appendix Fixing Snapshot Files
@include tar-snapshot-edit.texi
@node Tar Internals
@appendix Tar Internals
@include intern.texi

View File

@@ -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
View 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)

View File

@@ -13,6 +13,7 @@ exclude
exitfail
fileblocks
fnmatch-gnu
fseeko
ftruncate
full-write
getdate
@@ -38,6 +39,7 @@ safe-read
save-cwd
savedir
setenv
snprintf
stat-time
stdbool
stdint

View File

@@ -1,13 +1,10 @@
.cvsignore
.deps
Makefile
Makefile.in
__fpending.c
__fpending.h
alloca.c
alloca_.h
allocsa.c
allocsa.h
allocsa.valgrind
alloca.h
alloca.in.h
argmatch.c
argmatch.h
argp-ba.c
@@ -28,6 +25,9 @@ at-func.c
backupfile.c
backupfile.h
basename.c
canonicalize-lgpl.c
canonicalize.h
charset.alias
chdir-long.c
chdir-long.h
chown.c
@@ -36,44 +36,58 @@ close-stream.h
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
error.c
error.h
exclude.c
exclude.h
exitfail.c
exitfail.h
fchdir.c
fchmodat.c
fchown-stub.c
fchownat.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
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
@@ -87,14 +101,18 @@ imaxtostr.c
intprops.h
inttostr.c
inttostr.h
inttypes_.h
inttypes.h
inttypes.in.h
lchown.c
lchown.h
localcharset.c
localcharset.h
lseek.c
lstat.c
lstat.h
malloc.c
malloca.c
malloca.h
malloca.valgrind
mbchar.c
mbchar.h
mbscasecmp.c
@@ -117,6 +135,7 @@ openat-priv.h
openat-proc.c
openat.c
openat.h
pathmax.h
paxerror.c
paxexit.c
paxlib.h
@@ -124,12 +143,17 @@ paxnames.c
pipe-safer.c
printf-args.c
printf-args.h
printf-parse.c
printf-parse.h
quote.c
quote.h
quotearg.c
quotearg.h
readlink.c
realloc.c
ref-add.sed
ref-add.sin
ref-del.sed
ref-del.sin
regcomp.c
regex.c
@@ -138,6 +162,7 @@ regex_internal.c
regex_internal.h
regexec.c
rmdir.c
rmt-command.h
rmt.h
rpmatch.c
rtapelib.c
@@ -153,18 +178,26 @@ savedir.h
setenv.c
setenv.h
sleep.c
snprintf.c
stat-macros.h
stat-time.h
stdbool_.h
stdint_.h
stdio_.h
stdlib_.h
stdbool.h
stdbool.in.h
stdint.h
stdint.in.h
stdio.h
stdio.in.h
stdlib.h
stdlib.in.h
stpcpy.c
strcasecmp.c
strchrnul.c
strdup.c
streq.h
strerror.c
string_.h
string.h
string.in.h
strings.in.h
stripslash.c
strncasecmp.c
strndup.c
@@ -177,21 +210,30 @@ strtoll.c
strtoul.c
strtoull.c
strtoumax.c
sys_stat_.h
sys_time_.h
sysexits_.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.h
time.in.h
time_r.c
timespec.h
uinttostr.c
umaxtostr.c
unistd--.h
unistd-safer.h
unistd_.h
unistd.h
unistd.in.h
unitypes.h
uniwidth
uniwidth.h
unlinkdir.c
unlinkdir.h
unlocked-io.h
@@ -199,22 +241,27 @@ unsetenv.c
utime.c
utimens.c
utimens.h
vasnprintf.c
vasnprintf.h
verify.h
version-etc-fsf.c
version-etc.c
version-etc.h
vsnprintf.c
wchar_.h
wctype_.h
wcwidth.h
wchar.h
wchar.in.h
wctype.h
wctype.in.h
wcwidth.c
xalloc-die.c
xalloc.h
xgetcwd.c
xgetcwd.h
xmalloc.c
xsize.h
xstrndup.c
xstrndup.h
xstrtol-error.c
xstrtol.c
xstrtol.h
xstrtoul.c

View File

@@ -1,11 +1,11 @@
# Makefile for GNU tar library. -*- Makefile -*-
# Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2003, 2004,
# 2005, 2006 Free Software Foundation, Inc.
# 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 of the License, or
# 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,

View File

@@ -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,

View File

@@ -1,535 +0,0 @@
/* Formatted output to strings.
Copyright (C) 1999-2000, 2002-2004, 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. */
#include <config.h>
/* Specification. */
#if WIDE_CHAR_VERSION
# include "wprintf-parse.h"
#else
# include "printf-parse.h"
#endif
/* Get size_t, NULL. */
#include <stddef.h>
/* Get intmax_t. */
#if HAVE_STDINT_H_WITH_UINTMAX
# include <stdint.h>
#endif
#if HAVE_INTTYPES_H_WITH_UINTMAX
# include <inttypes.h>
#endif
/* malloc(), realloc(), free(). */
#include <stdlib.h>
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
#endif
#if WIDE_CHAR_VERSION
# define PRINTF_PARSE wprintf_parse
# define CHAR_T wchar_t
# define DIRECTIVE wchar_t_directive
# define DIRECTIVES wchar_t_directives
#else
# define PRINTF_PARSE printf_parse
# define CHAR_T char
# define DIRECTIVE char_directive
# define DIRECTIVES char_directives
#endif
#ifdef STATIC
STATIC
#endif
int
PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
{
const CHAR_T *cp = format; /* pointer into format */
size_t arg_posn = 0; /* number of regular arguments consumed */
size_t d_allocated; /* allocated elements of d->dir */
size_t a_allocated; /* allocated elements of a->arg */
size_t max_width_length = 0;
size_t max_precision_length = 0;
d->count = 0;
d_allocated = 1;
d->dir = malloc (d_allocated * sizeof (DIRECTIVE));
if (d->dir == NULL)
/* Out of memory. */
return -1;
a->count = 0;
a_allocated = 0;
a->arg = NULL;
#define REGISTER_ARG(_index_,_type_) \
{ \
size_t n = (_index_); \
if (n >= a_allocated) \
{ \
size_t memory_size; \
argument *memory; \
\
a_allocated *= 2; \
if (a_allocated <= n) \
a_allocated = n + 1; \
if (SIZE_MAX / sizeof (argument) < a_allocated) \
/* Overflow, would lead to out of memory. */ \
goto error; \
memory_size = a_allocated * sizeof (argument); \
memory = (a->arg \
? realloc (a->arg, memory_size) \
: malloc (memory_size)); \
if (memory == NULL) \
/* Out of memory. */ \
goto error; \
a->arg = memory; \
} \
while (a->count <= n) \
a->arg[a->count++].type = TYPE_NONE; \
if (a->arg[n].type == TYPE_NONE) \
a->arg[n].type = (_type_); \
else if (a->arg[n].type != (_type_)) \
/* Ambiguous type for positional argument. */ \
goto error; \
}
while (*cp != '\0')
{
CHAR_T c = *cp++;
if (c == '%')
{
size_t arg_index = ARG_NONE;
DIRECTIVE *dp = &d->dir[d->count];/* pointer to next directive */
/* Initialize the next directive. */
dp->dir_start = cp - 1;
dp->flags = 0;
dp->width_start = NULL;
dp->width_end = NULL;
dp->width_arg_index = ARG_NONE;
dp->precision_start = NULL;
dp->precision_end = NULL;
dp->precision_arg_index = ARG_NONE;
dp->arg_index = ARG_NONE;
/* Test for positional argument. */
if (*cp >= '0' && *cp <= '9')
{
const CHAR_T *np;
for (np = cp; *np >= '0' && *np <= '9'; np++)
;
if (*np == '$')
{
size_t n = 0;
for (np = cp; *np >= '0' && *np <= '9'; np++)
if (n < SIZE_MAX / 10)
n = 10 * n + (*np - '0');
else
/* n too large for memory. */
goto error;
if (n == 0)
/* Positional argument 0. */
goto error;
arg_index = n - 1;
cp = np + 1;
}
}
/* Read the flags. */
for (;;)
{
if (*cp == '\'')
{
dp->flags |= FLAG_GROUP;
cp++;
}
else if (*cp == '-')
{
dp->flags |= FLAG_LEFT;
cp++;
}
else if (*cp == '+')
{
dp->flags |= FLAG_SHOWSIGN;
cp++;
}
else if (*cp == ' ')
{
dp->flags |= FLAG_SPACE;
cp++;
}
else if (*cp == '#')
{
dp->flags |= FLAG_ALT;
cp++;
}
else if (*cp == '0')
{
dp->flags |= FLAG_ZERO;
cp++;
}
else
break;
}
/* Parse the field width. */
if (*cp == '*')
{
dp->width_start = cp;
cp++;
dp->width_end = cp;
if (max_width_length < 1)
max_width_length = 1;
/* Test for positional argument. */
if (*cp >= '0' && *cp <= '9')
{
const CHAR_T *np;
for (np = cp; *np >= '0' && *np <= '9'; np++)
;
if (*np == '$')
{
size_t n = 0;
for (np = cp; *np >= '0' && *np <= '9'; np++)
if (n < SIZE_MAX / 10)
n = 10 * n + (*np - '0');
else
/* n too large for memory. */
goto error;
if (n == 0)
/* Positional argument 0. */
goto error;
dp->width_arg_index = n - 1;
cp = np + 1;
}
}
if (dp->width_arg_index == ARG_NONE)
{
dp->width_arg_index = arg_posn++;
if (dp->width_arg_index == ARG_NONE)
/* arg_posn wrapped around. */
goto error;
}
REGISTER_ARG (dp->width_arg_index, TYPE_INT);
}
else if (*cp >= '0' && *cp <= '9')
{
size_t width_length;
dp->width_start = cp;
for (; *cp >= '0' && *cp <= '9'; cp++)
;
dp->width_end = cp;
width_length = dp->width_end - dp->width_start;
if (max_width_length < width_length)
max_width_length = width_length;
}
/* Parse the precision. */
if (*cp == '.')
{
cp++;
if (*cp == '*')
{
dp->precision_start = cp - 1;
cp++;
dp->precision_end = cp;
if (max_precision_length < 2)
max_precision_length = 2;
/* Test for positional argument. */
if (*cp >= '0' && *cp <= '9')
{
const CHAR_T *np;
for (np = cp; *np >= '0' && *np <= '9'; np++)
;
if (*np == '$')
{
size_t n = 0;
for (np = cp; *np >= '0' && *np <= '9'; np++)
if (n < SIZE_MAX / 10)
n = 10 * n + (*np - '0');
else
/* n too large for memory. */
goto error;
if (n == 0)
/* Positional argument 0. */
goto error;
dp->precision_arg_index = n - 1;
cp = np + 1;
}
}
if (dp->precision_arg_index == ARG_NONE)
{
dp->precision_arg_index = arg_posn++;
if (dp->precision_arg_index == ARG_NONE)
/* arg_posn wrapped around. */
goto error;
}
REGISTER_ARG (dp->precision_arg_index, TYPE_INT);
}
else
{
size_t precision_length;
dp->precision_start = cp - 1;
for (; *cp >= '0' && *cp <= '9'; cp++)
;
dp->precision_end = cp;
precision_length = dp->precision_end - dp->precision_start;
if (max_precision_length < precision_length)
max_precision_length = precision_length;
}
}
{
arg_type type;
/* Parse argument type/size specifiers. */
{
int flags = 0;
for (;;)
{
if (*cp == 'h')
{
flags |= (1 << (flags & 1));
cp++;
}
else if (*cp == 'L')
{
flags |= 4;
cp++;
}
else if (*cp == 'l')
{
flags += 8;
cp++;
}
#ifdef HAVE_INTMAX_T
else if (*cp == 'j')
{
if (sizeof (intmax_t) > sizeof (long))
{
/* intmax_t = long long */
flags += 16;
}
else if (sizeof (intmax_t) > sizeof (int))
{
/* intmax_t = long */
flags += 8;
}
cp++;
}
#endif
else if (*cp == 'z' || *cp == 'Z')
{
/* 'z' is standardized in ISO C 99, but glibc uses 'Z'
because the warning facility in gcc-2.95.2 understands
only 'Z' (see gcc-2.95.2/gcc/c-common.c:1784). */
if (sizeof (size_t) > sizeof (long))
{
/* size_t = long long */
flags += 16;
}
else if (sizeof (size_t) > sizeof (int))
{
/* size_t = long */
flags += 8;
}
cp++;
}
else if (*cp == 't')
{
if (sizeof (ptrdiff_t) > sizeof (long))
{
/* ptrdiff_t = long long */
flags += 16;
}
else if (sizeof (ptrdiff_t) > sizeof (int))
{
/* ptrdiff_t = long */
flags += 8;
}
cp++;
}
else
break;
}
/* Read the conversion character. */
c = *cp++;
switch (c)
{
case 'd': case 'i':
#ifdef HAVE_LONG_LONG
if (flags >= 16 || (flags & 4))
type = TYPE_LONGLONGINT;
else
#endif
if (flags >= 8)
type = TYPE_LONGINT;
else if (flags & 2)
type = TYPE_SCHAR;
else if (flags & 1)
type = TYPE_SHORT;
else
type = TYPE_INT;
break;
case 'o': case 'u': case 'x': case 'X':
#ifdef HAVE_LONG_LONG
if (flags >= 16 || (flags & 4))
type = TYPE_ULONGLONGINT;
else
#endif
if (flags >= 8)
type = TYPE_ULONGINT;
else if (flags & 2)
type = TYPE_UCHAR;
else if (flags & 1)
type = TYPE_USHORT;
else
type = TYPE_UINT;
break;
case 'f': case 'F': case 'e': case 'E': case 'g': case 'G':
case 'a': case 'A':
#ifdef HAVE_LONG_DOUBLE
if (flags >= 16 || (flags & 4))
type = TYPE_LONGDOUBLE;
else
#endif
type = TYPE_DOUBLE;
break;
case 'c':
if (flags >= 8)
#ifdef HAVE_WINT_T
type = TYPE_WIDE_CHAR;
#else
goto error;
#endif
else
type = TYPE_CHAR;
break;
#ifdef HAVE_WINT_T
case 'C':
type = TYPE_WIDE_CHAR;
c = 'c';
break;
#endif
case 's':
if (flags >= 8)
#ifdef HAVE_WCHAR_T
type = TYPE_WIDE_STRING;
#else
goto error;
#endif
else
type = TYPE_STRING;
break;
#ifdef HAVE_WCHAR_T
case 'S':
type = TYPE_WIDE_STRING;
c = 's';
break;
#endif
case 'p':
type = TYPE_POINTER;
break;
case 'n':
#ifdef HAVE_LONG_LONG
if (flags >= 16 || (flags & 4))
type = TYPE_COUNT_LONGLONGINT_POINTER;
else
#endif
if (flags >= 8)
type = TYPE_COUNT_LONGINT_POINTER;
else if (flags & 2)
type = TYPE_COUNT_SCHAR_POINTER;
else if (flags & 1)
type = TYPE_COUNT_SHORT_POINTER;
else
type = TYPE_COUNT_INT_POINTER;
break;
case '%':
type = TYPE_NONE;
break;
default:
/* Unknown conversion character. */
goto error;
}
}
if (type != TYPE_NONE)
{
dp->arg_index = arg_index;
if (dp->arg_index == ARG_NONE)
{
dp->arg_index = arg_posn++;
if (dp->arg_index == ARG_NONE)
/* arg_posn wrapped around. */
goto error;
}
REGISTER_ARG (dp->arg_index, type);
}
dp->conversion = c;
dp->dir_end = cp;
}
d->count++;
if (d->count >= d_allocated)
{
DIRECTIVE *memory;
if (SIZE_MAX / (2 * sizeof (DIRECTIVE)) < d_allocated)
/* Overflow, would lead to out of memory. */
goto error;
d_allocated *= 2;
memory = realloc (d->dir, d_allocated * sizeof (DIRECTIVE));
if (memory == NULL)
/* Out of memory. */
goto error;
d->dir = memory;
}
}
}
d->dir[d->count].dir_start = cp;
d->max_width_length = max_width_length;
d->max_precision_length = max_precision_length;
return 0;
error:
if (a->arg)
free (a->arg);
if (d->dir)
free (d->dir);
return -1;
}
#undef DIRECTIVES
#undef DIRECTIVE
#undef CHAR_T
#undef PRINTF_PARSE

View File

@@ -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,

View File

@@ -1,918 +0,0 @@
/* vsprintf with automatic memory allocation.
Copyright (C) 1999, 2002-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. */
/* Tell glibc's <stdio.h> to provide a prototype for snprintf().
This must come before <config.h> because <config.h> may include
<features.h>, and once <features.h> has been included, it's too late. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
#include <config.h>
#ifndef IN_LIBINTL
# include <alloca.h>
#endif
/* Specification. */
#if WIDE_CHAR_VERSION
# include "vasnwprintf.h"
#else
# include "vasnprintf.h"
#endif
#include <stdio.h> /* snprintf(), sprintf() */
#include <stdlib.h> /* abort(), malloc(), realloc(), free() */
#include <string.h> /* memcpy(), strlen() */
#include <errno.h> /* errno */
#include <limits.h> /* CHAR_BIT, INT_MAX */
#include <float.h> /* DBL_MAX_EXP, LDBL_MAX_EXP */
#if WIDE_CHAR_VERSION
# include "wprintf-parse.h"
#else
# include "printf-parse.h"
#endif
#ifndef SIZE_MAX
# define SIZE_MAX ((size_t) -1)
#endif
/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */
#ifndef EOVERFLOW
# define EOVERFLOW E2BIG
#endif
#ifdef HAVE_WCHAR_T
# ifdef HAVE_WCSLEN
# define local_wcslen wcslen
# else
/* Solaris 2.5.1 has wcslen() in a separate library libw.so. To avoid
a dependency towards this library, here is a local substitute.
Define this substitute only once, even if this file is included
twice in the same compilation unit. */
# ifndef local_wcslen_defined
# define local_wcslen_defined 1
static size_t
local_wcslen (const wchar_t *s)
{
const wchar_t *ptr;
for (ptr = s; *ptr != (wchar_t) 0; ptr++)
;
return ptr - s;
}
# endif
# endif
#endif
#if WIDE_CHAR_VERSION
# define VASNPRINTF vasnwprintf
# define CHAR_T wchar_t
# define DIRECTIVE wchar_t_directive
# define DIRECTIVES wchar_t_directives
# define PRINTF_PARSE wprintf_parse
# define USE_SNPRINTF 1
# if HAVE_DECL__SNWPRINTF
/* On Windows, the function swprintf() has a different signature than
on Unix; we use the _snwprintf() function instead. */
# define SNPRINTF _snwprintf
# else
/* Unix. */
# define SNPRINTF swprintf
# endif
#else
# define VASNPRINTF vasnprintf
# define CHAR_T char
# define DIRECTIVE char_directive
# define DIRECTIVES char_directives
# define PRINTF_PARSE printf_parse
# define USE_SNPRINTF (HAVE_DECL__SNPRINTF || HAVE_SNPRINTF)
# if HAVE_DECL__SNPRINTF
/* Windows. */
# define SNPRINTF _snprintf
# else
/* Unix. */
# define SNPRINTF snprintf
# endif
#endif
CHAR_T *
VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list args)
{
DIRECTIVES d;
arguments a;
if (PRINTF_PARSE (format, &d, &a) < 0)
{
errno = EINVAL;
return NULL;
}
#define CLEANUP() \
free (d.dir); \
if (a.arg) \
free (a.arg);
if (printf_fetchargs (args, &a) < 0)
{
CLEANUP ();
errno = EINVAL;
return NULL;
}
{
size_t buf_neededlength;
CHAR_T *buf;
CHAR_T *buf_malloced;
const CHAR_T *cp;
size_t i;
DIRECTIVE *dp;
/* Output string accumulator. */
CHAR_T *result;
size_t allocated;
size_t length;
/* Allocate a small buffer that will hold a directive passed to
sprintf or snprintf. */
buf_neededlength = 7 + d.max_width_length + d.max_precision_length + 6;
#if HAVE_ALLOCA
if (buf_neededlength < 4000 / sizeof (CHAR_T))
{
buf = (CHAR_T *) alloca (buf_neededlength * sizeof (CHAR_T));
buf_malloced = NULL;
}
else
#endif
{
if (SIZE_MAX / sizeof (CHAR_T) < buf_neededlength)
goto out_of_memory_1;
buf = (CHAR_T *) malloc (buf_neededlength * sizeof (CHAR_T));
if (buf == NULL)
goto out_of_memory_1;
buf_malloced = buf;
}
if (resultbuf != NULL)
{
result = resultbuf;
allocated = *lengthp;
}
else
{
result = NULL;
allocated = 0;
}
length = 0;
/* Invariants:
result is either == resultbuf or == NULL or malloc-allocated.
If length > 0, then result != NULL. */
/* Ensures that allocated >= length + extra. Aborts through a jump to
out_of_memory if size is too big. */
#define ENSURE_ALLOCATION(extra) \
{ \
size_t needed = length + (extra); \
if (needed < length) \
goto out_of_memory; \
if (needed > allocated) \
{ \
size_t memory_size; \
CHAR_T *memory; \
\
allocated = (allocated > 0 ? 2 * allocated : 12); \
if (needed > allocated) \
allocated = needed; \
if (SIZE_MAX / sizeof (CHAR_T) < allocated) \
goto out_of_memory; \
memory_size = allocated * sizeof (CHAR_T); \
if (result == resultbuf || result == NULL) \
memory = (CHAR_T *) malloc (memory_size); \
else \
memory = (CHAR_T *) realloc (result, memory_size); \
if (memory == NULL) \
goto out_of_memory; \
if (result == resultbuf && length > 0) \
memcpy (memory, result, length * sizeof (CHAR_T)); \
result = memory; \
} \
}
for (cp = format, i = 0, dp = &d.dir[0]; ; cp = dp->dir_end, i++, dp++)
{
if (cp != dp->dir_start)
{
size_t n = dp->dir_start - cp;
ENSURE_ALLOCATION (n);
memcpy (result + length, cp, n * sizeof (CHAR_T));
length += n;
}
if (i == d.count)
break;
/* Execute a single directive. */
if (dp->conversion == '%')
{
if (!(dp->arg_index == ARG_NONE))
abort ();
ENSURE_ALLOCATION (1);
result[length] = '%';
length += 1;
}
else
{
if (!(dp->arg_index != ARG_NONE))
abort ();
if (dp->conversion == 'n')
{
switch (a.arg[dp->arg_index].type)
{
case TYPE_COUNT_SCHAR_POINTER:
*a.arg[dp->arg_index].a.a_count_schar_pointer = length;
break;
case TYPE_COUNT_SHORT_POINTER:
*a.arg[dp->arg_index].a.a_count_short_pointer = length;
break;
case TYPE_COUNT_INT_POINTER:
*a.arg[dp->arg_index].a.a_count_int_pointer = length;
break;
case TYPE_COUNT_LONGINT_POINTER:
*a.arg[dp->arg_index].a.a_count_longint_pointer = length;
break;
#ifdef HAVE_LONG_LONG
case TYPE_COUNT_LONGLONGINT_POINTER:
*a.arg[dp->arg_index].a.a_count_longlongint_pointer = length;
break;
#endif
default:
abort ();
}
}
else
{
arg_type type = a.arg[dp->arg_index].type;
CHAR_T *p;
unsigned int prefix_count;
int prefixes[2];
#if !USE_SNPRINTF
size_t tmp_length;
CHAR_T tmpbuf[700];
CHAR_T *tmp;
/* Allocate a temporary buffer of sufficient size for calling
sprintf. */
{
size_t width;
size_t precision;
width = 0;
if (dp->width_start != dp->width_end)
{
if (dp->width_arg_index != ARG_NONE)
{
int arg;
if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
abort ();
arg = a.arg[dp->width_arg_index].a.a_int;
width = (arg < 0 ? (unsigned int) (-arg) : arg);
}
else
{
const CHAR_T *digitp = dp->width_start;
do
{
size_t w_tmp = width * 10 + (*digitp++ - '0');
if (SIZE_MAX / 10 < width || w_tmp < width)
goto out_of_memory;
width = w_tmp;
}
while (digitp != dp->width_end);
}
}
precision = 6;
if (dp->precision_start != dp->precision_end)
{
if (dp->precision_arg_index != ARG_NONE)
{
int arg;
if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
abort ();
arg = a.arg[dp->precision_arg_index].a.a_int;
precision = (arg < 0 ? 0 : arg);
}
else
{
const CHAR_T *digitp = dp->precision_start + 1;
precision = 0;
while (digitp != dp->precision_end)
{
size_t p1 = 10 * precision + (*digitp++ - '0');
precision = ((SIZE_MAX / 10 < precision
|| p1 < precision)
? SIZE_MAX : p1);
}
}
}
switch (dp->conversion)
{
case 'd': case 'i': case 'u':
# ifdef HAVE_LONG_LONG
if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
* 0.30103 /* binary -> decimal */
)
+ 1; /* turn floor into ceil */
else
# endif
if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long) * CHAR_BIT
* 0.30103 /* binary -> decimal */
)
+ 1; /* turn floor into ceil */
else
tmp_length =
(unsigned int) (sizeof (unsigned int) * CHAR_BIT
* 0.30103 /* binary -> decimal */
)
+ 1; /* turn floor into ceil */
if (tmp_length < precision)
tmp_length = precision;
/* Multiply by 2, as an estimate for FLAG_GROUP. */
/* Add 1, to account for a leading sign. */
tmp_length = (tmp_length < SIZE_MAX / 2
? 2 * tmp_length + 1
: SIZE_MAX);
break;
case 'o':
# ifdef HAVE_LONG_LONG
if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
* 0.333334 /* binary -> octal */
)
+ 1; /* turn floor into ceil */
else
# endif
if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long) * CHAR_BIT
* 0.333334 /* binary -> octal */
)
+ 1; /* turn floor into ceil */
else
tmp_length =
(unsigned int) (sizeof (unsigned int) * CHAR_BIT
* 0.333334 /* binary -> octal */
)
+ 1; /* turn floor into ceil */
if (tmp_length < precision)
tmp_length = precision;
/* Add 1, to account for a leading sign. */
tmp_length += (tmp_length < SIZE_MAX);
break;
case 'x': case 'X':
# ifdef HAVE_LONG_LONG
if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long long) * CHAR_BIT
* 0.25 /* binary -> hexadecimal */
)
+ 1; /* turn floor into ceil */
else
# endif
if (type == TYPE_LONGINT || type == TYPE_ULONGINT)
tmp_length =
(unsigned int) (sizeof (unsigned long) * CHAR_BIT
* 0.25 /* binary -> hexadecimal */
)
+ 1; /* turn floor into ceil */
else
tmp_length =
(unsigned int) (sizeof (unsigned int) * CHAR_BIT
* 0.25 /* binary -> hexadecimal */
)
+ 1; /* turn floor into ceil */
if (tmp_length < precision)
tmp_length = precision;
/* Add 2, to account for a leading sign or alternate form. */
if (tmp_length <= SIZE_MAX / 2)
tmp_length *= 2;
break;
case 'f': case 'F':
# ifdef HAVE_LONG_DOUBLE
if (type == TYPE_LONGDOUBLE)
tmp_length =
(unsigned int) (LDBL_MAX_EXP
* 0.30103 /* binary -> decimal */
* 2 /* estimate for FLAG_GROUP */
)
+ 1 /* turn floor into ceil */
+ 10; /* sign, decimal point etc. */
else
# endif
tmp_length =
(unsigned int) (DBL_MAX_EXP
* 0.30103 /* binary -> decimal */
* 2 /* estimate for FLAG_GROUP */
)
+ 1 /* turn floor into ceil */
+ 10; /* sign, decimal point etc. */
tmp_length += precision;
if (tmp_length < precision)
goto out_of_memory;
break;
case 'e': case 'E': case 'g': case 'G':
case 'a': case 'A':
tmp_length =
12; /* sign, decimal point, exponent etc. */
tmp_length += precision;
if (tmp_length < precision)
goto out_of_memory;
break;
case 'c':
# if defined HAVE_WINT_T && !WIDE_CHAR_VERSION
if (type == TYPE_WIDE_CHAR)
tmp_length = MB_CUR_MAX;
else
# endif
tmp_length = 1;
break;
case 's':
# ifdef HAVE_WCHAR_T
if (type == TYPE_WIDE_STRING)
{
tmp_length =
local_wcslen (a.arg[dp->arg_index].a.a_wide_string);
# if !WIDE_CHAR_VERSION
if (SIZE_MAX / MB_CUR_MAX < tmp_length)
goto out_of_memory;
tmp_length *= MB_CUR_MAX;
# endif
}
else
# endif
tmp_length = strlen (a.arg[dp->arg_index].a.a_string);
break;
case 'p':
tmp_length =
(unsigned int) (sizeof (void *) * CHAR_BIT
* 0.25 /* binary -> hexadecimal */
)
+ 1 /* turn floor into ceil */
+ 2; /* account for leading 0x */
break;
default:
abort ();
}
if (tmp_length < width)
tmp_length = width;
tmp_length++; /* account for trailing NUL */
if (!tmp_length)
goto out_of_memory;
}
if (tmp_length <= sizeof (tmpbuf) / sizeof (CHAR_T))
tmp = tmpbuf;
else
{
if (SIZE_MAX / sizeof (CHAR_T) < tmp_length)
/* Overflow, would lead to out of memory. */
goto out_of_memory;
tmp = (CHAR_T *) malloc (tmp_length * sizeof (CHAR_T));
if (tmp == NULL)
/* Out of memory. */
goto out_of_memory;
}
#endif
/* Construct the format string for calling snprintf or
sprintf. */
p = buf;
*p++ = '%';
if (dp->flags & FLAG_GROUP)
*p++ = '\'';
if (dp->flags & FLAG_LEFT)
*p++ = '-';
if (dp->flags & FLAG_SHOWSIGN)
*p++ = '+';
if (dp->flags & FLAG_SPACE)
*p++ = ' ';
if (dp->flags & FLAG_ALT)
*p++ = '#';
if (dp->flags & FLAG_ZERO)
*p++ = '0';
if (dp->width_start != dp->width_end)
{
size_t n = dp->width_end - dp->width_start;
memcpy (p, dp->width_start, n * sizeof (CHAR_T));
p += n;
}
if (dp->precision_start != dp->precision_end)
{
size_t n = dp->precision_end - dp->precision_start;
memcpy (p, dp->precision_start, n * sizeof (CHAR_T));
p += n;
}
switch (type)
{
#ifdef HAVE_LONG_LONG
case TYPE_LONGLONGINT:
case TYPE_ULONGLONGINT:
*p++ = 'l';
/*FALLTHROUGH*/
#endif
case TYPE_LONGINT:
case TYPE_ULONGINT:
#ifdef HAVE_WINT_T
case TYPE_WIDE_CHAR:
#endif
#ifdef HAVE_WCHAR_T
case TYPE_WIDE_STRING:
#endif
*p++ = 'l';
break;
#ifdef HAVE_LONG_DOUBLE
case TYPE_LONGDOUBLE:
*p++ = 'L';
break;
#endif
default:
break;
}
*p = dp->conversion;
#if USE_SNPRINTF
p[1] = '%';
p[2] = 'n';
p[3] = '\0';
#else
p[1] = '\0';
#endif
/* Construct the arguments for calling snprintf or sprintf. */
prefix_count = 0;
if (dp->width_arg_index != ARG_NONE)
{
if (!(a.arg[dp->width_arg_index].type == TYPE_INT))
abort ();
prefixes[prefix_count++] = a.arg[dp->width_arg_index].a.a_int;
}
if (dp->precision_arg_index != ARG_NONE)
{
if (!(a.arg[dp->precision_arg_index].type == TYPE_INT))
abort ();
prefixes[prefix_count++] = a.arg[dp->precision_arg_index].a.a_int;
}
#if USE_SNPRINTF
/* Prepare checking whether snprintf returns the count
via %n. */
ENSURE_ALLOCATION (1);
result[length] = '\0';
#endif
for (;;)
{
size_t maxlen;
int count;
int retcount;
maxlen = allocated - length;
count = -1;
retcount = 0;
#if USE_SNPRINTF
# define SNPRINTF_BUF(arg) \
switch (prefix_count) \
{ \
case 0: \
retcount = SNPRINTF (result + length, maxlen, buf, \
arg, &count); \
break; \
case 1: \
retcount = SNPRINTF (result + length, maxlen, buf, \
prefixes[0], arg, &count); \
break; \
case 2: \
retcount = SNPRINTF (result + length, maxlen, buf, \
prefixes[0], prefixes[1], arg, \
&count); \
break; \
default: \
abort (); \
}
#else
# define SNPRINTF_BUF(arg) \
switch (prefix_count) \
{ \
case 0: \
count = sprintf (tmp, buf, arg); \
break; \
case 1: \
count = sprintf (tmp, buf, prefixes[0], arg); \
break; \
case 2: \
count = sprintf (tmp, buf, prefixes[0], prefixes[1],\
arg); \
break; \
default: \
abort (); \
}
#endif
switch (type)
{
case TYPE_SCHAR:
{
int arg = a.arg[dp->arg_index].a.a_schar;
SNPRINTF_BUF (arg);
}
break;
case TYPE_UCHAR:
{
unsigned int arg = a.arg[dp->arg_index].a.a_uchar;
SNPRINTF_BUF (arg);
}
break;
case TYPE_SHORT:
{
int arg = a.arg[dp->arg_index].a.a_short;
SNPRINTF_BUF (arg);
}
break;
case TYPE_USHORT:
{
unsigned int arg = a.arg[dp->arg_index].a.a_ushort;
SNPRINTF_BUF (arg);
}
break;
case TYPE_INT:
{
int arg = a.arg[dp->arg_index].a.a_int;
SNPRINTF_BUF (arg);
}
break;
case TYPE_UINT:
{
unsigned int arg = a.arg[dp->arg_index].a.a_uint;
SNPRINTF_BUF (arg);
}
break;
case TYPE_LONGINT:
{
long int arg = a.arg[dp->arg_index].a.a_longint;
SNPRINTF_BUF (arg);
}
break;
case TYPE_ULONGINT:
{
unsigned long int arg = a.arg[dp->arg_index].a.a_ulongint;
SNPRINTF_BUF (arg);
}
break;
#ifdef HAVE_LONG_LONG
case TYPE_LONGLONGINT:
{
long long int arg = a.arg[dp->arg_index].a.a_longlongint;
SNPRINTF_BUF (arg);
}
break;
case TYPE_ULONGLONGINT:
{
unsigned long long int arg = a.arg[dp->arg_index].a.a_ulonglongint;
SNPRINTF_BUF (arg);
}
break;
#endif
case TYPE_DOUBLE:
{
double arg = a.arg[dp->arg_index].a.a_double;
SNPRINTF_BUF (arg);
}
break;
#ifdef HAVE_LONG_DOUBLE
case TYPE_LONGDOUBLE:
{
long double arg = a.arg[dp->arg_index].a.a_longdouble;
SNPRINTF_BUF (arg);
}
break;
#endif
case TYPE_CHAR:
{
int arg = a.arg[dp->arg_index].a.a_char;
SNPRINTF_BUF (arg);
}
break;
#ifdef HAVE_WINT_T
case TYPE_WIDE_CHAR:
{
wint_t arg = a.arg[dp->arg_index].a.a_wide_char;
SNPRINTF_BUF (arg);
}
break;
#endif
case TYPE_STRING:
{
const char *arg = a.arg[dp->arg_index].a.a_string;
SNPRINTF_BUF (arg);
}
break;
#ifdef HAVE_WCHAR_T
case TYPE_WIDE_STRING:
{
const wchar_t *arg = a.arg[dp->arg_index].a.a_wide_string;
SNPRINTF_BUF (arg);
}
break;
#endif
case TYPE_POINTER:
{
void *arg = a.arg[dp->arg_index].a.a_pointer;
SNPRINTF_BUF (arg);
}
break;
default:
abort ();
}
#if USE_SNPRINTF
/* Portability: Not all implementations of snprintf()
are ISO C 99 compliant. Determine the number of
bytes that snprintf() has produced or would have
produced. */
if (count >= 0)
{
/* Verify that snprintf() has NUL-terminated its
result. */
if (count < maxlen && result[length + count] != '\0')
abort ();
/* Portability hack. */
if (retcount > count)
count = retcount;
}
else
{
/* snprintf() doesn't understand the '%n'
directive. */
if (p[1] != '\0')
{
/* Don't use the '%n' directive; instead, look
at the snprintf() return value. */
p[1] = '\0';
continue;
}
else
{
/* Look at the snprintf() return value. */
if (retcount < 0)
{
/* HP-UX 10.20 snprintf() is doubly deficient:
It doesn't understand the '%n' directive,
*and* it returns -1 (rather than the length
that would have been required) when the
buffer is too small. */
size_t bigger_need =
(allocated > 12 ? allocated : 12);
ENSURE_ALLOCATION (bigger_need);
continue;
}
else
count = retcount;
}
}
#endif
/* Attempt to handle failure. */
if (count < 0)
{
if (!(result == resultbuf || result == NULL))
free (result);
if (buf_malloced != NULL)
free (buf_malloced);
CLEANUP ();
errno = EINVAL;
return NULL;
}
#if !USE_SNPRINTF
if (count >= tmp_length)
/* tmp_length was incorrectly calculated - fix the
code above! */
abort ();
#endif
/* Make room for the result. */
if (count >= maxlen)
{
/* Need at least count bytes. But allocate
proportionally, to avoid looping eternally if
snprintf() reports a too small count. */
ENSURE_ALLOCATION (count < allocated
? allocated : count);
#if USE_SNPRINTF
continue;
#endif
}
#if USE_SNPRINTF
/* The snprintf() result did fit. */
#else
/* Append the sprintf() result. */
memcpy (result + length, tmp, count * sizeof (CHAR_T));
if (tmp != tmpbuf)
free (tmp);
#endif
length += count;
break;
}
}
}
}
/* Add the final NUL. */
ENSURE_ALLOCATION (1);
result[length] = '\0';
if (result != resultbuf && length + 1 < allocated)
{
/* Shrink the allocated memory if possible. */
CHAR_T *memory;
memory = (CHAR_T *) realloc (result, (length + 1) * sizeof (CHAR_T));
if (memory != NULL)
result = memory;
}
if (buf_malloced != NULL)
free (buf_malloced);
CLEANUP ();
*lengthp = length;
if (length > INT_MAX)
goto length_overflow;
return result;
length_overflow:
/* We could produce such a big string, but its length doesn't fit into
an 'int'. POSIX says that snprintf() fails with errno = EOVERFLOW in
this case. */
if (result != resultbuf)
free (result);
errno = EOVERFLOW;
return NULL;
out_of_memory:
if (!(result == resultbuf || result == NULL))
free (result);
if (buf_malloced != NULL)
free (buf_malloced);
out_of_memory_1:
CLEANUP ();
errno = ENOMEM;
return NULL;
}
}
#undef SNPRINTF
#undef USE_SNPRINTF
#undef PRINTF_PARSE
#undef DIRECTIVES
#undef DIRECTIVE
#undef CHAR_T
#undef VASNPRINTF

View File

@@ -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,

View File

@@ -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
@@ -51,6 +56,7 @@ src/names.c
src/tar.c
src/update.c
src/xheader.c
src/checkpoint.c
# Testsuite
tests/genfile.c

View File

@@ -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,

View File

@@ -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
View 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

View File

@@ -7,7 +7,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

View File

@@ -1,11 +1,11 @@
# Makefile for GNU tar sources.
# 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,
@@ -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\
@@ -33,6 +34,7 @@ tar_SOURCES = \
misc.c\
names.c\
sparse.c\
suffix.c\
system.c\
tar.c\
transform.c\

View File

@@ -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,

View File

@@ -1,13 +1,13 @@
/* Buffer management for 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 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
@@ -26,7 +26,6 @@
#include <closeout.h>
#include <fnmatch.h>
#include <getline.h>
#include <human.h>
#include <quotearg.h>
@@ -75,9 +74,6 @@ static int read_error_count;
/* Have we hit EOF yet? */
static bool hit_eof;
/* Checkpointing counter */
static unsigned checkpoint;
static bool read_full_records = false;
/* We're reading, but we just read the last block and it's time to update.
@@ -205,7 +201,8 @@ enum compress_type {
ct_none,
ct_compress,
ct_gzip,
ct_bzip2
ct_bzip2,
ct_lzma
};
struct zip_magic
@@ -222,6 +219,7 @@ static struct zip_magic const magic[] = {
{ ct_compress, 2, "\037\235", "compress", "-Z" },
{ ct_gzip, 2, "\037\213", "gzip", "-z" },
{ ct_bzip2, 3, "BZh", "bzip2", "-j" },
{ ct_lzma, 6, "\xFFLZMA", "lzma", "--lzma" }, /* FIXME: ???? */
};
#define NMAGIC (sizeof(magic)/sizeof(magic[0]))
@@ -231,18 +229,22 @@ static struct zip_magic const magic[] = {
/* Check if the file ARCHIVE is a compressed archive. */
enum compress_type
check_compressed_archive ()
check_compressed_archive (bool *pshort)
{
struct zip_magic const *p;
bool sfr;
bool temp;
if (!pshort)
pshort = &temp;
/* Prepare global data needed for find_next_block: */
record_end = record_start; /* set up for 1st record = # 0 */
sfr = read_full_records;
read_full_records = true; /* Suppress fatal error on reading a partial
record */
find_next_block ();
*pshort = find_next_block () == 0;
/* Restore global values */
read_full_records = sfr;
@@ -270,11 +272,16 @@ open_compressed_archive ()
if (!multi_volume_option)
{
enum compress_type type = check_compressed_archive ();
bool shortfile;
enum compress_type type = check_compressed_archive (&shortfile);
if (type == ct_none)
return archive;
{
if (shortfile)
ERROR ((0, 0, _("This does not look like a tar archive")));
return archive;
}
/* FD is not needed any more */
rmtclose (archive);
@@ -499,15 +506,18 @@ _open_archive (enum access_mode wanted_access)
{
case ACCESS_READ:
{
bool shortfile;
enum compress_type type;
archive = STDIN_FILENO;
type = check_compressed_archive ();
type = check_compressed_archive (&shortfile);
if (type != ct_none)
FATAL_ERROR ((0, 0,
_("Archive is compressed. Use %s option"),
compress_option (type)));
if (shortfile)
ERROR ((0, 0, _("This does not look like a tar archive")));
}
break;
@@ -551,7 +561,7 @@ _open_archive (enum access_mode wanted_access)
O_RDWR | O_CREAT | O_BINARY,
MODE_RW, rsh_command_option);
if (check_compressed_archive () != ct_none)
if (check_compressed_archive (NULL) != ct_none)
FATAL_ERROR ((0, 0,
_("Cannot update compressed archives")));
break;
@@ -585,43 +595,13 @@ _open_archive (enum access_mode wanted_access)
}
}
static void
do_checkpoint (bool write)
{
if (checkpoint_option && !(++checkpoint % checkpoint_option))
{
switch (checkpoint_style)
{
case checkpoint_dot:
fputc ('.', stdlis);
fflush (stdlis);
break;
case checkpoint_text:
if (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'' */
WARN ((0, 0, _("Write checkpoint %u"), checkpoint));
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'' */
WARN ((0, 0, _("Read checkpoint %u"), checkpoint));
break;
}
}
}
/* Perform a write to flush the buffer. */
ssize_t
_flush_write (void)
{
ssize_t status;
do_checkpoint (true);
checkpoint_run (true);
if (tape_length_option && tape_length_option <= bytes_written)
{
errno = ENOSPC;
@@ -631,7 +611,7 @@ _flush_write (void)
status = record_size;
else
status = sys_write_archive_buffer ();
return status;
}
@@ -853,7 +833,7 @@ close_archive (void)
verify_volume ();
if (rmtclose (archive) != 0)
close_warn (*archive_name_cursor);
close_error (*archive_name_cursor);
sys_wait_for_child (child_pid);
@@ -1041,7 +1021,7 @@ new_volume (enum access_mode mode)
current_block = record_start;
if (rmtclose (archive) != 0)
close_warn (*archive_name_cursor);
close_error (*archive_name_cursor);
archive_name_cursor++;
if (archive_name_cursor == archive_name_array + archive_names)
@@ -1132,22 +1112,22 @@ try_new_volume ()
{
size_t status;
union block *header;
int access;
enum access_mode acc;
switch (subcommand_option)
{
case APPEND_SUBCOMMAND:
case CAT_SUBCOMMAND:
case UPDATE_SUBCOMMAND:
access = ACCESS_UPDATE;
acc = ACCESS_UPDATE;
break;
default:
access = ACCESS_READ;
acc = ACCESS_READ;
break;
}
if (!new_volume (access))
if (!new_volume (acc))
return true;
while ((status = rmtread (archive, record_start->buffer, record_size))
@@ -1460,7 +1440,7 @@ simple_flush_read (void)
{
size_t status; /* result from system call */
do_checkpoint (false);
checkpoint_run (false);
/* Clear the count of errors. This only applies to a single call to
flush_read. */
@@ -1519,7 +1499,7 @@ _gnu_flush_read (void)
{
size_t status; /* result from system call */
do_checkpoint (false);
checkpoint_run (false);
/* Clear the count of errors. This only applies to a single call to
flush_read. */

270
src/checkpoint.c Normal file
View 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);
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);
}

View File

@@ -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, 2007 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
@@ -130,19 +130,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;
@@ -194,6 +188,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;
@@ -445,7 +441,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))
@@ -489,8 +489,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);
@@ -707,6 +717,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, ...);
@@ -736,3 +749,11 @@ void set_transform_expr (const char *expr);
bool transform_name (char **pinput);
bool transform_member_name (char **pinput, xform_type type);
bool transform_name_fp (char **pinput, 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);

View File

@@ -7,7 +7,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
@@ -366,11 +366,11 @@ dumpdir_cmp (const char *a, const char *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);
@@ -378,7 +378,7 @@ 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);
@@ -597,9 +597,23 @@ 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 (&current_stat_info);
}

View File

@@ -7,7 +7,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
@@ -58,7 +58,7 @@ add_exclusion_tag (const char *name, enum exclusion_tag_type type,
exclusion_tags = tag;
}
static void
void
exclusion_tag_warning (const char *dirname, const char *tagname,
const char *message)
{
@@ -70,19 +70,19 @@ exclusion_tag_warning (const char *dirname, const char *tagname,
message));
}
static enum exclusion_tag_type
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;
char *ret = NULL;
for (tag = exclusion_tags; tag; tag = tag->next)
{
size_t size = dlen + tag->length + 1;
size_t size = dlen + addslash + tag->length + 1;
if (size > tagsize)
{
tagsize = size;
@@ -93,6 +93,8 @@ check_exclusion_tags (char *dirname, const char **tag_file_name)
{
strcpy (tagname, dirname);
nptr = tagname + dlen;
if (addslash)
*nptr++ = '/';
}
strcpy (nptr, tag->name);
if (access (tagname, F_OK) == 0
@@ -1064,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)
{
@@ -1079,7 +1080,7 @@ 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;
}
}
@@ -1183,8 +1184,11 @@ dump_dir0 (char *directory,
switch (check_exclusion_tags (st->orig_file_name, &tag_file_name))
{
case exclusion_tag_none:
case exclusion_tag_all:
/* Handled in dump_file0 */
break;
case exclusion_tag_none:
{
char const *entry;
size_t entry_len;
@@ -1418,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;
@@ -1610,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:
@@ -1619,8 +1626,6 @@ dump_file0 (struct tar_stat_info *st, const char *p,
abort ();
}
file_count_links (st);
ok = status == dump_status_ok;
}
@@ -1700,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);
if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) < size)
write_long_link (st);
@@ -1708,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 */

View File

@@ -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

View File

@@ -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
@@ -593,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);
}

View File

@@ -1,11 +1,11 @@
/* GNU dump extensions to tar.
Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001,
2003, 2004, 2005, 2006, 2007 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,153 @@ 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 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 */
const char *tagfile; /* Tag file, if the directory falls under
exclusion_tag_under */
char name[1]; /* file name of directory */
};
struct dumpdir *
dumpdir_create0 (const char *contents, const char *cmask)
{
struct dumpdir *dump;
size_t i, total, ctsize, len;
const char *p;
for (i = 0, total = 0, ctsize = 1, p = contents; *p; total++, p += len)
{
len = strlen (p) + 1;
ctsize += len;
if (!cmask || strchr (cmask, *p))
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 Hash_table *directory_table;
static Hash_table *directory_meta_table;
@@ -119,12 +249,13 @@ 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;
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 (directory->name[namelen - 1]))
directory->name[namelen - 1] = 0;
directory->tagfile = NULL;
return directory;
}
@@ -134,7 +265,8 @@ make_directory (const char *name)
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);
@@ -147,13 +279,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,
@@ -230,7 +358,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 +376,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))
{
@@ -331,56 +461,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)
{
char const *const *name1 = first;
char const *const *name2 = second;
return strcmp (*name1, *name2);
return directory;
}
/* Compare dumpdir array from DIRECTORY with directory listing DIR and
@@ -388,10 +502,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
@@ -403,15 +517,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;
@@ -437,9 +551,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 */
@@ -448,16 +569,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 */
@@ -465,12 +586,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);
@@ -485,19 +606,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
@@ -507,7 +631,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
{
@@ -520,10 +646,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)
@@ -542,29 +668,37 @@ 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
@@ -1116,14 +1250,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);
}
@@ -1311,6 +1447,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 (&current_stat_info))
return false;
@@ -1355,6 +1492,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)
@@ -1374,6 +1524,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)
{
@@ -1395,7 +1546,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)))
{
@@ -1421,7 +1572,8 @@ try_purge_directory (char const *directory_name)
}
}
free (p);
dumpdir_free (dump);
free (current_dir);
return true;
}

View File

@@ -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
@@ -301,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)
{

View File

@@ -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

View File

@@ -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
@@ -734,7 +734,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";
@@ -746,7 +746,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;
@@ -1012,11 +1012,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));
}
}

View File

@@ -4,7 +4,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

78
src/suffix.c Normal file
View File

@@ -0,0 +1,78 @@
/* 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) },
#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;
}

View File

@@ -1,10 +1,10 @@
/* System-dependent calls 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
@@ -17,8 +17,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>
@@ -697,7 +695,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 +706,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 +735,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 +751,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 +772,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 +785,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 +800,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,6 +824,8 @@ 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 ?
@@ -840,5 +844,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 */

168
src/tar.c
View File

@@ -7,7 +7,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
@@ -22,7 +22,6 @@
#include <system.h>
#include <fnmatch.h>
#include <getline.h>
#include <argp.h>
#include <argp-namefrob.h>
#include <argp-fmtstream.h>
@@ -250,8 +249,11 @@ 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,
@@ -260,6 +262,7 @@ enum
EXCLUDE_TAG_OPTION,
EXCLUDE_TAG_UNDER_OPTION,
EXCLUDE_TAG_ALL_OPTION,
EXCLUDE_VCS_OPTION,
FORCE_LOCAL_OPTION,
GROUP_OPTION,
HANG_OPTION,
@@ -268,10 +271,12 @@ enum
IGNORE_FAILED_READ_OPTION,
INDEX_FILE_OPTION,
KEEP_NEWER_FILES_OPTION,
LZMA_OPTION,
MODE_OPTION,
MTIME_OPTION,
NEWER_MTIME_OPTION,
NO_ANCHORED_OPTION,
NO_CHECK_DEVICE_OPTION,
NO_DELAY_DIRECTORY_RESTORE_OPTION,
NO_IGNORE_CASE_OPTION,
NO_IGNORE_COMMAND_ERROR_OPTION,
@@ -345,7 +350,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 DEIJQY and eqy. Consider the following
assignments:
[For Solaris tar compatibility =/= Is it important at all?]
@@ -408,6 +413,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
@@ -574,20 +585,29 @@ 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 },
{"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", LZMA_OPTION, 0, 0,
N_("filter the archive through lzma"), GRID+1 },
{"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 },
@@ -622,6 +642,8 @@ static struct argp_option options[] = {
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,
@@ -632,6 +654,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,
@@ -645,7 +669,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,
@@ -655,7 +679,7 @@ static struct argp_option options[] = {
N_("use sed replace EXPRESSION to transform file names"), 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 },
@@ -677,15 +701,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,
@@ -718,7 +745,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 },
@@ -726,7 +753,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 },
@@ -783,8 +810,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 \
@@ -796,6 +826,37 @@ 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",
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) \
{ \
@@ -1188,6 +1249,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
set_subcommand_option (CAT_SUBCOMMAND);
break;
case 'a':
args->compress_autodetect = true;
break;
case 'b':
{
uintmax_t u;
@@ -1258,6 +1323,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
@@ -1307,6 +1376,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
}
break;
case LZMA_OPTION:
set_use_compress_program_option ("lzma");
break;
case 'm':
touch_option = true;
break;
@@ -1480,6 +1553,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)
{
@@ -1487,7 +1568,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);
@@ -1496,9 +1577,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)
@@ -1548,6 +1633,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
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;
@@ -1934,23 +2023,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. */
@@ -1963,7 +2052,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;
@@ -1979,6 +2069,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. */
@@ -2041,7 +2133,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);
@@ -2069,9 +2161,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;
}
@@ -2224,6 +2316,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:
@@ -2276,6 +2372,8 @@ decode_options (int argc, char **argv)
backup_option = false;
}
checkpoint_finish_compile ();
if (verbose_option)
report_textual_dates (&args);
}

View File

@@ -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

View File

@@ -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,53 @@ 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;
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 */
};
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 +113,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,37 +124,30 @@ 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)
add_case_ctl_segment (struct transform *tf, enum case_ctl_type ctl)
{
struct replace_segm *segm = add_segment ();
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 (&regex);
}
struct transform *tf = new_transform ();
if (expr[0] != 's')
USAGE_ERROR ((0, 0, _("Invalid transform expression")));
@@ -161,12 +171,12 @@ 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;
for (p = expr + j + 1; *p && *p != ';'; p++)
switch (*p)
{
case 'g':
transform_type = transform_global;
tf->transform_type = transform_global;
break;
case 'i':
@@ -179,30 +189,34 @@ set_transform_expr (const char *expr)
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")));
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 (&regex, str, cflags);
rc = regcomp (&tf->regex, str, cflags);
if (rc)
{
char errbuf[512];
regerror (rc, &regex, 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 +232,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 +326,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 +335,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 +395,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 +416,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 (&regex, input, regex.re_nsub + 1, rmp, 0);
rc = regexec (&tf->regex, input, tf->regex.re_nsub + 1, rmp, 0);
if (rc == 0)
{
@@ -412,14 +435,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 +508,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,23 +517,40 @@ _transform_name_to_obstack (char *input)
obstack_1grow (&stk, 0);
free (rmp);
return true;
}
bool
_transform_name_to_obstack (char *input, char **output)
{
struct transform *tf;
if (!stk_init)
{
obstack_init (&stk);
stk_init = true;
}
for (tf = transform_head; tf; tf = tf->next)
{
_single_transform_name_to_obstack (tf, input);
input = obstack_finish (&stk);
}
*output = input;
return transform_head != NULL;
}
bool
transform_name_fp (char **pinput, char *(*fun)(char *, void *), void *dat)
{
char *str;
bool ret = _transform_name_to_obstack (*pinput);
bool ret = _transform_name_to_obstack (*pinput, &str);
if (ret)
{
str = obstack_finish (&stk);
assign_string (pinput, fun ? fun (str, dat) : str);
obstack_free (&stk, str);
}
else if (fun)
{
str = *pinput;
*pinput = NULL;
assign_string (pinput, fun (str, dat));
free (str);

View File

@@ -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

View File

@@ -1,10 +1,10 @@
/* Charset handling 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) 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
@@ -91,7 +91,7 @@ bool
string_ascii_p (char const *p)
{
for (; *p; p++)
if (! (0 <= *p && *p <= 127))
if (*p & ~0x7f)
return false;
return true;
}

View File

@@ -4,7 +4,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

View File

@@ -8,7 +8,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,
@@ -99,6 +99,8 @@ TESTSUITE_AT = \
rename03.at\
same-order01.at\
same-order02.at\
shortfile.at\
shortupd.at\
shortrec.at\
sparse01.at\
sparse02.at\

View File

@@ -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,
@@ -49,4 +49,4 @@ trzy
],
[],[],[],[ustar]) # Testing one format is enough
AT_CLEANUP
AT_CLEANUP

View File

@@ -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,
@@ -19,7 +19,11 @@
# 02110-1301, USA.
AT_SETUP([files-from: 0-separated file without -0])
AT_KEYWORDS([files-from null])
AT_KEYWORDS([files-from null T-null])
AT_DATA([expout],[jeden\ndwa
trzy
])
AT_TAR_CHECK([
AT_SORT_PREREQ
@@ -37,9 +41,7 @@ genfile -f trzy
tar cfTv archive file-list | sort
],
[0],
[jeden\ndwa
trzy
],
[expout],
[tar: file-list: file name read contains nul character
],[],[],[ustar]) # Testing one format is enough

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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)
# 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,
@@ -24,6 +24,8 @@ AT_SETUP([exclude])
AT_KEYWORDS([exclude])
AT_TAR_CHECK([
AT_SORT_PREREQ
mkdir dir
echo blues > dir/blues
echo jazz > dir/jazz
@@ -37,79 +39,79 @@ 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
tar -cf archive.tar --$option -v dir 2>err | sort
cat err
echo ARCHIVE
tar tf archive.tar
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
tar -cf archive.tar --${option}=tagfile -v dir 2>err | sort
cat err
echo ARCHIVE
tar tf archive.tar
tar tf archive.tar | sort
done
],
[0],
[OPTION exclude-caches
dir/
dir/blues
dir/jazz
dir/folk/
dir/folk/tagfile
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/jazz
dir/folk/
dir/folk/tagfile
dir/folk/sanjuan
dir/folk/tagfile
dir/jazz
dir/rock/
dir/rock/CACHEDIR.TAG
OPTION exclude-caches-under
dir/
dir/blues
dir/jazz
dir/folk/
dir/folk/tagfile
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/jazz
dir/folk/
dir/folk/tagfile
dir/folk/sanjuan
dir/folk/tagfile
dir/jazz
dir/rock/
OPTION exclude-caches-all
dir/
dir/blues
dir/jazz
dir/folk/
dir/folk/tagfile
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/jazz
dir/folk/
dir/folk/tagfile
dir/folk/sanjuan
dir/folk/tagfile
dir/jazz
OPTION exclude-tag
dir/
dir/blues
dir/jazz
dir/folk/
dir/folk/tagfile
dir/jazz
dir/rock/
dir/rock/CACHEDIR.TAG
dir/rock/file
@@ -117,17 +119,17 @@ tar: dir/folk/: contains a cache directory tag tagfile; contents not dumped
ARCHIVE
dir/
dir/blues
dir/jazz
dir/folk/
dir/folk/tagfile
dir/jazz
dir/rock/
dir/rock/CACHEDIR.TAG
dir/rock/file
OPTION exclude-tag-under
dir/
dir/blues
dir/jazz
dir/folk/
dir/jazz
dir/rock/
dir/rock/CACHEDIR.TAG
dir/rock/file
@@ -135,8 +137,8 @@ tar: dir/folk/: contains a cache directory tag tagfile; contents not dumped
ARCHIVE
dir/
dir/blues
dir/jazz
dir/folk/
dir/jazz
dir/rock/
dir/rock/CACHEDIR.TAG
dir/rock/file

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,
@@ -39,6 +39,8 @@ 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

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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

View File

@@ -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

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,

View File

@@ -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,
@@ -25,7 +25,7 @@ m4_define([LONGNAME],
[this_is_a_very_long_name_for_a_file_designed_to_test_generation_of_ustar_archives_by_gnu_tar_semicolon_it_will_not_fit_the_name_field_and_cannot_be_split_between_name_and_prefix])
AT_TAR_CHECK([
genfile --file=LONGNAME
genfile --file=LONGNAME || AT_SKIP_TEST
tar cf archive LONGNAME
],
[2],

View File

@@ -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,

View File

@@ -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,

Some files were not shown because too many files have changed in this diff Show More