From e4a5730eb358cb0d78bc022204ddccac068c2bf2 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 25 Feb 2012 23:15:06 +0000 Subject: Sat Feb 25 23:15:06 UTC 2012 --- testing/libarchive/PKGBUILD | 53 +++++++ testing/libarchive/interpret-non-posix-zips.patch | 165 ++++++++++++++++++++++ testing/libarchive/skip-fiemap-on-unavail.patch | 41 ++++++ testing/libarchive/test-with-zip-mtime.patch | 23 +++ 4 files changed, 282 insertions(+) create mode 100644 testing/libarchive/PKGBUILD create mode 100644 testing/libarchive/interpret-non-posix-zips.patch create mode 100644 testing/libarchive/skip-fiemap-on-unavail.patch create mode 100644 testing/libarchive/test-with-zip-mtime.patch (limited to 'testing/libarchive') diff --git a/testing/libarchive/PKGBUILD b/testing/libarchive/PKGBUILD new file mode 100644 index 000000000..eb544af43 --- /dev/null +++ b/testing/libarchive/PKGBUILD @@ -0,0 +1,53 @@ +# $Id: PKGBUILD 151123 2012-02-25 01:41:48Z dreisner $ +# Maintainer: Dan McGee + +pkgname=libarchive +pkgver=3.0.3 +pkgrel=4 +pkgdesc="library that can create and read several streaming archive formats" +arch=('i686' 'x86_64') +url="http://libarchive.googlecode.com/" +license=('BSD') +options=('!libtool') +depends=('zlib' 'bzip2' 'xz>=5.0.0' 'acl' 'openssl>=1.0.0' 'expat') +source=("http://libarchive.googlecode.com/files/libarchive-${pkgver}.tar.gz" + 'interpret-non-posix-zips.patch' + 'test-with-zip-mtime.patch' + 'skip-fiemap-on-unavail.patch') +md5sums=('ca4090f0099432a9ac5a8b6618dc3892' + 'f02b88eb10877c7a7d527ed89c662e44' + '8366def6d7d70d424fa28a986c78c015' + 'efa7cbda9fc64a4f1392324d0b5707e2') +sha256sums=('c5fc7620f74a54b1717e4aed38aee85dc27a988ad1db7640f28eb63a82ea62d7' + '9d8240a360d61464dfc5a98342f520ad41b0f922261f2ace7ec1fefb8c289bdc' + 'b7a8be5c1e3220960a9f67c9779b10d2663e25d72939546b4f01a49f1ee3a61f' + '05696eb87bf60520aff3a9d6afb4e40273ecca25e0a01a6d5a3669642f07b444') + +build() { + cd "$srcdir/$pkgname-$pkgver" + + # http://code.google.com/p/libarchive/issues/detail?id=225 + patch -Np0 <"$srcdir/interpret-non-posix-zips.patch" + + # http://code.google.com/p/libarchive/issues/detail?id=231 + patch -Np0 <"$srcdir/test-with-zip-mtime.patch" + + # http://code.google.com/p/libarchive/issues/detail?id=238 + patch -Np1 <"$srcdir/skip-fiemap-on-unavail.patch" + + ./configure --prefix=/usr --without-xml2 + make +} + +check() { + cd "$srcdir/$pkgname-$pkgver" + + make check +} + +package() { + cd "$srcdir/$pkgname-$pkgver" + make DESTDIR="$pkgdir" install + + install -D -m644 COPYING "$pkgdir"/usr/share/licenses/libarchive/COPYING +} diff --git a/testing/libarchive/interpret-non-posix-zips.patch b/testing/libarchive/interpret-non-posix-zips.patch new file mode 100644 index 000000000..63bc439d9 --- /dev/null +++ b/testing/libarchive/interpret-non-posix-zips.patch @@ -0,0 +1,165 @@ +Index: libarchive/archive_read_support_format_zip.c +=================================================================== +--- libarchive/archive_read_support_format_zip.c (revision 4189) ++++ libarchive/archive_read_support_format_zip.c (revision 4190) +@@ -217,14 +217,13 @@ + } + + /* +- * TODO: This is a performance sink because it forces +- * the read core to drop buffered data from the start +- * of file, which will then have to be re-read again +- * if this bidder loses. ++ * TODO: This is a performance sink because it forces the read core to ++ * drop buffered data from the start of file, which will then have to ++ * be re-read again if this bidder loses. + * +- * Consider passing in the winning bid value to subsequent +- * bidders so that this bidder in particular can avoid +- * seeking if it knows it's going to lose anyway. ++ * We workaround this a little by passing in the best bid so far so ++ * that later bidders can do nothing if they know they'll never ++ * outbid. But we can certainly do better... + */ + static int + archive_read_format_zip_seekable_bid(struct archive_read *a, int best_bid) +@@ -311,19 +310,29 @@ + external_attributes = archive_le32dec(p + 38); + zip_entry->local_header_offset = archive_le32dec(p + 42); + ++ /* If we can't guess the mode, leave it zero here; ++ when we read the local file header we might get ++ more information. */ ++ zip_entry->mode = 0; + if (zip_entry->system == 3) { + zip_entry->mode = external_attributes >> 16; +- } else { +- zip_entry->mode = AE_IFREG | 0777; + } + +- /* Do we need to parse filename here? */ +- /* Or can we wait until we read the local header? */ ++ /* We don't read the filename until we get to the ++ local file header. Reading it here would speed up ++ table-of-contents operations (removing the need to ++ find and read local file header to get the ++ filename) at the cost of requiring a lot of extra ++ space. */ ++ /* We don't read the extra block here. We assume it ++ will be duplicated at the local file header. */ + __archive_read_consume(a, + 46 + filename_length + extra_length + comment_length); + } + +- /* TODO: Sort zip entries. */ ++ /* TODO: Sort zip entries by file offset so that we ++ can optimize get_next_header() to use skip instead of ++ seek. */ + + return ARCHIVE_OK; + } +@@ -434,6 +443,11 @@ + return (30); + } + ++ /* TODO: It's worth looking ahead a little bit for a valid ++ * PK signature. In particular, that would make it possible ++ * to read some UUEncoded SFX files or SFX files coming from ++ * a network socket. */ ++ + return (0); + } + +Index: libarchive/test/test_compat_zip_6.zip.uu +=================================================================== +--- libarchive/test/test_compat_zip_6.zip.uu (revision 0) ++++ libarchive/test/test_compat_zip_6.zip.uu (revision 4190) +@@ -0,0 +1,10 @@ ++begin 755 test_compat_zip_6.zip ++M4$L#!`H``````'@3-T`````````````````6````3F5W($9O;&1E'1S;VUE('1E>'0- ++M"E!+`0(4"PH``````'@3-T`````````````````6````````````$``````` ++M``!.97<@1F]L9&5R+TYE=R!&;VQD97(O4$L!`A0+"@``````?!,W0!5#6+\+ ++M````"P```"L``````````0`@````-````$YE=R!&;VQD97(O3F5W($9O;&1E ++M'102P4&``````(``@"=````B``````` ++` ++end +Index: libarchive/test/test_compat_zip.c +=================================================================== +--- libarchive/test/test_compat_zip.c (revision 4189) ++++ libarchive/test/test_compat_zip.c (revision 4190) +@@ -348,6 +348,53 @@ + free(p); + } + ++/* ++ * Issue 225: Errors extracting MSDOS Zip archives with directories. ++ */ ++static void ++compat_zip_6_verify(struct archive *a) ++{ ++ struct archive_entry *ae; ++ ++ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); ++ assertEqualString("New Folder/New Folder/", archive_entry_pathname(ae)); ++ assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); ++ assertEqualInt(1327314468, archive_entry_mtime(ae)); ++ assertEqualInt(0, archive_entry_size(ae)); ++ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); ++ assertEqualString("New Folder/New Folder/New Text Document.txt", archive_entry_pathname(ae)); ++ assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); ++ assertEqualInt(1327314476, archive_entry_mtime(ae)); ++ assertEqualInt(11, archive_entry_size(ae)); ++ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); ++} ++ ++static void ++test_compat_zip_6(void) ++{ ++ const char *refname = "test_compat_zip_6.zip"; ++ struct archive *a; ++ void *p; ++ size_t s; ++ ++ extract_reference_file(refname); ++ p = slurpfile(&s, refname); ++ ++ assert((a = archive_read_new()) != NULL); ++ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); ++ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); ++ assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, p, s, 7)); ++ compat_zip_6_verify(a); ++ assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); ++ ++ assert((a = archive_read_new()) != NULL); ++ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); ++ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); ++ assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, p, s, 7)); ++ compat_zip_6_verify(a); ++ assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); ++} ++ + DEFINE_TEST(test_compat_zip) + { + test_compat_zip_1(); +@@ -355,6 +402,7 @@ + test_compat_zip_3(); + test_compat_zip_4(); + test_compat_zip_5(); ++ test_compat_zip_6(); + } + + +Index: Makefile.am +=================================================================== +--- Makefile.am (revision 4189) ++++ Makefile.am (revision 4190) +@@ -462,6 +462,7 @@ + libarchive/test/test_compat_zip_3.zip.uu \ + libarchive/test/test_compat_zip_4.zip.uu \ + libarchive/test/test_compat_zip_5.zip.uu \ ++ libarchive/test/test_compat_zip_6.zip.uu \ + libarchive/test/test_fuzz_1.iso.Z.uu \ + libarchive/test/test_fuzz.cab.uu \ + libarchive/test/test_fuzz.lzh.uu \ diff --git a/testing/libarchive/skip-fiemap-on-unavail.patch b/testing/libarchive/skip-fiemap-on-unavail.patch new file mode 100644 index 000000000..d054aea4e --- /dev/null +++ b/testing/libarchive/skip-fiemap-on-unavail.patch @@ -0,0 +1,41 @@ +From 293687358e2c52213a3f077bb3d8f860ea5bfda9 Mon Sep 17 00:00:00 2001 +From: Michihiro NAKAJIMA +Date: Mon, 6 Feb 2012 04:51:16 +0900 +Subject: [PATCH] Fix issue 238. Skip the setup sparse on linux without a + check of errno if ioctl(,FS_IOC_FIEMAP,) failed because the + errno is not fixed , for example, some file system returns + ENOTTY, another returns EOPNOTSUPP, or EINVAL and so on. We + cannot decide what errno exactly indicates an unsupported + error. + +--- + libarchive/archive_read_disk_entry_from_file.c | 13 +++---------- + 1 file changed, 3 insertions(+), 10 deletions(-) + +diff --git a/libarchive/archive_read_disk_entry_from_file.c b/libarchive/archive_read_disk_entry_from_file.c +index eef42ef74..6415008 100644 +--- a/libarchive/archive_read_disk_entry_from_file.c ++++ b/libarchive/archive_read_disk_entry_from_file.c +@@ -859,16 +859,9 @@ setup_sparse(struct archive_read_disk *a, + + r = ioctl(fd, FS_IOC_FIEMAP, fm); + if (r < 0) { +- /* When errno is ENOTTY, it is better we should +- * return ARCHIVE_OK because an earlier version +- *(<2.6.28) cannot perfom FS_IOC_FIEMAP. +- * We should also check if errno is EOPNOTSUPP, +- * it means "Operation not supported". */ +- if (errno != ENOTTY && errno != EOPNOTSUPP) { +- archive_set_error(&a->archive, errno, +- "FIEMAP failed"); +- exit_sts = ARCHIVE_FAILED; +- } ++ /* When something error happens, it is better we ++ * should return ARCHIVE_OK because an earlier ++ * version(<2.6.28) cannot perfom FS_IOC_FIEMAP. */ + goto exit_setup_sparse; + } + if (fm->fm_mapped_extents == 0) +-- +1.7.9.2 + diff --git a/testing/libarchive/test-with-zip-mtime.patch b/testing/libarchive/test-with-zip-mtime.patch new file mode 100644 index 000000000..79e2f3c7e --- /dev/null +++ b/testing/libarchive/test-with-zip-mtime.patch @@ -0,0 +1,23 @@ +Index: libarchive/test/test_compat_zip.c +=================================================================== +--- libarchive/test/test_compat_zip.c (revision 4197) ++++ libarchive/test/test_compat_zip.c (revision 4198) +@@ -359,12 +359,16 @@ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("New Folder/New Folder/", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); +- assertEqualInt(1327314468, archive_entry_mtime(ae)); ++ /* Zip timestamps are local time, so vary by time zone. */ ++ /* TODO: A more complex assert would work here; we could ++ verify that it's within +/- 24 hours of a particular value. */ ++ /* assertEqualInt(1327314468, archive_entry_mtime(ae)); */ + assertEqualInt(0, archive_entry_size(ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("New Folder/New Folder/New Text Document.txt", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); +- assertEqualInt(1327314476, archive_entry_mtime(ae)); ++ /* Zip timestamps are local time, so vary by time zone. */ ++ /* assertEqualInt(1327314476, archive_entry_mtime(ae)); */ + assertEqualInt(11, archive_entry_size(ae)); + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + } -- cgit v1.2.3-54-g00ecf