From c150302e27744cab0486525a66708c1acfddafd1 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Feb 09 2018 17:32:20 +0000 Subject: [PATCH 1/11] - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- diff --git a/squashfs-tools.spec b/squashfs-tools.spec index 19e8c81..ee82ac8 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -1,7 +1,7 @@ Summary: Utility for the creation of squashfs filesystems Name: squashfs-tools Version: 4.3 -Release: 15%{?dist} +Release: 16%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://squashfs.sourceforge.net/ @@ -69,6 +69,9 @@ rm -rf %{buildroot} %{_sbindir}/unsquashfs %changelog +* Fri Feb 09 2018 Fedora Release Engineering - 4.3-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + * Thu Aug 03 2017 Fedora Release Engineering - 4.3-15 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild From 6e02df8406a68f5adc15d2e255787621b1ffdac7 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Feb 13 2018 23:39:57 +0000 Subject: [PATCH 2/11] Remove BuildRoot definition None of currently supported distributions need that. It was needed last for EL5 which is EOL now Signed-off-by: Igor Gnatenko --- diff --git a/squashfs-tools.spec b/squashfs-tools.spec index ee82ac8..5f6343a 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -25,7 +25,6 @@ Patch2: 2gb.patch Patch3: cve-2015-4645.patch # Update formats to match changes in cve-2015-4645.patch Patch4: local-cve-fix.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: zlib-devel BuildRequires: xz-devel BuildRequires: lzo-devel From 931f8cd02ff2570eb4c2ddfccac65cee0013baff Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Feb 14 2018 06:40:21 +0000 Subject: [PATCH 3/11] Remove %clean section None of currently supported distributions need that. Last one was EL5 which is EOL for a while. Signed-off-by: Igor Gnatenko --- diff --git a/squashfs-tools.spec b/squashfs-tools.spec index 5f6343a..10bb72f 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -54,9 +54,6 @@ install -m 755 squashfs-tools/unsquashfs %{buildroot}%{_sbindir}/unsquashfs install -m 644 %{SOURCE1} %{buildroot}%{_mandir}/man1/mksquashfs.1 install -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/unsquashfs.1 -%clean -rm -rf %{buildroot} - %files %defattr(-,root,root,-) %doc README ACKNOWLEDGEMENTS DONATIONS PERFORMANCE.README README-4.3 CHANGES pseudo-file.example COPYING From 8354ad07a4381f5e8d32a51f2530c00dd8536318 Mon Sep 17 00:00:00 2001 From: Jason Tibbitts Date: Jul 10 2018 06:26:43 +0000 Subject: [PATCH 4/11] Remove needless use of %defattr --- diff --git a/squashfs-tools.spec b/squashfs-tools.spec index 10bb72f..3f9fdc6 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -55,7 +55,6 @@ install -m 644 %{SOURCE1} %{buildroot}%{_mandir}/man1/mksquashfs.1 install -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/unsquashfs.1 %files -%defattr(-,root,root,-) %doc README ACKNOWLEDGEMENTS DONATIONS PERFORMANCE.README README-4.3 CHANGES pseudo-file.example COPYING %doc README From 2860d591815dff878bef8a422458974946fdc1a4 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Jul 14 2018 06:38:28 +0000 Subject: [PATCH 5/11] - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- diff --git a/squashfs-tools.spec b/squashfs-tools.spec index 3f9fdc6..293ec46 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -1,7 +1,7 @@ Summary: Utility for the creation of squashfs filesystems Name: squashfs-tools Version: 4.3 -Release: 16%{?dist} +Release: 17%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://squashfs.sourceforge.net/ @@ -64,6 +64,9 @@ install -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/unsquashfs.1 %{_sbindir}/unsquashfs %changelog +* Sat Jul 14 2018 Fedora Release Engineering - 4.3-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + * Fri Feb 09 2018 Fedora Release Engineering - 4.3-16 - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild From b85fd9509fe0c4940103d21cc44ad3fef8edd294 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Jul 24 2018 14:55:37 +0000 Subject: [PATCH 6/11] Add missing BuildRequires on gcc make: cc: Command not found References: https://bugzilla.redhat.com/show_bug.cgi?id=1606409 Signed-off-by: Igor Gnatenko --- diff --git a/squashfs-tools.spec b/squashfs-tools.spec index 293ec46..b5af18c 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -25,6 +25,7 @@ Patch2: 2gb.patch Patch3: cve-2015-4645.patch # Update formats to match changes in cve-2015-4645.patch Patch4: local-cve-fix.patch +BuildRequires: gcc BuildRequires: zlib-devel BuildRequires: xz-devel BuildRequires: lzo-devel From 3e0884a0b5a073a3586c11321ae55c53720c4ed7 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Jan 28 2019 19:24:50 +0000 Subject: [PATCH 7/11] Remove obsolete Group tag References: https://fedoraproject.org/wiki/Changes/Remove_Group_Tag --- diff --git a/squashfs-tools.spec b/squashfs-tools.spec index b5af18c..a9db729 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -3,7 +3,6 @@ Name: squashfs-tools Version: 4.3 Release: 17%{?dist} License: GPLv2+ -Group: System Environment/Base URL: http://squashfs.sourceforge.net/ Source0: http://downloads.sourceforge.net/squashfs/squashfs%{version}.tar.gz # manpages from http://ftp.debian.org/debian/pool/main/s/squashfs-tools/squashfs-tools_4.2+20121212-1.debian.tar.xz From 48fdbae9436aeb419bf4a1985ed2bae6b5d22b99 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Feb 03 2019 08:28:12 +0000 Subject: [PATCH 8/11] - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- diff --git a/squashfs-tools.spec b/squashfs-tools.spec index a9db729..2f2acc0 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -1,7 +1,7 @@ Summary: Utility for the creation of squashfs filesystems Name: squashfs-tools Version: 4.3 -Release: 17%{?dist} +Release: 18%{?dist} License: GPLv2+ URL: http://squashfs.sourceforge.net/ Source0: http://downloads.sourceforge.net/squashfs/squashfs%{version}.tar.gz @@ -64,6 +64,9 @@ install -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/unsquashfs.1 %{_sbindir}/unsquashfs %changelog +* Sun Feb 03 2019 Fedora Release Engineering - 4.3-18 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + * Sat Jul 14 2018 Fedora Release Engineering - 4.3-17 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild From bc150b2804a1679cd8d2315ca77e1a9bde915605 Mon Sep 17 00:00:00 2001 From: Bruno Wolff III Date: May 21 2019 06:59:57 +0000 Subject: [PATCH 9/11] Add fix for glibc changes --- diff --git a/glibc.patch b/glibc.patch new file mode 100644 index 0000000..87c63b1 --- /dev/null +++ b/glibc.patch @@ -0,0 +1,20 @@ +--- squashfs-tools/mksquashfs.c.orig 2019-05-21 01:50:02.197183719 -0500 ++++ squashfs-tools/mksquashfs.c 2019-05-21 01:51:05.818179903 -0500 +@@ -50,6 +50,7 @@ + #include + #include + #include ++#include + + #ifndef linux + #define __BYTE_ORDER BYTE_ORDER +--- squashfs-tools/unsquashfs.c.orig 2019-05-21 01:57:45.984155904 -0500 ++++ squashfs-tools/unsquashfs.c 2019-05-21 01:58:39.837152674 -0500 +@@ -37,6 +37,7 @@ + #include + #include + #include ++#include + + struct cache *fragment_cache, *data_cache; + struct queue *to_reader, *to_inflate, *to_writer, *from_writer; diff --git a/squashfs-tools.spec b/squashfs-tools.spec index 2f2acc0..c3183ee 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -1,7 +1,7 @@ Summary: Utility for the creation of squashfs filesystems Name: squashfs-tools Version: 4.3 -Release: 18%{?dist} +Release: 19%{?dist} License: GPLv2+ URL: http://squashfs.sourceforge.net/ Source0: http://downloads.sourceforge.net/squashfs/squashfs%{version}.tar.gz @@ -24,6 +24,8 @@ Patch2: 2gb.patch Patch3: cve-2015-4645.patch # Update formats to match changes in cve-2015-4645.patch Patch4: local-cve-fix.patch +# sys/sysmacros.h is no longer included by sys/types.h +Patch5: glibc.patch BuildRequires: gcc BuildRequires: zlib-devel BuildRequires: xz-devel @@ -42,6 +44,7 @@ contains the utilities for manipulating squashfs filesystems. %patch2 -p0 %patch3 -p1 %patch4 -p0 +%patch5 -p0 %build pushd squashfs-tools @@ -64,6 +67,9 @@ install -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/unsquashfs.1 %{_sbindir}/unsquashfs %changelog +* Tue May 21 2019 Bruno Wolff III - 4.3-19 +- Fix issue with glibc changes + * Sun Feb 03 2019 Fedora Release Engineering - 4.3-18 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild From 6f5359565811e04a99ee6f1878376c1b1ddc871b Mon Sep 17 00:00:00 2001 From: Bruno Wolff III Date: May 21 2019 07:48:48 +0000 Subject: [PATCH 10/11] Fix issue with LDFLAGS not getting set Bug 1573109. --- diff --git a/squashfs-tools.spec b/squashfs-tools.spec index c3183ee..d80aeb7 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -1,7 +1,7 @@ Summary: Utility for the creation of squashfs filesystems Name: squashfs-tools Version: 4.3 -Release: 19%{?dist} +Release: 20%{?dist} License: GPLv2+ URL: http://squashfs.sourceforge.net/ Source0: http://downloads.sourceforge.net/squashfs/squashfs%{version}.tar.gz @@ -47,6 +47,7 @@ contains the utilities for manipulating squashfs filesystems. %patch5 -p0 %build +%set_build_flags pushd squashfs-tools CFLAGS="%{optflags}" XZ_SUPPORT=1 LZO_SUPPORT=1 LZMA_XZ_SUPPORT=1 LZ4_SUPPORT=1 make %{?_smp_mflags} @@ -67,6 +68,9 @@ install -m 644 %{SOURCE2} %{buildroot}%{_mandir}/man1/unsquashfs.1 %{_sbindir}/unsquashfs %changelog +* Tue May 21 2019 Bruno Wolff III - 4.3-20 +- Fix issue with LDFLAGS not being set + * Tue May 21 2019 Bruno Wolff III - 4.3-19 - Fix issue with glibc changes From d81a1f88a6ae3a8f2090da5783f8a840f189fe97 Mon Sep 17 00:00:00 2001 From: Bruno Wolff III Date: May 21 2019 17:39:33 +0000 Subject: [PATCH 11/11] Add a CI test --- diff --git a/tests/Squashfs-compression-test.sh b/tests/Squashfs-compression-test.sh new file mode 100755 index 0000000..64322f9 --- /dev/null +++ b/tests/Squashfs-compression-test.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +# We need rpmdev-vercmp +dnf install -y rpmdevtools +rpm -q rpmdevtools > /dev/null 2>&1 || (echo 'rpmdev-vercmp from rpmdevtools is needed to run this script, aborting (failed).'; exit 1) + +# Define block sizes +blocks=(4K 1M) + +# Define fill files +fill=(/dev/zero /dev/urandom) + +# Define number of iterations +iter=5 + +# Define fragment sizes +frags=(0 1 2047 4095) + +# Define test directory +testdir=/tmp/test-squashfs + +# Define mount point +mp=${testdir}/mnt + +# Define data directory +datadir=${testdir}/data + +# Check for squashfs-tools version and set compression types to test +sqfsver=`rpm -q --qf '%{EVR}' squashfs-tools` +if rpmdev-vercmp 4.1 ${sqfsver} > /dev/null; [ $? == '11' ]; then + ucomp=('gzip') +elif rpmdev-vercmp 4.2 ${sqfsver} > /dev/null; [ $? == '11' ]; then + ucomp=(gzip lzo lzma) +elif rpmdev-vercmp 4.3-1 ${sqfsver} > /dev/null; [ $? == '11' ]; then + ucomp=(gzip lzo lzma xz) +elif rpmdev-vercmp 4.3-21 ${sqfsver} > /dev/null; [ $? == '11' ]; then + ucomp=(gzip lzo lzma xz lz4) +else + ucomp=(gzip lzo lzma xz lz4 zstd) +fi + +# Check for kernel verion and set mount test compression types +kernel=`uname -r` +if rpmdev-vercmp 2.6.36 ${kernel} > /dev/null; [ $? == '11' ]; then + mcomp=('gzip') +elif rpmdev-vercmp 2.6.38 ${kernel} > /dev/null; [ $? == '11' ]; then + mcomp=(gzip lzo) +elif rpmdev-vercmp 3.19 ${kernel} > /dev/null; [ $? == '11' ]; then + mcomp=(gzip lzo xz) +elif rpmdev-vercmp 4.14 ${kernel} > /dev/null; [ $? == '11' ]; then + mcomp=(gzip lzo xz lz4) +else + mcomp=(gzip lzo xz lz4 zstd) +fi + +# Check for uid 0 and print a warning if not +[ ${UID} -ne 0 ] && echo 'Mount tests will not be performed when not running as root' + +# Check if test directory exists and make if not +[ -d ${testdir} ] || mkdir ${testdir} +[ -d ${testdir} ] || (echo "Unable to make '${testdir}', aborting (failed)."; exit 1) + +# Check if mount point directory exists and make if not +[ -d ${mp} ] || mkdir ${mp} +[ -d ${mp} ] || (echo "Unable to make '${mp}', aborting (failed)."; exit 1) + +# Check if data directory exists and make if not +if [ -d ${datadir} ]; then + echo "Using existing data directory." +else + echo "Building data directory." + mkdir ${datadir} + [ -d ${datadir} ] || (echo "Unable to make '${datadir}', aborting (failed)."; exit 1) + for size in ${frags[*]}; do + for file in ${fill[*]}; do + dd if=${file} of=${datadir}/frag-`basename ${file}`-${size} bs=1 count=${size} > /dev/null 2>&1 + done + done + for size in ${blocks[*]}; do + for ((count=1;${count}<=${iter};count++)); do + for file in ${fill[*]}; do + dd if=${file} of=${datadir}/file-`basename ${file}`-${size}-${count} bs=${size} count=${count} > /dev/null 2>&1 + done + done + done + for size1 in ${frags[*]}; do + for file1 in ${fill[*]}; do + for size2 in ${blocks[*]}; do + for ((count=1;${count}<=${iter};count++)); do + for file2 in ${fill[*]}; do + cat ${datadir}/file-`basename ${file2}`-${size2}-${count} ${datadir}/frag-`basename ${file1}`-${size1} > ${datadir}/combined-`basename ${file2}`-${size2}-${count}-`basename ${file1}`-${size1} + done + done + done + done + done +fi + +# Run unmounted tests +for comp in ${ucomp[*]}; do + echo "Building squashfs image using ${comp} compression." + if [ "${comp}" == gzip ]; then + mksquashfs ${datadir} ${testdir}/sq.img || (echo "mksquashfs failed for ${comp} compression."; continue) + else + mksquashfs ${datadir} ${testdir}/sq.img -comp ${comp} || (echo "mksquashfs failed for ${comp} compression."; continue) + fi + echo "Testing unmounted extract using ${comp} compression." + unsquashfs -d ${testdir}/sq ${testdir}/sq.img || echo "unsquashfs failed for ${comp} compression." + diff -r -q ${testdir}/sq ${datadir} || (echo "Extract test failed for ${comp} compression."; exit) + rm -rf ${testdir}/sq + if [ ${UID} == 0 ]; then + for kern in ${mcomp[*]}; do + if [ ${kern} == ${comp} ]; then + echo "Testing mounted image using ${comp} compression." + mount -r -o loop ${testdir}/sq.img ${mp} || echo "Mount failed."; + diff -r -q ${mp} ${datadir} || echo "Mounted test failed for ${comp} compression." + umount ${mp} + break + fi + done + fi + rm -f ${testdir}/sq ${testdir}/sq.img +done diff --git a/tests/test_working.yml b/tests/test_working.yml new file mode 100644 index 0000000..c542b61 --- /dev/null +++ b/tests/test_working.yml @@ -0,0 +1,27 @@ +--- +- hosts: localhost + vars: + - artifacts: ./artifacts + tags: + - classic + remote_user: root + tasks: + - name: Install the test files + copy: src={{ item.file }} dest=/usr/local/bin/{{ item.dest }} mode=0755 + with_items: + - {file: Squashfs-compression-test.sh, dest: Squashfs-compression-test.sh } + - name: Test block + block: + - name: Execute the tests + shell: | + /usr/local/bin/Squashfs-compression-test.sh &> /tmp/test.log; grep -iq failed /tmp/test.log && result=fail || result=pass + echo -e "results:\n- {result: $result, test: working}" > /tmp/results.yml + always: + - name: Pull out the logs + fetch: + dest: "{{ artifacts }}/" + src: "{{ item }}" + flat: yes + with_items: + - /tmp/test.log + - /tmp/results.yml diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..ce4a407 --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1 @@ +- import_playbook: test_working.yml