* 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 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
2008-06-14 Dan Drake <dan@dandrake.org> (tiny change)
- * src/tar.c (exclude_vcs_files): Support for Bazaar, Mercurial and Darcs.
+ * src/tar.c (exclude_vcs_files): Support for Bazaar, Mercurial and
+ Darcs.
2008-05-06 Sergey Poznyakoff <gray@gnu.org.ua>
-GNU tar NEWS - User visible changes. 2008-04-14
+GNU tar NEWS - User visible changes. 2008-06-26
Please send GNU tar bug reports to <bug-tar@gnu.org>
\f
+version 1.20.90 (CVS)
+
+* 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.
+
+* 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.
+
+\f
+
version 1.20 - Sergey Poznyakoff, 2008-04-14
* New option --auto-compress (-a)
-# 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.
# 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.20.90], [bug-tar@gnu.org])
AC_CONFIG_SRCDIR([src/tar.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h:config.hin])
@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}
@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}
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
@item -G @tab @ref{--incremental}.
+@item -J @tab @ref{--lzma}.
+
@item -K @tab @ref{--starting-file}.
@item -L @tab @ref{--tape-length}.
@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.
@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
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:
$ @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{}
@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
@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
@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
/* Compression detection */
enum compress_type {
- ct_none,
+ ct_tar, /* Plain tar file */
+ ct_none, /* Unknown compression type */
ct_compress,
ct_gzip,
ct_bzip2,
- ct_lzma
+ ct_lzma,
+ ct_lzop
};
struct zip_magic
};
static struct zip_magic const magic[] = {
+ { ct_tar },
{ ct_none, },
{ 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: ???? */
+ { ct_lzma, 6, "\xFFLZMA", "lzma", "-J" }, /* FIXME: ???? */
+ { ct_lzop, 4, "\211LZO", "lzop", "--lzop" },
};
#define NMAGIC (sizeof(magic)/sizeof(magic[0]))
if (tar_checksum (record_start, true) == HEADER_SUCCESS)
/* Probably a valid header */
- return ct_none;
+ return ct_tar;
- for (p = magic + 1; p < magic + NMAGIC; p++)
+ for (p = magic + 2; p < magic + NMAGIC; p++)
if (memcmp (record_start->buffer, p->magic, p->length) == 0)
return p->type;
if (!multi_volume_option)
{
- bool shortfile;
- enum compress_type type = check_compressed_archive (&shortfile);
-
- if (type == ct_none)
+ if (!use_compress_program_option)
{
- if (shortfile)
- ERROR ((0, 0, _("This does not look like a tar archive")));
- return archive;
+ bool shortfile;
+ enum compress_type type = check_compressed_archive (&shortfile);
+
+ switch (type)
+ {
+ case ct_tar:
+ if (shortfile)
+ ERROR ((0, 0, _("This does not look like a tar archive")));
+ return archive;
+
+ case ct_none:
+ if (shortfile)
+ ERROR ((0, 0, _("This does not look like a tar archive")));
+ set_comression_program_by_suffix (archive_name_array[0], NULL);
+ if (!use_compress_program_option)
+ return archive;
+ break;
+
+ default:
+ use_compress_program_option = compress_program (type);
+ break;
+ }
}
/* FD is not needed any more */
check_compressed_archive */
/* Open compressed archive */
- use_compress_program_option = compress_program (type);
child_pid = sys_child_open_for_uncompress ();
read_full_records = true;
}
archive = STDIN_FILENO;
type = check_compressed_archive (&shortfile);
- if (type != ct_none)
+ if (type != ct_tar && type != ct_none)
FATAL_ERROR ((0, 0,
_("Archive is compressed. Use %s option"),
compress_option (type)));
O_RDWR | O_CREAT | O_BINARY,
MODE_RW, rsh_command_option);
- if (check_compressed_archive (NULL) != ct_none)
- FATAL_ERROR ((0, 0,
- _("Cannot update compressed archives")));
+ switch (check_compressed_archive (NULL))
+ {
+ case ct_none:
+ case ct_tar:
+ break;
+
+ default:
+ FATAL_ERROR ((0, 0,
+ _("Cannot update compressed archives")));
+ }
break;
}
{ S(tz2, bzip2) },
{ S(lzma, lzma) },
{ S(tlz, lzma) },
+ { S(lzo, lzop) },
#undef S
};
IGNORE_FAILED_READ_OPTION,
INDEX_FILE_OPTION,
KEEP_NEWER_FILES_OPTION,
- LZMA_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,
/* 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?]
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,
{"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 },
{"use-compress-program", USE_COMPRESS_PROGRAM_OPTION, N_("PROG"), 0,
N_("filter through PROG (must accept -d)"), GRID+1 },
case 'a':
args->compress_autodetect = true;
break;
+
+ case NO_AUTO_COMPRESS_OPTION:
+ args->compress_autodetect = false;
+ break;
case 'b':
{
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;
}
break;
- case LZMA_OPTION:
- set_use_compress_program_option ("lzma");
- break;
-
case 'm':
touch_option = true;
break;