From 7615a7f21cc99f1539d80fc7f18ace51d789fea3 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Jun 30 2013 17:49:33 +0000 Subject: testsuite: _enable it_ Version: 3.1.2-4 --- diff --git a/libarchive-3.1.2-testsuite.patch b/libarchive-3.1.2-testsuite.patch new file mode 100644 index 0000000..8a9841c --- /dev/null +++ b/libarchive-3.1.2-testsuite.patch @@ -0,0 +1,150 @@ +diff --git a/cpio/test/test_extract_cpio_lzo.c b/cpio/test/test_extract_cpio_lzo.c +index f351ba7..99476af 100644 +--- a/cpio/test/test_extract_cpio_lzo.c ++++ b/cpio/test/test_extract_cpio_lzo.c +@@ -27,7 +27,7 @@ __FBSDID("$FreeBSD$"); + + DEFINE_TEST(test_extract_cpio_lzo) + { +- const char *reffile = "test_extract.cpio.lrz"; ++ const char *reffile = "test_extract.cpio.lzo"; + int f; + + extract_reference_file(reffile); +diff --git a/libarchive/test/test_write_filter_lzop.c b/libarchive/test/test_write_filter_lzop.c +index 9e840bd..a32932c 100644 +--- a/libarchive/test/test_write_filter_lzop.c ++++ b/libarchive/test/test_write_filter_lzop.c +@@ -39,7 +39,7 @@ DEFINE_TEST(test_write_filter_lzop) + size_t buffsize, datasize; + char path[16]; + size_t used1, used2; +- int i, r, use_prog = 0; ++ int i, r, use_prog = 0, filecount; + + assert((a = archive_write_new()) != NULL); + r = archive_write_add_filter_lzop(a); +@@ -58,9 +58,10 @@ DEFINE_TEST(test_write_filter_lzop) + + datasize = 10000; + assert(NULL != (data = (char *)calloc(1, datasize))); ++ filecount = 10; + + /* +- * Write a 100 files and read them all back. ++ * Write a filecount files and read them all back. + */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a)); +@@ -77,7 +78,7 @@ DEFINE_TEST(test_write_filter_lzop) + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_filetype(ae, AE_IFREG); + archive_entry_set_size(ae, datasize); +- for (i = 0; i < 100; i++) { ++ for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + archive_entry_copy_pathname(ae, path); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); +@@ -97,7 +98,7 @@ DEFINE_TEST(test_write_filter_lzop) + } else { + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, buff, used1)); +- for (i = 0; i < 100; i++) { ++ for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + if (!assertEqualInt(ARCHIVE_OK, + archive_read_next_header(a, &ae))) +@@ -133,7 +134,7 @@ DEFINE_TEST(test_write_filter_lzop) + archive_write_set_options(a, "lzop:compression-level=9")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used2)); +- for (i = 0; i < 100; i++) { ++ for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, path); +@@ -161,7 +162,7 @@ DEFINE_TEST(test_write_filter_lzop) + archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, buff, used2)); +- for (i = 0; i < 100; i++) { ++ for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + if (!assertEqualInt(ARCHIVE_OK, + archive_read_next_header(a, &ae))) +@@ -186,7 +187,7 @@ DEFINE_TEST(test_write_filter_lzop) + archive_write_set_filter_option(a, NULL, "compression-level", "1")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used2)); +- for (i = 0; i < 100; i++) { ++ for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, path); +@@ -216,7 +217,7 @@ DEFINE_TEST(test_write_filter_lzop) + } else { + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, buff, used2)); +- for (i = 0; i < 100; i++) { ++ for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + if (!assertEqualInt(ARCHIVE_OK, + archive_read_next_header(a, &ae))) +diff --git a/tar/test/test_option_b.c b/tar/test/test_option_b.c +index be2ae65..7164d4c 100644 +--- a/tar/test/test_option_b.c ++++ b/tar/test/test_option_b.c +@@ -25,8 +25,14 @@ + #include "test.h" + __FBSDID("$FreeBSD$"); + ++static char *ustar_opt = " --format=ustar"; ++ + DEFINE_TEST(test_option_b) + { ++ char *testprog_ustar = malloc(strlen(testprog) + strlen(ustar_opt) + 2); ++ strcpy(testprog_ustar, testprog); ++ strcat(testprog_ustar, ustar_opt); ++ + assertMakeFile("file1", 0644, "file1"); + if (systemf("cat file1 > test_cat.out 2> test_cat.err") != 0) { + skipping("Platform doesn't have cat"); +@@ -36,7 +42,7 @@ DEFINE_TEST(test_option_b) + /* + * Bsdtar does not pad if the output is going directly to a disk file. + */ +- assertEqualInt(0, systemf("%s -cf archive1.tar file1 >test1.out 2>test1.err", testprog)); ++ assertEqualInt(0, systemf("%s -cf archive1.tar file1 >test1.out 2>test1.err", testprog_ustar)); + failure("bsdtar does not pad archives written directly to regular files"); + assertFileSize("archive1.tar", 2048); + assertEmptyFile("test1.out"); +@@ -46,24 +52,24 @@ DEFINE_TEST(test_option_b) + * Bsdtar does pad to the block size if the output is going to a socket. + */ + /* Default is -b 20 */ +- assertEqualInt(0, systemf("%s -cf - file1 2>test2.err | cat >archive2.tar ", testprog)); ++ assertEqualInt(0, systemf("%s -cf - file1 2>test2.err | cat >archive2.tar ", testprog_ustar)); + failure("bsdtar does pad archives written to pipes"); + assertFileSize("archive2.tar", 10240); + assertEmptyFile("test2.err"); + +- assertEqualInt(0, systemf("%s -cf - -b 20 file1 2>test3.err | cat >archive3.tar ", testprog)); ++ assertEqualInt(0, systemf("%s -cf - -b 20 file1 2>test3.err | cat >archive3.tar ", testprog_ustar)); + assertFileSize("archive3.tar", 10240); + assertEmptyFile("test3.err"); + +- assertEqualInt(0, systemf("%s -cf - -b 10 file1 2>test4.err | cat >archive4.tar ", testprog)); ++ assertEqualInt(0, systemf("%s -cf - -b 10 file1 2>test4.err | cat >archive4.tar ", testprog_ustar)); + assertFileSize("archive4.tar", 5120); + assertEmptyFile("test4.err"); + +- assertEqualInt(0, systemf("%s -cf - -b 1 file1 2>test5.err | cat >archive5.tar ", testprog)); ++ assertEqualInt(0, systemf("%s -cf - -b 1 file1 2>test5.err | cat >archive5.tar ", testprog_ustar)); + assertFileSize("archive5.tar", 2048); + assertEmptyFile("test5.err"); + +- assertEqualInt(0, systemf("%s -cf - -b 8192 file1 2>test6.err | cat >archive6.tar ", testprog)); ++ assertEqualInt(0, systemf("%s -cf - -b 8192 file1 2>test6.err | cat >archive6.tar ", testprog_ustar)); + assertFileSize("archive6.tar", 4194304); + assertEmptyFile("test6.err"); + diff --git a/libarchive.spec b/libarchive.spec index 3a1e2b1..f660d5c 100644 --- a/libarchive.spec +++ b/libarchive.spec @@ -1,6 +1,6 @@ Name: libarchive Version: 3.1.2 -Release: 3%{?dist} +Release: 4%{?dist} Summary: A library for handling streaming archive formats Group: System Environment/Libraries @@ -28,6 +28,7 @@ BuildRequires: automake autoconf libtool # https://bugzilla.redhat.com/show_bug.cgi?id=927105 Patch0: libarchive-3.1.3-CVE-2013-0211_read_buffer_overflow.patch +Patch1: libarchive-3.1.2-testsuite.patch %description Libarchive is a programming library that can create and read several different @@ -68,6 +69,9 @@ libarchive packages. %prep %setup -q -n %{name}-%{version} %patch0 -p1 -b .CVE-2013-0211 +# fix bugs in testsuite +# ~> upstream ~> 26629c191a & b539b2e597 & 9caa49246 +%patch1 -p1 -b .fix-testsuite %build @@ -76,7 +80,9 @@ build/autogen.sh # remove rpaths sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool -make %{?_smp_mflags} V=1 + +test -z "$V" && verbose_make="V=1" +make %{?_smp_mflags} $verbose_make %install @@ -85,12 +91,28 @@ make install DESTDIR=$RPM_BUILD_ROOT find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' +%check +LD_LIBRARY_PATH=`pwd`/.libs make check -j1 || ( + # error happened - try to extract in koji as much info as possible + cat test-suite.log + echo "=========================" + err=`cat test-suite.log | grep "Details for failing tests" | cut -d: -f2` + for i in $err; do + find $i -printf "%p\n ~> %c\n ~> %s B\n" + echo "-------------------------" + cat $i/*.log + done + false # stop here +) + + %clean rm -rf $RPM_BUILD_ROOT %post -p /sbin/ldconfig + %postun -p /sbin/ldconfig @@ -102,7 +124,6 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/*/mtree.* %{_mandir}/*/tar.* - %files devel %defattr(-,root,root,-) %doc @@ -126,6 +147,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Sun Jun 30 2013 Pavel Raiskup - 3.1.2-4 +- enable testsuite in the %%check phase + * Mon Jun 24 2013 Pavel Raiskup - 3.1.2-3 - bsdtar/bsdcpio should require versioned libarchive