Re: [PATCH] tar: support the common file extensions .tlzma and .txz
On Tuesday 06 March 2012 18:43, Lauri Kasanen wrote: Thanks, it works well now. Didn't catch anything reading the last few commits. I ran cppcheck on the affected files, and it found one possibly uninitialized use: [decompress_bunzip2.c:156]: (error) Uninitialized variable: runCnt The robot is mistaken, it's ok. Also, seems the __KERNEL__ ifdefs in the unxz code could be removed? Yes, but this will only make future updating of xz code more difficult. -- vda ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: [PATCH] tar: support the common file extensions .tlzma and .txz
On Wed, Feb 29, 2012 at 9:03 PM, Lauri Kasanen cur...@operamail.com wrote: The attached patch adds support for .txz and .tlzma tar archives. For .txz the proper way would be to add the magic detection The autodetection should already work, see archival/tar.c: Using git master: $ ./busybox tar tvf /tmp/test.txz tar: invalid tar magic Renaming the file to .tar.xz lets bb tar read it. I am not convinced .txz and .tlzma extensions are common. (In my opinion, existence of .tgz extension was a mistake). They exist, and GNU tar handles them, so I think bb tar shouldn't puke when it sees one. Busybox does handle .tgz and .tbz2, because they have the magic detection already written (xz magic is marked todo in archival/libarchive/get_header_tar.c). I consolidated several copies of autodetection code. One in get_header_tar.c is gone. Now tar recognizes XZ-compressed data using generic setup_unzip_on_fd(). I added a testsuite entry which verifies that. Please try current git. Please also review last ~5 commits, maybe I added a few bugs :( -- vda ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: [PATCH] tar: support the common file extensions .tlzma and .txz
On Tue, Mar 6, 2012, at 17:02, Denys Vlasenko wrote: I consolidated several copies of autodetection code. One in get_header_tar.c is gone. Now tar recognizes XZ-compressed data using generic setup_unzip_on_fd(). I added a testsuite entry which verifies that. Please try current git. Please also review last ~5 commits, maybe I added a few bugs :( Thanks, it works well now. Didn't catch anything reading the last few commits. - Lauri -- http://www.fastmail.fm - Same, same, but different... ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: [PATCH] tar: support the common file extensions .tlzma and .txz
Thanks, it works well now. Didn't catch anything reading the last few commits. I ran cppcheck on the affected files, and it found one possibly uninitialized use: [decompress_bunzip2.c:156]: (error) Uninitialized variable: runCnt Also, seems the __KERNEL__ ifdefs in the unxz code could be removed? - Lauri -- http://www.fastmail.fm - Does exactly what it says on the tin ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: [PATCH] tar: support the common file extensions .tlzma and .txz
I am not convinced .txz and .tlzma extensions are common. (In my opinion, existence of .tgz extension was a mistake). They exist, and GNU tar handles them, so I think bb tar shouldn't puke when it sees one. Busybox does handle .tgz and .tbz2, because they have the magic detection already written (xz magic is marked todo in archival/libarchive/get_header_tar.c). Replying to myself, but I just remembered all Slackware tarballs are named .txz (changed in 2009 from tgz). Perhaps that's worth something for the common argument. :) - Lauri -- http://www.fastmail.fm - The professional email service ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
[PATCH] tar: support the common file extensions .tlzma and .txz
Hi Denys The attached patch adds support for .txz and .tlzma tar archives. For .txz the proper way would be to add the magic detection, but that was a bit over my head right now, with four different magic parts. - Lauri -- http://www.fastmail.fm - A fast, anti-spam email service. From caba4f803cdc2cdffca4f968d72a74185aa6cd58 Mon Sep 17 00:00:00 2001 From: Lauri Kasanen cur...@operamail.com Date: Wed, 29 Feb 2012 10:23:45 +0200 Subject: [PATCH] tar: support the common file extensions .tlzma and .txz For lzma there is no magic to detect, so this is the right place. For XZ, adding the magic detection makes the xz check here unnecessary. Signed-off-by: Lauri Kasanen cur...@operamail.com --- libbb/read_printf.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libbb/read_printf.c b/libbb/read_printf.c index 0bbf780..fe1717c 100644 --- a/libbb/read_printf.c +++ b/libbb/read_printf.c @@ -341,13 +341,13 @@ int FAST_FUNC open_zipped(const char *fname) sfx = strrchr(fname, '.'); if (sfx) { sfx++; - if (ENABLE_FEATURE_SEAMLESS_LZMA strcmp(sfx, lzma) == 0) + if (ENABLE_FEATURE_SEAMLESS_LZMA strstr(sfx, lzma)) /* .lzma has no header/signature, just trust it */ open_transformer(fd, unpack_lzma_stream, unlzma); else if ((ENABLE_FEATURE_SEAMLESS_GZ strcmp(sfx, gz) == 0) || (ENABLE_FEATURE_SEAMLESS_BZ2 strcmp(sfx, bz2) == 0) - || (ENABLE_FEATURE_SEAMLESS_XZ strcmp(sfx, xz) == 0) + || (ENABLE_FEATURE_SEAMLESS_XZ strstr(sfx, xz)) ) { setup_unzip_on_fd(fd /*, fail_if_not_detected: 1*/); } -- 1.7.2.1 ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: [PATCH] tar: support the common file extensions .tlzma and .txz
On Wed, Feb 29, 2012 at 9:28 AM, Lauri Kasanen cur...@operamail.com wrote: Hi Denys The attached patch adds support for .txz and .tlzma tar archives. For .txz the proper way would be to add the magic detection The autodetection should already work, see archival/tar.c: if (ENABLE_FEATURE_TAR_AUTODETECT flags == O_RDONLY get_header_ptr == get_header_tar ) { ===tar_handle-src_fd = open_zipped(tar_filename); if (tar_handle-src_fd 0) bb_perror_msg_and_die(can't open '%s', tar_filename); } else { tar_handle-src_fd = xopen(tar_filename, flags); } I am not convinced .txz and .tlzma extensions are common. (In my opinion, existence of .tgz extension was a mistake). -- vda ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox
Re: [PATCH] tar: support the common file extensions .tlzma and .txz
Hi Denys The attached patch adds support for .txz and .tlzma tar archives. For .txz the proper way would be to add the magic detection The autodetection should already work, see archival/tar.c: Using git master: $ ./busybox tar tvf /tmp/test.txz tar: invalid tar magic Renaming the file to .tar.xz lets bb tar read it. I am not convinced .txz and .tlzma extensions are common. (In my opinion, existence of .tgz extension was a mistake). They exist, and GNU tar handles them, so I think bb tar shouldn't puke when it sees one. Busybox does handle .tgz and .tbz2, because they have the magic detection already written (xz magic is marked todo in archival/libarchive/get_header_tar.c). - Lauri -- http://www.fastmail.fm - Does exactly what it says on the tin ___ busybox mailing list busybox@busybox.net http://lists.busybox.net/mailman/listinfo/busybox