[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-tar] Support for lzma compression tool in GNU tar
From: |
Lasse Collin |
Subject: |
[Bug-tar] Support for lzma compression tool in GNU tar |
Date: |
Tue, 21 Aug 2007 17:47:01 +0300 |
User-agent: |
KMail/1.9.6 |
Hi!
Here's a patch to add support for lzma compression tool to GNU tar.
The patch adds options --lzma and short variant -a. Older lzma
patches for GNU tar used -Y instead of -a, but according to comments
in tar.c, using -Y may affect compatibility with other tar
implementations. Also, -a is already used for lzma by the tar of
BusyBox.
The patch adds autodetection for the new .lzma format, which has
proper magic bytes. The new .lzma file format specification is
practically finished now, but there are no stable tools to create or
read those files yet.
The .lzma format currently in use has no magic bytes. It's not
trivial to detect those files without checking the filename suffix.
I hope that the old format will practically vanish in a few years
once there are tools to use the new format. But for now, people need
to specify --lzma or -a when extracting .tar.lzma (or .tlz) files.
diff -ru tar-1.18.orig/src/buffer.c tar-1.18/src/buffer.c
--- tar-1.18.orig/src/buffer.c 2007-06-27 16:30:31.000000000 +0300
+++ tar-1.18/src/buffer.c 2007-08-10 23:03:33.430394635 +0300
@@ -205,7 +205,8 @@
ct_none,
ct_compress,
ct_gzip,
- ct_bzip2
+ ct_bzip2,
+ ct_lzma
};
struct zip_magic
@@ -222,6 +223,7 @@
{ 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", "-a" },
};
#define NMAGIC (sizeof(magic)/sizeof(magic[0]))
diff -ru tar-1.18.orig/src/tar.c tar-1.18/src/tar.c
--- tar-1.18.orig/src/tar.c 2007-06-27 16:30:32.000000000 +0300
+++ tar-1.18/src/tar.c 2007-08-10 23:03:33.430394635 +0300
@@ -574,6 +574,8 @@
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 },
+ {"lzma", 'a', 0, 0,
+ N_("filter the archive through lzma"), GRID+8 },
{"bzip2", 'j', 0, 0,
N_("filter the archive through bzip2"), GRID+8 },
{"gzip", 'z', 0, 0,
@@ -1184,6 +1186,10 @@
args->input_files = true;
break;
+ case 'a':
+ set_use_compress_program_option ("lzma");
+ break;
+
case 'A':
set_subcommand_option (CAT_SUBCOMMAND);
break;
--
Lasse Collin | IRC: Larhzu @ IRCnet & Freenode
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-tar] Support for lzma compression tool in GNU tar,
Lasse Collin <=