31 Commits

Author SHA1 Message Date
Sergey Poznyakoff
970f999818 Version 1.21 2008-12-27 11:40:31 +00:00
Sergey Poznyakoff
cd39b5a1b7 * src/xheader.c: Remove duplicate inclusion of fnmatch.h. Reported
by Jim Meyering.
2008-11-30 12:33:12 +00:00
Sergey Poznyakoff
7f6e6e6a3e Do not try to drain the input pipe before closing the archive.
* src/buffer.c (close_archive): Remove call to
sys_drain_input_pipe. Pass hit_eof as the second
argument to sys_wait_for_child.
* src/common.h (sys_drain_input_pipe): Remove
(sys_wait_for_child): Declare second argument.
* src/system.c (sys_drain_input_pipe): Remove.
(sys_wait_for_child): Take two arguments. The second one helps to
decide whether to tolerate child termination on SIGPIPE.
2008-11-25 12:33:28 +00:00
Sergey Poznyakoff
99e3a2604f * src/buffer.c (_write_volume_label): Fix typo, which prevented
`-V label -M' from working.
2008-11-03 19:15:52 +00:00
Sergey Poznyakoff
b4ec8aedf9 * NEWS, configure.ac: Version 1.20.91
* doc/tar.texi: Document transformation scope flags.
* src/common.h (transform_symlinks_option): Remove in favor of
transformation scope flags.
(XFORM_REGFILE, XFORM_LINK, XFORM_SYMLINK, XFORM_ALL): New macros.
(transform_name, transform_member_name, transform_name_fp): Take
an additional argument, specifying scope flags.
* src/create.c: Reflect changes to transform_name.
* src/extract.c (extract_link, extract_symlink): Remove calls to
transform_member_name. It is done in read_header.
* src/list.c (decode_xform): Reflect change in data type of 2nd
argument.
(transform_member_name): 2nd arg is int.
(decode_header): Transform file name and link target names.
* src/tar.c: Remove --transform-symlinks.
* src/transform.c (struct transform): New member `flags'.
(transform_flags): New variable.
(parse_transform_expr): Parse transformation scope flags. Allow to
set global flags using `flags=' syntax.
(_transform_name_to_obstack, transform_name_fp)
(transform_name): Take an additional argument, specifying scope
flags.
2008-10-30 14:13:01 +00:00
Sergey Poznyakoff
5354888e40 * src/buffer.c (short_read): Remove !read_full_records condition,
which was always false on a first record and thus disabled record
size autodetection.  Thanks Ed Leaver for the patch.
(_gnu_flush_read): Handle blocking_factor == 1.
* tests/sparsemv.at: Reflect changes to buffer.c.
* tests/sparsemvp.at: Likewise.
* tests/volsize.at: Likewise.
* NEWS: Update.
* THANKS: Add Ed Leaver.
2008-10-22 20:55:35 +00:00
Sergey Poznyakoff
57bfbbde90 * src/common.h (transform_symlinks_option): New global.
* src/create.c (dump_file0): Transform symlink targets only if
explicitly required.  Thanks Cyril Strejc for reporting the
problem.
* src/tar.c (parse_opt): New options --transform-symlinks and
--no-transform-symlinks. New alias --xform to the --transform
option.
* doc/tar.texi: Document --transform-symlinks
* NEWS: Update.
* THANKS: Update.

* src/names.c (name_gather): Use xzalloc.
* src/buffer.c (short_read): Move record size detection before
the loop.
2008-10-16 11:07:19 +00:00
Sergey Poznyakoff
7b69ee5a24 Update 2008-10-07 07:19:23 +00:00
Sergey Poznyakoff
1428b7f176 (options): Add --lzop option. 2008-10-07 07:19:09 +00:00
Sergey Poznyakoff
6901594ac4 Bugfix.
* src/checkpoint.c (checkpoint_compile_action): Add missing
`else'.
2008-10-05 09:09:16 +00:00
Sergey Poznyakoff
c78356feda Implement --no-null option.
* NEWS: Update.
* doc/tar.texi: Update.
* src/tar.c: New option --no-null.
2008-09-24 10:58:19 +00:00
Sergey Poznyakoff
60c00c18b5 Update 2008-09-23 17:07:17 +00:00
Sergey Poznyakoff
c1b55e02b1 ChangeLog 2008-09-23 17:06:43 +00:00
Sergey Poznyakoff
15abf5c4d9 Update 2008-09-18 09:46:39 +00:00
Sergey Poznyakoff
1353511226 Remove incorrect example. 2008-09-18 09:46:34 +00:00
Sergey Poznyakoff
85c7909497 Bugfixes.
* src/incremen.c (dumpdir_create0): Eliminate gcc warning.
(attach_directory): Bugfix - add missing return statement.
* THANKS: Add Enric Hernandez
2008-09-07 08:49:10 +00:00
Sergey Poznyakoff
db83069aea Update 2008-07-31 07:13:13 +00:00
Sergey Poznyakoff
dbbffde583 Fix incremental archiving of renamed directories.
* src/incremen.c (struct directory): New member `next'.  Change
type of `name'.
(dirhead, dirtail): New statics.
(make_directory): Reflect changes to struct directory.
(free_directory, attach_directory): New functions.
(dirlist_replace_prefix): New function.
(note_directory): Use attach_directory, instead of make_directory,
(find_directory, find_directory_meta): Use free_directory.
(procdir): Replace directory prefixes in directory list to avoid
marking subdirectories as renamed after renaming their parent
directory.
(append_incremental_renames): Iterate over directory list, not
hash table, to preserve logical ordering of renames.
* tests/rename04.at, tests/rename05.at: New test cases.
* tests/Makefile.am, tests/testsuite.at: Add rename04.at and
rename05.at.
* tests/atlocal.in (decho): New function.
* tests/multiv06.at: Use decho instead of echo2.
* tests/incremental.at: Raise wait interval to 2 seconds.
2008-07-31 07:12:50 +00:00
Sergey Poznyakoff
1d79c6734c Untabify 2008-07-24 18:16:51 +00:00
Sergey Poznyakoff
3af9cc0f15 Fix multivolume archive creation when volume length=record size.
* src/tar.c (decode_options): Do not allow volume length less
than record size.
* src/buffer.c (_gnu_flush_write): Compensate for the effect
of eventual flush_archive occurring in the middle of buffer
move.
Increment records_written only if _flush_write was able to write
something.
* tests/multiv06.at: New testcase.
* tests/Makefile.am, test/testsuite.at: Add tests/multiv06.at
2008-07-24 18:16:08 +00:00
Sergey Poznyakoff
c9a7297a8a * configure.ac, NEWS: Version 1.20.90
* doc/tar.texi: Document -J, --no-auto-compress, etc.
* src/buffer.c (ct_tar): New constant.
(magic): Add lzop support.  Proposed by Kevin Day
<thekevinday@gmail.com>.
(check_compressed_archive): Do not use autodetect if the
compression program was specified explicitly.
Fall back to analyzing archive name, if the autodetection fails.
* src/suffix.c: Add .lzo
* src/tar.c: New options --lzop and --no-auto-compress.
New short option -J (alias for --lzma).
2008-06-26 10:19:19 +00:00
Sergey Poznyakoff
985637ab5a Bugfixes.
* src/buffer.c (try_new_volume): Print more information with error
diagnostics.
(_gnu_flush_write): Improve error checking.  Adjust
real_s_sizeleft before calling new_volume to avoid creating
malformed multivolume headers.
* tests/delete05.at, tests/gzip.at, tests/ignfail.at,
tests/longv7.at, tests/lustar01.at, tests/lustar02.at,
tests/shortfile.at: Update to match new diagnostic wording
(see 2008-05-06).

* NEWS: Update.
2008-06-26 06:32:25 +00:00
Sergey Poznyakoff
1024343a2b Update 2008-06-14 10:17:42 +00:00
Sergey Poznyakoff
1efa1f3b43 Remove a TZ dependency.Remove a TZ dependency. 2008-06-14 10:17:34 +00:00
Sergey Poznyakoff
5f1a4f9f12 Fix typos. 2008-06-14 10:17:14 +00:00
Sergey Poznyakoff
969d2b986b Update 2008-06-14 10:16:09 +00:00
Sergey Poznyakoff
d5f2066cac (exclude): Document support for new VCS. 2008-06-14 10:16:01 +00:00
Sergey Poznyakoff
79ce0e6789 (exclude_vcs_files): Support for Bazaar, Mercurial and Darcs. 2008-06-14 10:15:25 +00:00
Sergey Poznyakoff
6a052fd5a3 Update 2008-05-05 21:33:51 +00:00
Sergey Poznyakoff
8aa729b90e (main): Reword the "delayed error" message. New wording proposed by Karl Berry. 2008-05-05 21:33:39 +00:00
Sergey Poznyakoff
057dd26a60 Update 2008-05-05 21:31:13 +00:00
38 changed files with 1448 additions and 561 deletions

206
ChangeLog
View File

@@ -1,3 +1,209 @@
2008-11-30 Sergey Poznyakoff <gray@gnu.org.ua>
* src/xheader.c: Remove duplicate inclusion of fnmatch.h. Reported
by Jim Meyering.
2008-11-25 Sergey Poznyakoff <gray@gnu.org.ua>
Do not try to drain the input pipe before closing the
archive.
* src/buffer.c (close_archive): Remove call to
sys_drain_input_pipe. Pass hit_eof as the second
argument to sys_wait_for_child.
* src/common.h (sys_drain_input_pipe): Remove
(sys_wait_for_child): Declare second argument.
* src/system.c (sys_drain_input_pipe): Remove.
(sys_wait_for_child): Take two arguments. The second one helps to
decide whether to tolerate child termination on SIGPIPE.
2008-11-03 Sergey Poznyakoff <gray@gnu.org.ua>
* src/buffer.c (_write_volume_label): Fix typo, which prevented
`-V label -M' from working.
2008-10-30 Sergey Poznyakoff <gray@gnu.org.ua>
* NEWS, configure.ac: Version 1.20.91
* doc/tar.texi: Document transformation scope flags.
* src/common.h (transform_symlinks_option): Remove in favor of
transformation scope flags.
(XFORM_REGFILE, XFORM_LINK, XFORM_SYMLINK, XFORM_ALL): New macros.
(transform_name, transform_member_name, transform_name_fp): Take
an additional argument, specifying scope flags.
* src/create.c: Reflect changes to transform_name.
* src/extract.c (extract_link, extract_symlink): Remove calls to
transform_member_name. It is done in read_header.
* src/list.c (decode_xform): Reflect change in data type of 2nd
argument.
(transform_member_name): 2nd arg is int.
(decode_header): Transform file name and link target names.
* src/tar.c: Remove --transform-symlinks.
* src/transform.c (struct transform): New member `flags'.
(transform_flags): New variable.
(parse_transform_expr): Parse transformation scope flags. Allow to
set global flags using `flags=' syntax.
(_transform_name_to_obstack, transform_name_fp)
(transform_name): Take an additional argument, specifying scope
flags.
2008-10-19 Sergey Poznyakoff <gray@gnu.org.ua>
* THANKS: Add Ed Leaver.
* src/buffer.c (short_read): Remove !read_full_records condition,
which was always false on a first record and thus disabled record
size autodetection. Thanks Ed Leaver for the patch.
(_gnu_flush_read): Handle blocking_factor == 1.
* tests/sparsemv.at: Reflect changes to buffer.c.
* tests/sparsemvp.at: Likewise.
* tests/volsize.at: Likewise.
* NEWS: Update.
2008-10-16 Sergey Poznyakoff <gray@gnu.org.ua>
* src/common.h (transform_symlinks_option): New global.
* src/create.c (dump_file0): Transform symlink targets only if
explicitly required. Thanks Cyril Strejc for reporting the
problem.
* src/tar.c (parse_opt): New options --transform-symlinks and
--no-transform-symlinks. New alias --xform to the --transform
option.
* doc/tar.texi: Document --transform-symlinks
* NEWS: Update.
* THANKS: Update.
* src/names.c (name_gather): Use xzalloc.
* src/buffer.c (short_read): Move record size detection before
the loop.
2008-10-07 Sergey Poznyakoff <gray@gnu.org.ua>
* src/tar.c (options): Add --lzop option.
2008-10-05 Xavier Hienne <xavier.hienne@free.fr> (tiny change)
* src/checkpoint.c (checkpoint_compile_action): Add missing
`else'.
2008-09-24 Sergey Poznyakoff <gray@gnu.org.ua>
* NEWS: Update.
* doc/tar.texi: Update.
* src/tar.c: New option --no-null.
2008-09-23 Sergey Poznyakoff <gray@gnu.org.ua>
* src/common.h (filename_terminator): Remove global.
* src/tar.c (filename_terminator): New static.
* src/names.c (name_next_elt): Do not depend on
filename_terminator, this was a leftover from 1.13.
2008-09-18 Sergey Poznyakoff <gray@gnu.org.ua>
* doc/tar.texi: Remove incorrect example.
2008-09-07 Sergey Poznyakoff <gray@gnu.org.ua>
* src/incremen.c (dumpdir_create0): Eliminate gcc warning.
(attach_directory): Bugfix - add missing return statement.
* THANKS: Add Enric Hernandez
2008-07-31 Sergey Poznyakoff <gray@gnu.org.ua>
* src/incremen.c (struct directory): New member `next'. Change
type of `name'.
(dirhead, dirtail): New statics.
(make_directory): Reflect changes to struct directory.
(free_directory, attach_directory): New functions.
(dirlist_replace_prefix): New function.
(note_directory): Use attach_directory, instead of make_directory,
(find_directory, find_directory_meta): Use free_directory.
(procdir): Replace directory prefixes in directory list to avoid
marking subdirectories as renamed after renaming their parent
directory.
(append_incremental_renames): Iterate over directory list, not
hash table, to preserve logical ordering of renames.
* tests/rename04.at, tests/rename05.at: New test cases.
* tests/Makefile.am, tests/testsuite.at: Add rename04.at and
rename05.at.
* tests/atlocal.in (decho): New function.
* tests/multiv06.at: Use decho instead of echo2.
* tests/incremental.at: Raise wait interval to 2 seconds.
2008-07-24 Sergey Poznyakoff <gray@gnu.org.ua>
* src/tar.c (decode_options): Do not allow volume length less
than record size.
* src/buffer.c (_gnu_flush_write): Compensate for the effect
of eventual flush_archive occurring in the middle of buffer
move.
Increment records_written only if _flush_write was able to write
something.
* tests/multiv06.at: New testcase.
* tests/Makefile.am, test/testsuite.at: Add tests/multiv06.at
2008-06-26 Sergey Poznyakoff <gray@gnu.org.ua>
* configure.ac, NEWS: Version 1.20.90
* doc/tar.texi: Document -J, --no-auto-compress, etc.
* src/buffer.c (ct_tar): New constant.
(magic): Add lzop support. Proposed by Kevin Day
<thekevinday@gmail.com>.
(check_compressed_archive): Do not use autodetect if the
compression program was specified explicitly.
Fall back to analyzing archive name, if the autodetection fails.
* src/suffix.c: Add .lzo
* src/tar.c: New options --lzop and --no-auto-compress.
New short option -J (alias for --lzma).
* src/buffer.c (try_new_volume): Print more information with error
diagnostics.
(_gnu_flush_write): Improve error checking. Adjust
real_s_sizeleft before calling new_volume to avoid creating
malformed multivolume headers.
* tests/delete05.at, tests/gzip.at, tests/ignfail.at,
tests/longv7.at, tests/lustar01.at, tests/lustar02.at,
tests/shortfile.at: Update to match new diagnostic wording
(see 2008-05-06).
* NEWS: Update.
2008-06-14 Sergey Poznyakoff <gray@gnu.org.ua>
* doc/tar.texi (exclude): Document support for new VCS.
* THANKS: Update.
* NEWS: Update.
* tests/multiv05.at: Fix typos.
* tests/volsize.at: Remove a TZ dependency.
2008-06-14 Dan Drake <dan@dandrake.org> (tiny change)
* src/tar.c (exclude_vcs_files): Support for Bazaar, Mercurial and
Darcs.
2008-05-06 Sergey Poznyakoff <gray@gnu.org.ua>
* src/tar.c (main): Reword the "delayed error" message. New
wording proposed by Karl Berry.
2008-02-20 Sergey Poznyakoff <gray@gnu.org.ua>
* configure.ac: Raise version number to 1.20
* src/compare.c (diff_dumpdir): const.
* src/common.h (dumpdir_t,dumpdir_iter_t): New data types.
(dumpdir_create0,dumpdir_create,dumpdir_free,dumpdir_locate)
(dumpdir_first,dumpdir_next): New functions.
* src/incremen.c (dumpdir_create0,dumpdir_create,dumpdir_free)
(dumpdir_first,dumpdir_next): New functions.
(dumpdir_locate): Rewrite using binary search.
(struct directory): Change members char *contents, *icontents to
struct dumpdir *dump, *idump. All references updated.
(note_directory): Last arg is const.
* src/names.c (add_hierarchy_to_namelist): buffer is const.
* tests/incr03.at, tests/incr04.at, tests/rename02.at,
tests/rename03.at: Insert calls to sleep between creation of files
and adding them to the archive.
2008-03-31 Sergey Poznyakoff <gray@gnu.org.ua>
* src/create.c (dump_file0): Count links only for actually dumped

74
NEWS
View File

@@ -1,8 +1,74 @@
GNU tar NEWS - User visible changes. 2008-03-27
GNU tar NEWS - User visible changes. 2008-12-27
Please send GNU tar bug reports to <bug-tar@gnu.org>
version 1.19.90 (CVS)
version 1.21 - Sergey Poznyakoff, 2008-12-27
* New short option -J
A shortcut for --lzma.
* New option --lzop
* New option --no-auto-compress
Cancels the effect of previous --auto-compress (-a) option.
* New option --no-null
Cancels the effect of previous --null option.
* Compressed format recognition
If tar is unable to determine archive compression format, it falls
back to using archive suffix to determine it.
* VCS support.
Using --exclude-vcs handles also files used internally by Bazaar,
Mercurial and Darcs.
* Transformation scope flags
Name transformation expressions understand additional flags that
control type of archive members affected by them. The flags are:
- r
Apply transformation to regular archive members.
- s
Apply transformation to symbolic link targets.
- h
Apply transformation to hard link targets.
Corresponding upper-case letters negate the meaning, so that
`H' means ``do not apply transformation to hard link targets.''
The scope flags are listed in the third part of an `s' expression,
e.g.:
tar --transform 's|^|/usr/local/|S'
Default is `rsh', which means that transformations are applied to
both regular archive members and to the targets of symbolic and hard
links. If several transform expressions are used, the default flags
can be changed using `flags=' statement before the expressions, e.g.:
tar --transform 'flags=S;s|^|/usr/local/|S'
* Bugfixes
** The --null option disabled handling of tar options in list files. This
is fixed.
** Fixed record size autodetection. If detected record size differs from
the expected value (either default, or set on the command line), tar
always prints a warning if verbosity level is set to 1 or greater,
i.e. if either -t or -v option is given.
version 1.20 - Sergey Poznyakoff, 2008-04-14
* New option --auto-compress (-a)
@@ -59,6 +125,10 @@ Names".
The value of the blocking factor is made available to info and
checkpoint scripts via environment variable TAR_BLOCKING_FACTOR.
* Incremental archives
Improved (sped up) extracting from incremental archives.
* Bugfixes.
** Fix bug introduced in version 1.19: tar refused to update non-existing
archives.

4
THANKS
View File

@@ -102,9 +102,11 @@ Clinton Carr clint@netcom.com
Conrad Hughes chughes@maths.tcd.ie
Constantin Belous const@cris.net
Coranth Gryphon gryphon@bur.visidyne.com
Cyril Strejc strejc@unicontrols.cz
Dale R. Worley worley@world.std.com
Dale Wiles wiles@geordi.calspan.com
Dan Bloch dan@transarc.com
Dan Drake dan@dandrake.org
Dan Reish dreish@izzy.net
Daniel Hagerty hag@gnu.org
Daniel Quinlan quinlan@pathname.com
@@ -145,12 +147,14 @@ Drew Sullivan drew@sni.ca
Drew Trieger trieger@woodstock.abbott.com
Dunstan Vavasour dev@cegelecproj.co.uk
Ed Childs echilds@bgs.com
Ed Leaver ewleaver@comcast.net
Edgar Taube et@immd8.informatik.uni-erlangen.de
Eduardo Kortright eduardo@cs.ua.edu
Eduardo V. de Rivas eddie@asterion.com
Edward Welbourne eddy@gen.cam.ac.uk
Elmar Heeb heeb@itp.ethz.ch
Elmer Fittery elmerf@ptw.com
Enric Hernandez ehernandez@notariado.org
Eric Backus ericb@lsid.hp.com
Eric Benson eb@amazon.com
Eric Blake ebb9@byu.net

View File

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

View File

@@ -2407,7 +2407,8 @@ superuser privileges and can be a pain to manage.
@itemx -a
During a @option{--create} operation, enables automatic compressed
format recognition based on the archive suffix. @xref{gzip}.
format recognition based on the archive suffix. The effect of this
option is cancelled by @option{--no-auto-compress}. @xref{gzip}.
@opsummary{backup}
@item --backup=@var{backup-type}
@@ -2785,10 +2786,16 @@ incremental format. @xref{Incremental Dumps}.
@opsummary{lzma}
@item --lzma
@itemx -J
This option tells @command{tar} to read or write archives through
@command{lzma}. @xref{gzip}.
@item --lzop
This option tells @command{tar} to read or write archives through
@command{lzop}. @xref{gzip}.
@opsummary{mode}
@item --mode=@var{permissions}
@@ -2843,6 +2850,12 @@ changed). @xref{after}.
An exclude pattern can match any subsequence of the name's components.
@xref{controlling pattern-matching}.
@opsummary{no-auto-compress}
@item --no-auto-compress
Disables automatic compressed format recognition based on the archive
suffix. @xref{--auto-compress}. @xref{gzip}.
@opsummary{no-check-device}
@item --no-check-device
Do not check device numbers when creating a list of modified files
@@ -2867,6 +2880,13 @@ Use case-sensitive matching.
Print warnings about subprocesses that terminated with a nonzero exit
code. @xref{Writing to an External Program}.
@opsummary{no-null}
@item --no-null
If the @option{--null} option was given previously, this option
cancels its effect, so that any following @option{--files-from}
options will expect their file lists to be newline-terminated.
@opsummary{no-overwrite-dir}
@item --no-overwrite-dir
@@ -3246,8 +3266,9 @@ rather than the data modification time stored in the archive.
@xref{Data Modification Times}.
@opsummary{transform}
@opsummary{xform}
@item --transform=@var{sed-expr}
@itemx --xform=@var{sed-expr}
Transform file or member names using @command{sed} replacement expression
@var{sed-expr}. For example,
@@ -3358,6 +3379,8 @@ them with the equivalent long option.
@item -G @tab @ref{--incremental}.
@item -J @tab @ref{--lzma}.
@item -K @tab @ref{--starting-file}.
@item -L @tab @ref{--tape-length}.
@@ -3411,7 +3434,7 @@ them with the equivalent long option.
@item -o @tab When creating, @ref{--no-same-owner}, when extracting ---
@ref{--portability}.
The later usage is deprecated. It is retained for compatibility with
The latter usage is deprecated. It is retained for compatibility with
the earlier versions of @GNUTAR{}. In future releases
@option{-o} will be equivalent to @option{--no-same-owner} only.
@@ -3886,15 +3909,15 @@ 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}.
Current blocking factor (@pxref{Blocking}).
@vrindex TAR_CHECKPOINT, checkpoint script environment
@item TAR_CHECKPOINT
The checkpoint number.
Number of the checkpoint.
@vrindex TAR_SUBCOMMAND, checkpoint script environment
@item TAR_SUBCOMMAND
A 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, checkpoint script environment
@@ -6732,10 +6755,14 @@ files whose names contain newlines can be archived using
@option{--files-from}.
@table @option
@opindex null
@xopindex{null, described}
@item --null
Only consider @code{NUL} terminated file names, instead of files that
terminate in a newline.
@xopindex{no-null, described}
@item --no-null
Undo the effect of any previous @option{--null} option.
@end table
The @option{--null} option is just like the one in @acronym{GNU}
@@ -6759,7 +6786,37 @@ $ @kbd{find . -size +800 -print0 > long-files}
$ @kbd{tar -c -v --null --files-from=long-files --file=big.tar}
@end smallexample
@FIXME{say anything else here to conclude the section?}
The @option{--no-null} option can be used if you need to read both
zero-terminated and newline-terminated files on the same command line.
For example, if @file{flist} is a newline-terminated file, then the
following command can be used to combine it with the above command:
@smallexample
@group
$ @kbd{find . -size +800 -print0 |
tar -c -f big.tar --null -T - --no-null -T flist}
@end group
@end smallexample
This example uses short options for typographic reasons, to avoid
very long lines.
@GNUTAR is able to automatically detect null-terminated file lists, so
it is safe to use them even without the @option{--null} option. In
this case @command{tar} will print a warning and continue reading such
a file as if @option{--null} were actually given:
@smallexample
@group
$ @kbd{find . -size +800 -print0 | tar -c -f big.tar -T -}
tar: -: file name read contains nul character
@end group
@end smallexample
The null terminator, however, remains in effect only for this
particular file, any following @option{-T} options will assume
newline termination. Of course, the null autodetection applies
to these eventual surplus @option{-T} options as well.
@node exclude
@section Excluding Some Files
@@ -6816,10 +6873,16 @@ However, empty lines are OK.
@cindex CVS, excluding files
@cindex SVN, excluding files
@cindex git, excluding files
@cindex Bazaar, excluding files
@cindex Arch, excluding files
@cindex Mercurial, excluding files
@cindex Darcs, excluding files
@table @option
@opindex exclude-vcs
@item --exclude-vcs
Exclude files and directories used by some version control systems.
Exclude files and directories used by following version control
systems: @samp{CVS}, @samp{RCS}, @samp{SCCS}, @samp{SVN}, @samp{Arch},
@samp{Bazaar}, @samp{Mercurial}, and @samp{Darcs}.
@end table
As of version @value{VERSION}, the following files are excluded:
@@ -6837,6 +6900,13 @@ As of version @value{VERSION}, the following files are excluded:
@item @file{=RELEASE-ID}
@item @file{=meta-update}
@item @file{=update}
@item @file{.bzr}
@item @file{.bzrignore}
@item @file{.bzrtags}
@item @file{.hg}
@item @file{.hgignore}
@item @file{.hgrags}
@item @file{_darcs}
@end itemize
@findex exclude-caches
@@ -7484,7 +7554,7 @@ characters that are quoted by default in the selected quoting style.
@command{Tar} archives contain detailed information about files stored
in them and full file names are part of that information. When
storing file to an archive, its file name is recorded in the archive
storing file to an archive, its file name is recorded in it,
along with the actual file contents. When restoring from an archive,
a file is created on disk with exactly the same name as that stored
in the archive. In the majority of cases this is the desired behavior
@@ -7501,7 +7571,7 @@ directory components, or with otherwise modified names. In other
cases it is desirable to store files under differing names in the
archive.
@GNUTAR{} provides two options for these needs.
@GNUTAR{} provides several options for these needs.
@table @option
@opindex strip-components
@@ -7523,8 +7593,8 @@ The option @option{--strip=2} instructs @command{tar} to strip the
two leading components (@file{usr/} and @file{include/}) off the file
name.
If you add to the above invocation @option{--verbose} (@option{-v})
option, you will note that the verbose listing still contains the
If you add the @option{--verbose} (@option{-v}) option to the invocation
above, you will note that the verbose listing still contains the
full file name, with the two removed components still in place. This
can be inconvenient, so @command{tar} provides a special option for
altering this behavior:
@@ -7549,7 +7619,7 @@ stdlib.h
@end group
@end smallexample
Notice that in both cases the file is @file{stdlib.h} extracted to the
Notice that in both cases the file @file{stdlib.h} is extracted to the
current working directory, @option{--show-transformed-names} affects
only the way its name is displayed.
@@ -7575,7 +7645,9 @@ In case you need to apply more complex modifications to the file name,
@table @option
@opindex transform
@opindex xform
@item --transform=@var{expression}
@itemx --xform=@var{expression}
Modify file names using supplied @var{expression}.
@end table
@@ -7593,6 +7665,21 @@ 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}.
Any delimiter can be used in lieue of @samp{/}, the only requirement being
that it be used consistently throughout the expression. For example,
the following two expressions are equivalent:
@smallexample
@group
s/one/two/
s,one,two,
@end group
@end smallexample
Changing delimiters is often useful when the @var{regex} contains
slashes. For example, it is more convenient to write @code{s,/,-,} than
@code{s/\//-/}.
As in @command{sed}, you can give several replace expressions,
separated by a semicolon.
@@ -7614,7 +7701,7 @@ sed, GNU sed}).
@item @var{number}
Only replace the @var{number}th match of the @var{regexp}.
Note: the @var{posix} standard does not specify what should happen
Note: the @acronym{POSIX} standard does not specify what should happen
when you mix the @samp{g} and @var{number} modifiers. @GNUTAR{}
follows the GNU @command{sed} implementation in this regard, so
the interaction is defined to be: ignore matches before the
@@ -7623,21 +7710,41 @@ the interaction is defined to be: ignore matches before the
@end table
Any delimiter can be used in lieue of @samp{/}, the only requirement being
that it be used consistently throughout the expression. For example,
the following two expressions are equivalent:
In addition, several @dfn{transformation scope} flags are supported,
that control to what files transformations apply. These are:
@table @samp
@item r
Apply transformation to regular archive members.
@item R
Do not apply transformation to regular archive members.
@item s
Apply transformation to symbolic link targets.
@item S
Do not apply transformation to symbolic link targets.
@item h
Apply transformation to hard link targets.
@item H
Do not apply transformation to hard link targets.
@end table
Default is @samp{rsh}, which means to apply tranformations to both archive
members and targets of symbolic and hard links.
Default scope flags can also be changed using @samp{flags=} statement
in the transform expression. The flags set this way remain in force
until next @samp{flags=} statement or end of expression, whichever
occurs first. For example:
@smallexample
@group
s/one/two/
s,one,two,
@end group
--transform 'flags=S;s|^|/usr/local/|'
@end smallexample
Changing delimiters is often useful when the @var{regex} contains
slashes. For example, it is more convenient to write @code{s,/,-,} than
@code{s/\//-/}.
Here are several examples of @option{--transform} usage:
@enumerate
@@ -7654,20 +7761,59 @@ $ @kbd{tar --transform='s,usr/,usr/local/,' -x -f arch.tar}
$ @kbd{tar --transform='s,/*[^/]*/[^/]*/,,' -x -f arch.tar}
@end smallexample
@item Prepend @file{/prefix/} to each file name:
@smallexample
$ @kbd{tar --transform 's,^,/prefix/,' -x -f arch.tar}
@end smallexample
@item Convert each file name to lower case:
@smallexample
$ @kbd{tar --transform 's/.*/\L&/' -x -f arch.tar}
@end smallexample
@item Prepend @file{/prefix/} to each file name:
@smallexample
$ @kbd{tar --transform 's,^,/prefix/,' -x -f arch.tar}
@end smallexample
@item Archive the @file{/lib} directory, prepending @samp{/usr/local}
to each archive member:
@smallexample
$ @kbd{tar --transform 's,^,/usr/local/,S' -c -f arch.tar /lib}
@end smallexample
@end enumerate
Notice the use of flags in the last example. The @file{/lib}
directory often contains many symbolic links to files within it.
It may look, for example, like this:
@smallexample
$ @kbd{ls -l}
drwxr-xr-x root/root 0 2008-07-08 16:20 /lib/
-rwxr-xr-x root/root 1250840 2008-05-25 07:44 /lib/libc-2.3.2.so
lrwxrwxrwx root/root 0 2008-06-24 17:12 /lib/libc.so.6 -> libc-2.3.2.so
...
@end smallexample
Using the expression @samp{s,^,/usr/local/,} would mean adding
@samp{/usr/local} to both regular archive members and to link
targets. In this case, @file{/lib/libc.so.6} would become:
@smallexample
/usr/local/lib/libc.so.6 -> /usr/local/libc-2.3.2.so
@end smallexample
This is definitely not desired. To avoid this, the @samp{S} flag
are used, which excludes symbolic link targets from filename
transformations. The result is:
@smallexample
$ @kbd{tar --transform 's,^,/usr/local/,S', -c -v -f arch.tar \
--show-transformed /lib}
drwxr-xr-x root/root 0 2008-07-08 16:20 /usr/local/lib/
-rwxr-xr-x root/root 1250840 2008-05-25 07:44 /usr/local/lib/libc-2.3.2.so
lrwxrwxrwx root/root 0 2008-06-24 17:12 /usr/local/lib/libc.so.6 ->
libc-2.3.2.so
@end smallexample
Unlike @option{--strip-components}, @option{--transform} can be used
in any @GNUTAR{} operation mode. For example, the following command
adds files to the archive while replacing the leading @file{usr/}
@@ -8112,9 +8258,7 @@ the @file{/} directory first, and then avoid absolute notation.
For example:
@smallexample
$ @kbd{(cd / && tar -c -f archive.tar home)}
# @i{or}:
$ @kbd{tar -c -f archive.tar -C / home}
$ @kbd{tar -c -f archive.tar -C / home}
@end smallexample
@include getdate.texi
@@ -8244,8 +8388,13 @@ switch to @samp{posix}.
@cindex Compressed archives
@cindex Storing archives in compressed format
@cindex gzip
@cindex bzip2
@cindex lzma
@cindex lzop
@cindex compress
@GNUTAR{} is able to create and read compressed archives. It supports
@command{gzip}, @command{bzip2} and @command{lzma} compression
@command{gzip}, @command{bzip2}, @command{lzma} and @command{lzop} 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
@@ -8256,7 +8405,8 @@ Creating a compressed archive is simple: you just specify a
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,
@option{--lzma} to create an @asis{LZMA} compressed archive and
@option{-J} (@option{--lzma}) to create an @asis{LZMA} compressed
archive, @option{--lzop} to create an @asis{LSOP} archive, and
@option{-Z} (@option{--compress}) to use @command{compress} program.
For example:
@@ -8296,6 +8446,12 @@ $ @kbd{tar tf archive.tar.gz}
$ @kbd{tar xf archive.tar.gz}
@end smallexample
The format recognition algorithm is based on @dfn{signatures}, a
special byte sequences in the beginning of file, that are specific for
certain compression formats. If this approach fails, @command{tar}
falls back to using archive name suffix to determine its format
(@xref{auto-compress}, for a list of recognized suffixes).
The only case when you have to specify a decompression option while
reading the archive is when reading from a pipe or from a tape drive
that does not support random access. However, in this case @GNUTAR{}
@@ -8331,7 +8487,7 @@ The following table summarizes compression options used by @GNUTAR{}.
@item --auto-compress
@itemx -a
Select a compression program to use by the archive file name
suffix. The following suffixes are recognized:
suffix. The following suffixes are recognized:
@multitable @columnfractions 0.3 0.6
@headitem Suffix @tab Compression program
@@ -8346,6 +8502,7 @@ suffix. The following suffixes are recognized:
@item @samp{.tbz} @tab @command{bzip2}
@item @samp{.lzma} @tab @command{lzma}
@item @samp{.tlz} @tab @command{lzma}
@item @samp{.lzo} @tab @command{lzop}
@end multitable
@opindex gzip
@@ -8396,8 +8553,14 @@ Filter the archive through @code{bzip2}. Otherwise like @option{--gzip}.
@opindex lzma
@item --lzma
@itemx -J
Filter the archive through @command{lzma}. Otherwise like @option{--gzip}.
@opindex lzop
@item --lzop
Filter the archive through @command{lzop}. Otherwise like
@option{--gzip}.
@opindex compress
@opindex uncompress
@item -Z

View File

@@ -25,6 +25,8 @@ at-func.c
backupfile.c
backupfile.h
basename.c
c-ctype.c
c-ctype.h
canonicalize-lgpl.c
canonicalize.h
charset.alias
@@ -33,6 +35,7 @@ chdir-long.h
chown.c
close-stream.c
close-stream.h
close.c
closeout.c
closeout.h
config.charset
@@ -46,6 +49,7 @@ dirname.c
dirname.h
dup-safer.c
dup2.c
errno.in.h
error.c
error.h
exclude.c
@@ -56,6 +60,7 @@ fchdir.c
fchmodat.c
fchown-stub.c
fchownat.c
fclose.c
fcntl--.h
fcntl-safer.h
fcntl.h
@@ -130,6 +135,7 @@ obstack.c
obstack.h
offtostr.c
open-safer.c
open.c
openat-die.c
openat-priv.h
openat-proc.c
@@ -149,6 +155,8 @@ quote.c
quote.h
quotearg.c
quotearg.h
rawmemchr.c
rawmemchr.valgrind
readlink.c
realloc.c
ref-add.sed
@@ -181,10 +189,13 @@ sleep.c
snprintf.c
stat-macros.h
stat-time.h
stdarg.in.h
stdbool.h
stdbool.in.h
stdint.h
stdint.in.h
stdio-impl.h
stdio-write.c
stdio.h
stdio.in.h
stdlib.h
@@ -192,6 +203,7 @@ stdlib.in.h
stpcpy.c
strcasecmp.c
strchrnul.c
strchrnul.valgrind
strdup.c
streq.h
strerror.c
@@ -253,6 +265,7 @@ wchar.in.h
wctype.h
wctype.in.h
wcwidth.c
write.c
xalloc-die.c
xalloc.h
xgetcwd.c

File diff suppressed because it is too large Load Diff

View File

@@ -80,7 +80,7 @@ checkpoint_compile_action (const char *str)
if (strcmp (str, ".") == 0 || strcmp (str, "dot") == 0)
alloc_action (cop_dot);
if (strcmp (str, "bell") == 0)
else if (strcmp (str, "bell") == 0)
alloc_action (cop_bell);
else if (strcmp (str, "echo") == 0)
alloc_action (cop_echo);

View File

@@ -93,9 +93,6 @@ GLOBAL enum subcommand subcommand_option;
/* Selected format for output archive. */
GLOBAL enum archive_format archive_format;
/* Either NL or NUL, as decided by the --null option. */
GLOBAL char filename_terminator;
/* Size of each record, once in blocks, once in bytes. Those two variables
are always related, the second being BLOCKSIZE times the first. They do
not have _option in their name, even if their values is derived from
@@ -702,8 +699,7 @@ char *xheader_format_name (struct tar_stat_info *st, const char *fmt,
void sys_detect_dev_null_output (void);
void sys_save_archive_dev_ino (void);
void sys_drain_input_pipe (void);
void sys_wait_for_child (pid_t);
void sys_wait_for_child (pid_t, bool);
void sys_spawn_shell (void);
bool sys_compare_uid (struct stat *a, struct stat *b);
bool sys_compare_gid (struct stat *a, struct stat *b);
@@ -738,17 +734,16 @@ bool string_ascii_p (const char *str);
bool utf8_convert (bool to_utf, char const *input, char **output);
/* Module transform.c */
typedef enum
{
xform_regfile,
xform_link,
xform_symlink
} xform_type;
#define XFORM_REGFILE 0x01
#define XFORM_LINK 0x02
#define XFORM_SYMLINK 0x04
#define XFORM_ALL (XFORM_REGFILE|XFORM_LINK|XFORM_SYMLINK)
void set_transform_expr (const char *expr);
bool transform_name (char **pinput);
bool transform_member_name (char **pinput, xform_type type);
bool transform_name_fp (char **pinput, char *(*fun)(char *, void *), void *);
bool transform_name (char **pinput, int type);
bool transform_member_name (char **pinput, int type);
bool transform_name_fp (char **pinput, int type,
char *(*fun)(char *, void *), void *);
/* Module suffix.c */
void set_comression_program_by_suffix (const char *name, const char *defprog);

View File

@@ -1041,7 +1041,7 @@ dump_regular_file (int fd, struct tar_stat_info *st)
while (size_left > 0)
{
size_t bufsize, count;
mv_size_left (size_left);
blk = find_next_block ();
@@ -1495,7 +1495,7 @@ dump_file0 (struct tar_stat_info *st, const char *p,
assign_string (&st->file_name,
safer_name_suffix (p, false, absolute_names_option));
transform_name (&st->file_name);
transform_name (&st->file_name, XFORM_REGFILE);
if (deref_stat (dereference_option, p, &st->stat) != 0)
{
@@ -1705,7 +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);
transform_name (&st->link_name, XFORM_SYMLINK);
if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) < size)
write_long_link (st);

View File

@@ -917,7 +917,6 @@ extract_link (char *file_name, int typeflag)
int interdir_made = 0;
char const *link_name;
transform_member_name (&current_stat_info.link_name, xform_link);
link_name = current_stat_info.link_name;
if (! absolute_names_option && contains_dot_dot (link_name))
@@ -974,8 +973,6 @@ extract_symlink (char *file_name, int typeflag)
int status;
int interdir_made = 0;
transform_member_name (&current_stat_info.link_name, xform_symlink);
if (! absolute_names_option
&& (IS_ABSOLUTE_FILE_NAME (current_stat_info.link_name)
|| contains_dot_dot (current_stat_info.link_name)))

View File

@@ -60,6 +60,7 @@ struct dumpdir /* Dump directory listing */
/* Directory attributes. */
struct directory
{
struct directory *next;
struct timespec mtime; /* Modification time */
dev_t device_number; /* device number for directory */
ino_t inode_number; /* inode number for directory */
@@ -72,7 +73,7 @@ struct directory
the original directory structure */
const char *tagfile; /* Tag file, if the directory falls under
exclusion_tag_under */
char name[1]; /* file name of directory */
char *name; /* file name of directory */
};
struct dumpdir *
@@ -80,13 +81,14 @@ dumpdir_create0 (const char *contents, const char *cmask)
{
struct dumpdir *dump;
size_t i, total, ctsize, len;
const char *p;
char *p;
const char *q;
for (i = 0, total = 0, ctsize = 1, p = contents; *p; total++, p += len)
for (i = 0, total = 0, ctsize = 1, q = contents; *q; total++, q += len)
{
len = strlen (p) + 1;
len = strlen (q) + 1;
ctsize += len;
if (!cmask || strchr (cmask, *p))
if (!cmask || strchr (cmask, *q))
i++;
}
dump = xmalloc (sizeof (*dump) + ctsize);
@@ -196,6 +198,7 @@ dumpdir_size (const char *p)
}
static struct directory *dirhead, *dirtail;
static Hash_table *directory_table;
static Hash_table *directory_meta_table;
@@ -247,18 +250,68 @@ static struct directory *
make_directory (const char *name)
{
size_t namelen = strlen (name);
size_t size = offsetof (struct directory, name) + namelen + 1;
struct directory *directory = xmalloc (size);
struct directory *directory = xmalloc (sizeof (*directory));
directory->next = NULL;
directory->dump = directory->idump = NULL;
directory->orig = NULL;
directory->flags = false;
strcpy (directory->name, name);
if (namelen && ISSLASH (directory->name[namelen - 1]))
directory->name[namelen - 1] = 0;
if (namelen && ISSLASH (name[namelen - 1]))
namelen--;
directory->name = xmalloc (namelen + 1);
memcpy (directory->name, name, namelen);
directory->name[namelen] = 0;
directory->tagfile = NULL;
return directory;
}
static void
free_directory (struct directory *dir)
{
free (dir->name);
free (dir);
}
static struct directory *
attach_directory (const char *name)
{
struct directory *dir = make_directory (name);
if (dirtail)
dirtail->next = dir;
else
dirhead = dir;
dirtail = dir;
return dir;
}
static void
replace_prefix (char **pname, const char *samp, size_t slen,
const char *repl, size_t rlen)
{
char *name = *pname;
size_t nlen = strlen (name);
if (nlen > slen && memcmp (name, samp, slen) == 0 && ISSLASH (name[slen]))
{
if (rlen > slen)
{
name = xrealloc (name, nlen - slen + rlen + 1);
*pname = name;
}
memmove (name + rlen, name + slen, nlen - slen + 1);
memcpy (name, repl, rlen);
}
}
void
dirlist_replace_prefix (const char *pref, const char *repl)
{
struct directory *dp;
size_t pref_len = strlen (pref);
size_t repl_len = strlen (repl);
for (dp = dirhead; dp; dp = dp->next)
replace_prefix (&dp->name, pref, pref_len, repl, repl_len);
}
/* Create and link a new directory entry for directory NAME, having a
device number DEV and an inode number INO, with NFS indicating
whether it is an NFS device and FOUND indicating whether we have
@@ -268,7 +321,7 @@ note_directory (char const *name, struct timespec mtime,
dev_t dev, ino_t ino, bool nfs, bool found,
const char *contents)
{
struct directory *directory = make_directory (name);
struct directory *directory = attach_directory (name);
directory->mtime = mtime;
directory->device_number = dev;
@@ -311,7 +364,7 @@ find_directory (const char *name)
{
struct directory *dir = make_directory (name);
struct directory *ret = hash_lookup (directory_table, dir);
free (dir);
free_directory (dir);
return ret;
}
}
@@ -330,7 +383,7 @@ find_directory_meta (dev_t dev, ino_t ino)
dir->device_number = dev;
dir->inode_number = ino;
ret = hash_lookup (directory_meta_table, dir);
free (dir);
free_directory (dir);
return ret;
}
}
@@ -386,12 +439,16 @@ procdir (char *name_buffer, struct stat *stat_data,
stat_data->st_ino);
if (d)
{
if (verbose_option)
WARN ((0, 0, _("%s: Directory has been renamed from %s"),
quotearg_colon (name_buffer),
quote_n (1, d->name)));
directory->orig = d;
DIR_SET_FLAG (directory, DIRF_RENAMED);
if (strcmp (d->name, name_buffer))
{
if (verbose_option)
WARN ((0, 0, _("%s: Directory has been renamed from %s"),
quotearg_colon (name_buffer),
quote_n (1, d->name)));
directory->orig = d;
DIR_SET_FLAG (directory, DIRF_RENAMED);
dirlist_replace_prefix (d->name, name_buffer);
}
directory->children = CHANGED_CHILDREN;
}
else
@@ -426,12 +483,16 @@ procdir (char *name_buffer, struct stat *stat_data,
if (d)
{
if (verbose)
WARN ((0, 0, _("%s: Directory has been renamed from %s"),
quotearg_colon (name_buffer),
quote_n (1, d->name)));
directory->orig = d;
DIR_SET_FLAG (directory, DIRF_RENAMED);
if (strcmp (d->name, name_buffer))
{
if (verbose)
WARN ((0, 0, _("%s: Directory has been renamed from %s"),
quotearg_colon (name_buffer),
quote_n (1, d->name)));
directory->orig = d;
DIR_SET_FLAG (directory, DIRF_RENAMED);
dirlist_replace_prefix (d->name, name_buffer);
}
directory->children = CHANGED_CHILDREN;
}
else
@@ -701,12 +762,9 @@ obstack_code_rename (struct obstack *stk, char *from, char *to)
obstack_grow (stk, s, strlen (s) + 1);
}
static bool
rename_handler (void *data, void *proc_data)
static void
store_rename (struct directory *dir, struct obstack *stk)
{
struct directory *dir = data;
struct obstack *stk = proc_data;
if (DIR_IS_RENAMED (dir))
{
struct directory *prev, *p;
@@ -745,7 +803,6 @@ rename_handler (void *data, void *proc_data)
obstack_code_rename (stk, "", prev->name);
}
}
return true;
}
const char *
@@ -753,8 +810,9 @@ append_incremental_renames (const char *dump)
{
struct obstack stk;
size_t size;
if (directory_table == NULL)
struct directory *dp;
if (dirhead == NULL)
return dump;
obstack_init (&stk);
@@ -766,7 +824,9 @@ append_incremental_renames (const char *dump)
else
size = 0;
hash_do_for_each (directory_table, rename_handler, &stk);
for (dp = dirhead; dp; dp = dp->next)
store_rename (dp, &stk);
if (obstack_object_size (&stk) != size)
{
obstack_1grow (&stk, 0);

View File

@@ -472,11 +472,11 @@ read_header (bool raw_extended_headers)
static char *
decode_xform (char *file_name, void *data)
{
xform_type type = *(xform_type*)data;
int type = *(int*)data;
switch (type)
{
case xform_symlink:
case XFORM_SYMLINK:
/* FIXME: It is not quite clear how and to which extent are the symbolic
links subject to filename transformation. In the absence of another
solution, symbolic links are exempt from component stripping and
@@ -484,11 +484,11 @@ decode_xform (char *file_name, void *data)
proper. */
return file_name;
case xform_link:
case XFORM_LINK:
file_name = safer_name_suffix (file_name, true, absolute_names_option);
break;
case xform_regfile:
case XFORM_REGFILE:
file_name = safer_name_suffix (file_name, false, absolute_names_option);
break;
}
@@ -505,9 +505,9 @@ decode_xform (char *file_name, void *data)
}
bool
transform_member_name (char **pinput, xform_type type)
transform_member_name (char **pinput, int type)
{
return transform_name_fp (pinput, decode_xform, &type);
return transform_name_fp (pinput, type, decode_xform, &type);
}
#define ISOCTAL(c) ((c)>='0'&&(c)<='7')
@@ -628,7 +628,16 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
stat_info->is_dumpdir = true;
}
transform_member_name (&stat_info->file_name, xform_regfile);
transform_member_name (&stat_info->file_name, XFORM_REGFILE);
switch (header->header.typeflag)
{
case SYMTYPE:
transform_member_name (&stat_info->link_name, XFORM_SYMLINK);
break;
case LNKTYPE:
transform_member_name (&stat_info->link_name, XFORM_LINK);
}
}
/* Convert buffer at WHERE0 of size DIGS from external format to

View File

@@ -289,9 +289,8 @@ static int matching_flags; /* exclude_fnmatch options */
static storage and can't be relied upon across two calls.
If CHANGE_DIRS is true, treat any entries of type NELT_CHDIR as
the request to change to the given directory. If filename_terminator
is NUL, CHANGE_DIRS is effectively always false.
the request to change to the given directory.
Entries of type NELT_FMASK cause updates of the matching_flags
value. */
struct name_elt *
@@ -301,9 +300,6 @@ name_next_elt (int change_dirs)
const char *source;
char *cursor;
if (filename_terminator == '\0')
change_dirs = 0;
while (name_index != names)
{
struct name_elt *ep;
@@ -392,9 +388,7 @@ name_gather (void)
if (allocated_size == 0)
{
allocated_size = offsetof (struct name, name) + NAME_FIELD_SIZE + 1;
buffer = xmalloc (allocated_size);
/* FIXME: This memset is overkill, and ugly... */
memset (buffer, 0, allocated_size);
buffer = xzalloc (allocated_size);
}
while ((ep = name_next_elt (0)) && ep->type == NELT_CHDIR)

View File

@@ -39,6 +39,7 @@ struct compression_suffix compression_suffixes[] = {
{ S(tz2, bzip2) },
{ S(lzma, lzma) },
{ S(tlz, lzma) },
{ S(lzo, lzop) },
#undef S
};

View File

@@ -1,6 +1,7 @@
/* System-dependent calls for tar.
Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 2003, 2004, 2005, 2006, 2007,
2008 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -51,12 +52,7 @@ sys_detect_dev_null_output (void)
}
void
sys_drain_input_pipe (void)
{
}
void
sys_wait_for_child (pid_t child_pid)
sys_wait_for_child (pid_t child_pid, bool eof)
{
}
@@ -160,26 +156,8 @@ sys_detect_dev_null_output (void)
&& archive_stat.st_ino == dev_null_stat.st_ino));
}
/* Manage to fully drain a pipe we might be reading, so to not break it on
the producer after the EOF block. FIXME: one of these days, GNU tar
might become clever enough to just stop working, once there is no more
work to do, we might have to revise this area in such time. */
void
sys_drain_input_pipe (void)
{
size_t r;
if (access_mode == ACCESS_READ
&& ! _isrmt (archive)
&& (S_ISFIFO (archive_stat.st_mode) || S_ISSOCK (archive_stat.st_mode)))
while ((r = rmtread (archive, record_start->buffer, record_size)) != 0
&& r != SAFE_READ_ERROR)
continue;
}
void
sys_wait_for_child (pid_t child_pid)
sys_wait_for_child (pid_t child_pid, bool eof)
{
if (child_pid)
{
@@ -193,8 +171,11 @@ sys_wait_for_child (pid_t child_pid)
}
if (WIFSIGNALED (wait_status))
ERROR ((0, 0, _("Child died with signal %d"),
WTERMSIG (wait_status)));
{
int sig = WTERMSIG (wait_status);
if (!(!eof && sig == SIGPIPE))
ERROR ((0, 0, _("Child died with signal %d"), sig));
}
else if (WEXITSTATUS (wait_status) != 0)
ERROR ((0, 0, _("Child returned status %d"),
WEXITSTATUS (wait_status)));

View File

@@ -271,15 +271,17 @@ enum
IGNORE_FAILED_READ_OPTION,
INDEX_FILE_OPTION,
KEEP_NEWER_FILES_OPTION,
LZMA_OPTION,
LZOP_OPTION,
MODE_OPTION,
MTIME_OPTION,
NEWER_MTIME_OPTION,
NO_ANCHORED_OPTION,
NO_AUTO_COMPRESS_OPTION,
NO_CHECK_DEVICE_OPTION,
NO_DELAY_DIRECTORY_RESTORE_OPTION,
NO_IGNORE_CASE_OPTION,
NO_IGNORE_COMMAND_ERROR_OPTION,
NO_NULL_OPTION,
NO_OVERWRITE_DIR_OPTION,
NO_QUOTE_CHARS_OPTION,
NO_RECURSION_OPTION,
@@ -350,7 +352,7 @@ The version control may be set with --backup or VERSION_CONTROL, values are:\n\n
/* NOTE:
Available option letters are DEIJQY and eqy. Consider the following
Available option letters are DEIQY and eqy. Consider the following
assignments:
[For Solaris tar compatibility =/= Is it important at all?]
@@ -592,6 +594,9 @@ static struct argp_option options[] = {
N_("Compression options:"), GRID },
{"auto-compress", 'a', 0, 0,
N_("use archive suffix to determine the compression program"), GRID+1 },
{"no-auto-compress", NO_AUTO_COMPRESS_OPTION, 0, 0,
N_("do not use use archive suffix to determine the compression program"),
GRID+1 },
{"bzip2", 'j', 0, 0,
N_("filter the archive through bzip2"), GRID+1 },
{"gzip", 'z', 0, 0,
@@ -601,8 +606,10 @@ static struct argp_option options[] = {
{"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,
{"lzma", 'J', 0, 0,
N_("filter the archive through lzma"), GRID+1 },
{"lzop", LZOP_OPTION, 0, 0,
N_("filter the archive through lzop"), GRID+8 },
{"use-compress-program", USE_COMPRESS_PROGRAM_OPTION, N_("PROG"), 0,
N_("filter through PROG (must accept -d)"), GRID+1 },
#undef GRID
@@ -619,6 +626,8 @@ static struct argp_option options[] = {
N_("get names to extract or create from FILE"), GRID+1 },
{"null", NULL_OPTION, 0, 0,
N_("-T reads null-terminated names, disable -C"), GRID+1 },
{"no-null", NO_NULL_OPTION, 0, 0,
N_("disable the effect of the previous --null option"), GRID+1 },
{"unquote", UNQUOTE_OPTION, 0, 0,
N_("unquote filenames read with -T (default)"), GRID+1 },
{"no-unquote", NO_UNQUOTE_OPTION, 0, 0,
@@ -677,6 +686,7 @@ static struct argp_option options[] = {
GRID+1 },
{"transform", TRANSFORM_OPTION, N_("EXPRESSION"), 0,
N_("use sed replace EXPRESSION to transform file names"), GRID+1 },
{"xform", 0, 0, OPTION_ALIAS, NULL, GRID+1 },
#undef GRID
#define GRID 120
@@ -849,6 +859,16 @@ exclude_vcs_files ()
"=RELEASE-ID",
"=meta-update",
"=update",
/* Bazaar */
".bzr",
".bzrignore",
".bzrtags",
/* Mercurial */
".hg",
".hgignore",
".hgtags",
/* darcs */
"_darcs",
NULL
};
@@ -1029,6 +1049,9 @@ report_textual_dates (struct tar_args *args)
static volatile int _argp_hang;
/* Either NL or NUL, as decided by the --null option. */
static char filename_terminator;
enum read_file_list_state /* Result of reading file name from the list file */
{
file_list_success, /* OK, name read successfully */
@@ -1037,16 +1060,16 @@ enum read_file_list_state /* Result of reading file name from the list file */
file_list_skip /* Empty (zero-length) entry encountered, skip it */
};
/* Read from FP a sequence of characters up to FILENAME_TERMINATOR and put them
/* Read from FP a sequence of characters up to TERM and put them
into STK.
*/
static enum read_file_list_state
read_name_from_file (FILE *fp, struct obstack *stk)
read_name_from_file (FILE *fp, struct obstack *stk, int term)
{
int c;
size_t counter = 0;
for (c = getc (fp); c != EOF && c != filename_terminator; c = getc (fp))
for (c = getc (fp); c != EOF && c != term; c = getc (fp))
{
if (c == 0)
{
@@ -1127,7 +1150,8 @@ update_argv (const char *filename, struct argp_state *state)
size_t new_argc;
bool is_stdin = false;
enum read_file_list_state read_state;
int term = filename_terminator;
if (!strcmp (filename, "-"))
{
is_stdin = true;
@@ -1141,7 +1165,8 @@ update_argv (const char *filename, struct argp_state *state)
open_fatal (filename);
}
while ((read_state = read_name_from_file (fp, &argv_stk)) != file_list_end)
while ((read_state = read_name_from_file (fp, &argv_stk, term))
!= file_list_end)
{
switch (read_state)
{
@@ -1170,7 +1195,7 @@ update_argv (const char *filename, struct argp_state *state)
obstack_1grow (&argv_stk, 0);
count = 1;
/* Read rest of files using new filename terminator */
filename_terminator = 0;
term = 0;
break;
}
@@ -1187,7 +1212,7 @@ update_argv (const char *filename, struct argp_state *state)
start = obstack_finish (&argv_stk);
if (filename_terminator == 0)
if (term == 0)
for (p = start; *p; p += strlen (p) + 1)
if (p[0] == '-')
count++;
@@ -1203,7 +1228,7 @@ update_argv (const char *filename, struct argp_state *state)
for (i = state->next, p = start; *p; p += strlen (p) + 1, i++)
{
if (filename_terminator == 0 && p[0] == '-')
if (term == 0 && p[0] == '-')
state->argv[i++] = "--add-file";
state->argv[i] = p;
}
@@ -1252,6 +1277,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
case 'a':
args->compress_autodetect = true;
break;
case NO_AUTO_COMPRESS_OPTION:
args->compress_autodetect = false;
break;
case 'b':
{
@@ -1345,6 +1374,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
set_use_compress_program_option ("bzip2");
break;
case 'J':
set_use_compress_program_option ("lzma");
break;
case 'k':
/* Don't replace existing files. */
old_files_option = KEEP_OLD_FILES;
@@ -1376,8 +1409,8 @@ parse_opt (int key, char *arg, struct argp_state *state)
}
break;
case LZMA_OPTION:
set_use_compress_program_option ("lzma");
case LZOP_OPTION:
set_use_compress_program_option ("lzop");
break;
case 'm':
@@ -1721,6 +1754,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
filename_terminator = '\0';
break;
case NO_NULL_OPTION:
filename_terminator = '\n';
break;
case NUMERIC_OWNER_OPTION:
numeric_owner_option = true;
break;
@@ -1783,6 +1820,8 @@ parse_opt (int key, char *arg, struct argp_state *state)
/* FIXME: What it is good for? */
same_permissions_option = true;
same_order_option = true;
WARN ((0, 0, _("The --preserve option is deprecated, "
"use --preserve-permissions --preserve-order instead")));
break;
case RECORD_SIZE_OPTION:
@@ -2307,6 +2346,13 @@ decode_options (int argc, char **argv)
else if (utc_option)
verbose_option = 2;
if (tape_length_option && tape_length_option < record_size)
USAGE_ERROR ((0, 0, _("Volume length cannot be less than record size")));
if (same_order_option && listed_incremental_option)
USAGE_ERROR ((0, 0, _("--preserve-order is not compatible with "
"--listed-incremental")));
/* Forbid using -c with no input files whatsoever. Check that `-f -',
explicit or implied, is used correctly. */
@@ -2480,7 +2526,7 @@ main (int argc, char **argv)
name_term ();
if (exit_status == TAREXIT_FAILURE)
error (0, 0, _("Error exit delayed from previous errors"));
error (0, 0, _("Exiting with failure status due to previous errors"));
if (stdlis == stdout)
close_stdout ();

View File

@@ -61,6 +61,7 @@ struct transform
{
struct transform *next;
enum transform_type transform_type;
int flags;
unsigned match_number;
regex_t regex;
/* Compiled replacement expression */
@@ -69,6 +70,8 @@ struct transform
};
int transform_flags = XFORM_ALL;
static struct transform *transform_head, *transform_tail;
static struct transform *
@@ -131,6 +134,41 @@ add_backref_segment (struct transform *tf, size_t ref)
segm->v.ref = ref;
}
static int
parse_xform_flags (int *pflags, int c)
{
switch (c)
{
case 'r':
*pflags |= XFORM_REGFILE;
break;
case 'R':
*pflags &= ~XFORM_REGFILE;
break;
case 'h':
*pflags |= XFORM_LINK;
break;
case 'H':
*pflags &= ~XFORM_LINK;
break;
case 's':
*pflags |= XFORM_SYMLINK;
break;
case 'S':
*pflags &= ~XFORM_SYMLINK;
break;
default:
return 1;
}
return 0;
}
static void
add_case_ctl_segment (struct transform *tf, enum case_ctl_type ctl)
{
@@ -150,8 +188,26 @@ parse_transform_expr (const char *expr)
struct transform *tf = new_transform ();
if (expr[0] != 's')
USAGE_ERROR ((0, 0, _("Invalid transform expression")));
{
if (strncmp (expr, "flags=", 6) == 0)
{
transform_flags = 0;
for (expr += 6; *expr; expr++)
{
if (*expr == ';')
{
expr++;
break;
}
if (parse_xform_flags (&transform_flags, *expr))
USAGE_ERROR ((0, 0, _("Unknown transform flag: %c"),
*expr));
}
return expr;
}
USAGE_ERROR ((0, 0, _("Invalid transform expression")));
}
delim = expr[1];
/* Scan regular expression */
@@ -172,6 +228,7 @@ parse_transform_expr (const char *expr)
/* Check flags */
tf->transform_type = transform_first;
tf->flags = transform_flags;
for (p = expr + j + 1; *p && *p != ';'; p++)
switch (*p)
{
@@ -186,7 +243,7 @@ parse_transform_expr (const char *expr)
case 'x':
cflags |= REG_EXTENDED;
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
tf->match_number = strtoul (p, (char**) &p, 0);
@@ -194,8 +251,9 @@ parse_transform_expr (const char *expr)
break;
default:
USAGE_ERROR ((0, 0, _("Unknown flag in transform expression: %c"),
*p));
if (parse_xform_flags (&tf->flags, *p))
USAGE_ERROR ((0, 0, _("Unknown flag in transform expression: %c"),
*p));
}
if (*p == ';')
@@ -520,10 +578,11 @@ _single_transform_name_to_obstack (struct transform *tf, char *input)
}
bool
_transform_name_to_obstack (char *input, char **output)
_transform_name_to_obstack (int flags, char *input, char **output)
{
struct transform *tf;
bool alloced = false;
if (!stk_init)
{
obstack_init (&stk);
@@ -532,18 +591,23 @@ _transform_name_to_obstack (char *input, char **output)
for (tf = transform_head; tf; tf = tf->next)
{
_single_transform_name_to_obstack (tf, input);
input = obstack_finish (&stk);
if (tf->flags & flags)
{
_single_transform_name_to_obstack (tf, input);
input = obstack_finish (&stk);
alloced = true;
}
}
*output = input;
return transform_head != NULL;
return alloced;
}
bool
transform_name_fp (char **pinput, char *(*fun)(char *, void *), void *dat)
transform_name_fp (char **pinput, int flags,
char *(*fun)(char *, void *), void *dat)
{
char *str;
bool ret = _transform_name_to_obstack (*pinput, &str);
bool ret = _transform_name_to_obstack (flags, *pinput, &str);
if (ret)
{
assign_string (pinput, fun ? fun (str, dat) : str);
@@ -560,8 +624,8 @@ transform_name_fp (char **pinput, char *(*fun)(char *, void *), void *dat)
}
bool
transform_name (char **pinput)
transform_name (char **pinput, int type)
{
return transform_name_fp (pinput, NULL, NULL);
return transform_name_fp (pinput, type, NULL, NULL);
}

View File

@@ -25,8 +25,6 @@
#include "common.h"
#include <fnmatch.h>
static bool xheader_protected_pattern_p (char const *pattern);
static bool xheader_protected_keyword_p (char const *keyword);
static void xheader_set_single_keyword (char *) __attribute__ ((noreturn));

View File

@@ -89,6 +89,7 @@ TESTSUITE_AT = \
multiv03.at\
multiv04.at\
multiv05.at\
multiv06.at\
old.at\
options.at\
options02.at\
@@ -97,6 +98,8 @@ TESTSUITE_AT = \
rename01.at\
rename02.at\
rename03.at\
rename04.at\
rename05.at\
same-order01.at\
same-order02.at\
shortfile.at\

View File

@@ -30,4 +30,8 @@ tarball_prereq() {
echo "$2 $3/$1" | md5sum --status --check - >/dev/null 2>&1
}
decho() {
echo $*
echo >&2 $*
}

View File

@@ -42,7 +42,7 @@ tar tf archive
to
],
[tar: tre: Not found in archive
tar: Error exit delayed from previous errors
tar: Exiting with failure status due to previous errors
])
AT_CLEANUP

View File

@@ -35,7 +35,7 @@ test $? = 2 || exit 1
[
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error exit delayed from previous errors
tar: Exiting with failure status due to previous errors
],
[],[])

View File

@@ -64,12 +64,12 @@ test $status = 0
[
-----
tar: file: Cannot open: Permission denied
tar: Error exit delayed from previous errors
tar: Exiting with failure status due to previous errors
-----
tar: file: Warning: Cannot open: Permission denied
-----
tar: directory: Cannot open: Permission denied
tar: Error exit delayed from previous errors
tar: Exiting with failure status due to previous errors
-----
tar: directory: Warning: Cannot open: Permission denied
])

View File

@@ -44,7 +44,10 @@ sleep 1
tar cf archive --listed=list structure
tar cfv archive --listed=list structure
echo separator
sleep 1
# ReiserFS often offsets the timestamps of newly created files
# 1 second to the past. Try to compensate for it, until a better
# solution is found.
sleep 2
echo y >structure/file
tar cfv archive --listed=list structure
],

View File

@@ -39,7 +39,7 @@ tar --create \
tar tf archive.1 || exit 1
sleep 1
sleep 2
genfile --length 10240 --pattern zeros --file directory/file2

View File

@@ -40,7 +40,7 @@ tar tf archive
DIR/
],
[tar: DIR/FILE: file name is too long (max 99); not dumped
tar: Error exit delayed from previous errors
tar: Exiting with failure status due to previous errors
],
[],[],[v7])

View File

@@ -31,7 +31,7 @@ tar cf archive LONGNAME
[2],
[],
[tar: LONGNAME: file name is too long (cannot be split); not dumped
tar: Error exit delayed from previous errors
tar: Exiting with failure status due to previous errors
],[],[],[ustar])
AT_CLEANUP

View File

@@ -36,7 +36,7 @@ tar cf archive PREFIX_155
[2],
[],
[tar: PREFIX_155/: file name is too long (cannot be split); not dumped
tar: Error exit delayed from previous errors
tar: Exiting with failure status due to previous errors
],[],[],[ustar])
AT_CLEANUP

View File

@@ -1,7 +1,7 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2006, 2007 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
@@ -19,11 +19,11 @@
# 02110-1301, USA.
# Up to version 1.15.91 tar was unable to recognize all volumes
# given after an aout-of-sync volume.
# given after an out-of-sync volume.
# Reported by: Joerg Weilbier <gnu@weilbier.net>
# References: <200610011952.29880.gnu@weilbier.net>
AT_SETUP([Restoring after an out of sync folume])
AT_SETUP([Restoring after an out of sync volume])
AT_KEYWORDS([multivolume multiv multiv05 sync])
m4_define([FILELIST],[jeden,dwa,trzy,cztery,piec,szesc])

52
tests/multiv06.at Normal file
View File

@@ -0,0 +1,52 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 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 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.
# When volume size equals record size, swapping buffers in
# new_volume triggers a call to flush_archive. The size left variables
# must be corrected after that, which was not done in versions <= 1.20.
# Reported by: Marek Kielar <mkielar@go2.pl>
# References: <1907cbb6.79e32b49.48887f09.fd55@o2.pl>
AT_SETUP([Multivolumes with L=record_size])
AT_KEYWORDS([multivolume multiv multiv06])
AT_TAR_CHECK([
exec <&-
decho Creating file
genfile --length 20139 --file file
decho Creating archive
tar -c -M -L10 -b20 -farc.1 -farc.2 -farc.3 file
decho Testing archive
tar -t -M -farc.1 -farc.2 -farc.3],
[0],
[Creating file
Creating archive
Testing archive
file
],
[Creating file
Creating archive
Testing archive
],
[],[],
[gnu, pax])
AT_CLEANUP

83
tests/rename04.at Normal file
View File

@@ -0,0 +1,83 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 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 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.
# Description: Up to version 1.20, when storing a record for renamed
# directory in an incremental archive, tar incorrectly flagged all its
# subdirectories as renamed, which led to problems at archive extraction.
# References: <00a401c8ecc0$56b7ef30$6a17a8c0@inti.com>
# Reported by: Enric Hernandez <ehernandez@notariado.org>
AT_SETUP([renamed directory containing subdirectories])
AT_KEYWORDS([incremental rename04 rename])
AT_TAR_CHECK([
AT_SORT_PREREQ
decho Creating directory structure
mkdir directory
mkdir directory/subdir
genfile --file=directory/file
decho Creating initial archive
tar -cf archive.1 -g db.1 directory
decho Renaming
mv directory dir
decho Creating incremental archive
cp db.1 db.2
tar -cf archive.2 -g db.2 dir
mv dir orig
decho First restore
tar -xf archive.1 -g db.1
find directory | sort
decho Second restore
tar -xf archive.2 -g db.2
find dir | sort
],
[0],
[Creating directory structure
Creating initial archive
Renaming
Creating incremental archive
First restore
directory
directory/file
directory/subdir
Second restore
dir
dir/subdir
],
[Creating directory structure
Creating initial archive
Renaming
Creating incremental archive
First restore
Second restore
],[],[],[gnu, oldgnu, posix])
AT_CLEANUP
# End of rename04.at

81
tests/rename05.at Normal file
View File

@@ -0,0 +1,81 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 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 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.
# Description: A continuation of rename04.at, that checks additionally if
# renamed subdirectories are restored correctly.
AT_SETUP([renamed subdirectories])
AT_KEYWORDS([incremental rename05 rename])
AT_TAR_CHECK([
AT_SORT_PREREQ
decho Creating directory structure
mkdir directory
mkdir directory/subdir
genfile --file=directory/file
decho Creating initial archive
tar -cf archive.1 -g db.1 directory
decho Renaming
mv directory/subdir directory/subdir.0
mv directory dir
decho Creating incremental archive
cp db.1 db.2
tar -cf archive.2 -g db.2 dir
mv dir orig
decho First restore
tar -xf archive.1 -g db.1
find directory | sort
decho Second restore
tar -xf archive.2 -g db.2
find dir | sort
],
[0],
[Creating directory structure
Creating initial archive
Renaming
Creating incremental archive
First restore
directory
directory/file
directory/subdir
Second restore
dir
dir/subdir.0
],
[Creating directory structure
Creating initial archive
Renaming
Creating incremental archive
First restore
Second restore
],[],[],[gnu, oldgnu, posix])
AT_CLEANUP
# End of rename05.at

View File

@@ -33,7 +33,7 @@ tar tf foo
[2],
[],
[tar: This does not look like a tar archive
tar: Error exit delayed from previous errors
tar: Exiting with failure status due to previous errors
],
[],[],[gnu])

View File

@@ -1,7 +1,7 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
# Copyright (C) 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
@@ -35,18 +35,18 @@ echo "Pass 1: Split between data blocks"
echo "Create archive"
tar --sparse -c --record-size=512 -M -L6 -f arc.1 -f arc.2 sparsefile || exit 1
echo "Test archive"
tar -t -M -f arc.1 -f arc.2
tar --record-size=512 -t -M -f arc.1 -f arc.2
echo "Compare archive"
tar -d -M -f arc.1 -f arc.2
tar --record-size=512 -d -M -f arc.1 -f arc.2
echo "Pass 2: Split within a data block"
genfile --sparse --file sparsefile 0 ABCDEFGHIJ 1M ABCDEFGHI || AT_SKIP_TEST
echo "Create archive"
tar --sparse -c --record-size=512 -M -L6 -f arc.1 -f arc.2 sparsefile || exit 1
echo "Test archive"
tar -t -M -f arc.1 -f arc.2
tar --record-size=512 -t -M -f arc.1 -f arc.2
echo "Compare archive"
tar -d -M -f arc.1 -f arc.2
tar --record-size=512 -d -M -f arc.1 -f arc.2
],
[0],
[Pass 1: Split between data blocks

View File

@@ -1,7 +1,7 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
# Copyright (C) 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
@@ -56,5 +56,7 @@ Test archive
sparsefile
Compare archive
],
[],[],[],[pax])])
[tar: Record size = 12 blocks
tar: Record size = 12 blocks
],[],[],[pax])])

View File

@@ -138,6 +138,8 @@ m4_include([incr04.at])
m4_include([rename01.at])
m4_include([rename02.at])
m4_include([rename03.at])
m4_include([rename04.at])
m4_include([rename05.at])
m4_include([chtype.at])
m4_include([ignfail.at])
@@ -155,6 +157,7 @@ m4_include([multiv02.at])
m4_include([multiv03.at])
m4_include([multiv04.at])
m4_include([multiv05.at])
m4_include([multiv06.at])
m4_include([old.at])

View File

@@ -1,7 +1,7 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2006, 2007 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
@@ -36,7 +36,7 @@ AT_TARBALL_PREREQ([abc.tar],[540f196ceddcad9e7bd2f2d7533d0474])
echo Short Listing
tar tf $TEST_DATA_DIR/abc.tar
echo Verbose Listing
tar tfv $TEST_DATA_DIR/abc.tar
tar --utc -tvf $TEST_DATA_DIR/abc.tar
echo Extracted directory
tar xf $TEST_DATA_DIR/abc.tar
find abc|sort
@@ -46,11 +46,14 @@ find abc|sort
abc/not-a-file.gif
abc/CCC
Verbose Listing
V--------- 0/0 1536 2006-05-09 01:07 abc/not-a-file.gif--Volume Header--
-rw-r--r-- tom/users 0 2006-04-22 22:52 abc/CCC
V--------- 0/0 1536 2006-05-08 22:07 abc/not-a-file.gif--Volume Header--
-rw-r--r-- tom/users 0 2006-04-22 19:52 abc/CCC
Extracted directory
abc
abc/CCC
],
[tar: Record size = 5 blocks
tar: Record size = 5 blocks
])
AT_CLEANUP