summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys-fs/squashfs-tools/Manifest1
-rw-r--r--sys-fs/squashfs-tools/files/squashfs-tools-4.3-2gb.patch30
-rw-r--r--sys-fs/squashfs-tools/files/squashfs-tools-4.3-aligned-data.patch15
-rw-r--r--sys-fs/squashfs-tools/files/squashfs-tools-4.3-local-cve-fix.patch19
-rw-r--r--sys-fs/squashfs-tools/files/squashfs-tools-4.3-mem-overflow.patch35
-rw-r--r--sys-fs/squashfs-tools/files/squashfs-tools-4.3-sysmacros.patch25
-rw-r--r--sys-fs/squashfs-tools/files/squashfs-tools-4.3-xattrs.patch34
-rw-r--r--sys-fs/squashfs-tools/squashfs-tools-4.3-r2.ebuild99
-rw-r--r--sys-fs/squashfs-tools/squashfs-tools-4.3.ebuild69
-rw-r--r--sys-fs/squashfs-tools/squashfs-tools-99999999.ebuild78
10 files changed, 312 insertions, 93 deletions
diff --git a/sys-fs/squashfs-tools/Manifest b/sys-fs/squashfs-tools/Manifest
index 381458c8..fadd2c0e 100644
--- a/sys-fs/squashfs-tools/Manifest
+++ b/sys-fs/squashfs-tools/Manifest
@@ -1 +1,2 @@
+DIST squashfs-tools_4.3-3.debian.tar.xz 15252 SHA256 1c296cc147e322e7124bf23a3c242ac83f6a986e6d6f64829ad2424b33914fc4
DIST squashfs4.3.tar.gz 182550 SHA256 0d605512437b1eb800b4736791559295ee5f60177e102e4d4ccd0ee241a5f3f6
diff --git a/sys-fs/squashfs-tools/files/squashfs-tools-4.3-2gb.patch b/sys-fs/squashfs-tools/files/squashfs-tools-4.3-2gb.patch
new file mode 100644
index 00000000..467448f6
--- /dev/null
+++ b/sys-fs/squashfs-tools/files/squashfs-tools-4.3-2gb.patch
@@ -0,0 +1,30 @@
+From 9c1db6d13a51a2e009f0027ef336ce03624eac0d Mon Sep 17 00:00:00 2001
+From: "Guan, Xin" <guanx.bac@gmail.com>
+Date: Sat, 13 Sep 2014 13:15:26 +0200
+Subject: [PATCH] Fix 2GB-limit of the is_fragment(...) function.
+
+Applies to squashfs-tools 4.3.
+
+Reported-by: Bruno Wolff III <bruno@wolff.to>
+Signed-off-by: Guan, Xin <guanx.bac@gmail.com>
+Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
+---
+ squashfs-tools/mksquashfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
+index f1fcff1cc284..d221c35865a0 100644
+--- a/squashfs-tools/mksquashfs.c
++++ b/squashfs-tools/mksquashfs.c
+@@ -2029,7 +2029,7 @@ struct file_info *duplicate(long long file_size, long long bytes,
+
+ inline int is_fragment(struct inode_info *inode)
+ {
+- int file_size = inode->buf.st_size;
++ off_t file_size = inode->buf.st_size;
+
+ /*
+ * If this block is to be compressed differently to the
+--
+2.8.2
+
diff --git a/sys-fs/squashfs-tools/files/squashfs-tools-4.3-aligned-data.patch b/sys-fs/squashfs-tools/files/squashfs-tools-4.3-aligned-data.patch
new file mode 100644
index 00000000..024129ff
--- /dev/null
+++ b/sys-fs/squashfs-tools/files/squashfs-tools-4.3-aligned-data.patch
@@ -0,0 +1,15 @@
+the mksquashfs code has an all_zeros func that does:
+ long *p = (long *) file_buffer->data;
+
+make sure we force the data field to be aligned so that still works.
+
+--- a/squashfs-tools/caches-queues-lists.h
++++ b/squashfs-tools/caches-queues-lists.h
+@@ -123,6 +123,7 @@ struct file_buffer {
+ char locked;
+ char wait_on_unlock;
+ char noD;
++ long _pad;
+ char data[0];
+ };
+
diff --git a/sys-fs/squashfs-tools/files/squashfs-tools-4.3-local-cve-fix.patch b/sys-fs/squashfs-tools/files/squashfs-tools-4.3-local-cve-fix.patch
new file mode 100644
index 00000000..7637f67c
--- /dev/null
+++ b/sys-fs/squashfs-tools/files/squashfs-tools-4.3-local-cve-fix.patch
@@ -0,0 +1,19 @@
+taken from Fedora
+
+commit af393379e34c5677f95bbec11645b6c3028195b4
+Author: Bruno Wolff III <bruno@wolff.to>
+Date: Wed Jun 24 14:27:31 2015 -0500
+
+Update printf formats to match datatypes after CVE patch
+
+--- squashfs-tools/unsquash-4.c
++++ squashfs-tools/unsquash-4.c
+@@ -35,7 +35,7 @@
+ size_t indexes = SQUASHFS_FRAGMENT_INDEXES(sBlk.s.fragments);
+ long long *fragment_table_index;
+
+- TRACE("read_fragment_table: %d fragments, reading %d fragment indexes "
++ TRACE("read_fragment_table: %u fragments, reading %zu fragment indexes "
+ "from 0x%llx\n", sBlk.s.fragments, indexes,
+ sBlk.s.fragment_table_start);
+
diff --git a/sys-fs/squashfs-tools/files/squashfs-tools-4.3-mem-overflow.patch b/sys-fs/squashfs-tools/files/squashfs-tools-4.3-mem-overflow.patch
new file mode 100644
index 00000000..a9b00014
--- /dev/null
+++ b/sys-fs/squashfs-tools/files/squashfs-tools-4.3-mem-overflow.patch
@@ -0,0 +1,35 @@
+taken from Fedora
+
+From 604b607d8ac91eb8afc0b6e3d917d5c073096103 Mon Sep 17 00:00:00 2001
+From: Phillip Lougher <phillip@squashfs.org.uk>
+Date: Wed, 11 Jun 2014 04:51:37 +0100
+Subject: mksquashfs: ensure value does not overflow a signed int in -mem
+ option
+
+Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
+
+diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
+index 5370ecf..9676dc8 100644
+--- a/squashfs-tools/mksquashfs.c
++++ b/squashfs-tools/mksquashfs.c
+@@ -5193,7 +5193,16 @@ print_compressor_options:
+ argv[0]);
+ exit(1);
+ }
+- /* convert from bytes to Mbytes */
++
++ /*
++ * convert from bytes to Mbytes, ensuring the value
++ * does not overflow a signed int
++ */
++ if(number >= (1LL << 51)) {
++ ERROR("%s: -mem invalid mem size\n", argv[0]);
++ exit(1);
++ }
++
+ total_mem = number / 1048576;
+ if(total_mem < (SQUASHFS_LOWMEM / SQUASHFS_TAKE)) {
+ ERROR("%s: -mem should be %d Mbytes or "
+--
+cgit v0.10.1
+
diff --git a/sys-fs/squashfs-tools/files/squashfs-tools-4.3-sysmacros.patch b/sys-fs/squashfs-tools/files/squashfs-tools-4.3-sysmacros.patch
new file mode 100644
index 00000000..1430b1a2
--- /dev/null
+++ b/sys-fs/squashfs-tools/files/squashfs-tools-4.3-sysmacros.patch
@@ -0,0 +1,25 @@
+sys/types.h might not always include sys/sysmacros.h for major/minor/makedev
+
+--- a/squashfs-tools/mksquashfs.c
++++ b/squashfs-tools/mksquashfs.c
+@@ -59,6 +59,7 @@
+ #else
+ #include <endian.h>
+ #include <sys/sysinfo.h>
++#include <sys/sysmacros.h>
+ #endif
+
+ #include "squashfs_fs.h"
+--- a/squashfs-tools/unsquashfs.c
++++ b/squashfs-tools/unsquashfs.c
+@@ -38,6 +38,10 @@
+ #include <limits.h>
+ #include <ctype.h>
+
++#ifdef linux
++#include <sys/sysmacros.h>
++#endif
++
+ struct cache *fragment_cache, *data_cache;
+ struct queue *to_reader, *to_inflate, *to_writer, *from_writer;
+ pthread_t *thread, *inflator_thread;
diff --git a/sys-fs/squashfs-tools/files/squashfs-tools-4.3-xattrs.patch b/sys-fs/squashfs-tools/files/squashfs-tools-4.3-xattrs.patch
new file mode 100644
index 00000000..47b0ea5c
--- /dev/null
+++ b/sys-fs/squashfs-tools/files/squashfs-tools-4.3-xattrs.patch
@@ -0,0 +1,34 @@
+From ffe9e55c4993422ce36213fa86d4fc29c22646ea Mon Sep 17 00:00:00 2001
+From: Wessel Dankers <wsl-debian-804194@fruit.je>
+Date: Fri, 17 Jun 2016 09:46:42 +0800
+Subject: [PATCH] unsquashfs: Correctly set file capabilities
+
+As posted on https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804194.
+---
+ squashfs-tools/unsquashfs.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c
+index 1323dd6..a5f0117 100644
+--- a/squashfs-tools/unsquashfs.c
++++ b/squashfs-tools/unsquashfs.c
+@@ -821,8 +821,6 @@ int set_attributes(char *pathname, int mode, uid_t uid, gid_t guid, time_t time,
+ {
+ struct utimbuf times = { time, time };
+
+- write_xattr(pathname, xattr);
+-
+ if(utime(pathname, &times) == -1) {
+ ERROR("set_attributes: failed to set time on %s, because %s\n",
+ pathname, strerror(errno));
+@@ -845,6 +843,8 @@ int set_attributes(char *pathname, int mode, uid_t uid, gid_t guid, time_t time,
+ return FALSE;
+ }
+
++ write_xattr(pathname, xattr);
++
+ return TRUE;
+ }
+
+--
+2.8.0.rc3.226.g39d4020
diff --git a/sys-fs/squashfs-tools/squashfs-tools-4.3-r2.ebuild b/sys-fs/squashfs-tools/squashfs-tools-4.3-r2.ebuild
new file mode 100644
index 00000000..177749bb
--- /dev/null
+++ b/sys-fs/squashfs-tools/squashfs-tools-4.3-r2.ebuild
@@ -0,0 +1,99 @@
+# Copyright 2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit flag-o-matic toolchain-funcs
+
+LIVE=false
+PVm=${PV}
+case ${PV} in
+*9999)
+ LIVE=:
+ PVm=4.3;;
+esac
+Pm=${PN}-${PVm}
+DEB_VER="3"
+
+DESCRIPTION="Tool for creating compressed filesystem type squashfs. Patched to support -quiet"
+HOMEPAGE="http://squashfs.sourceforge.net"
+EXTRA_URI="mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PVm}-${DEB_VER}.debian.tar.xz"
+SRC_URI="mirror://sourceforge/squashfs/squashfs${PV}.tar.gz
+ ${EXTRA_URI}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="lz4 lzma lzo xattr +xz"
+
+RDEPEND="
+ sys-libs/zlib
+ !xz? ( !lzo? ( sys-libs/zlib ) )
+ lz4? ( app-arch/lz4 )
+ lzma? ( app-arch/xz-utils )
+ lzo? ( dev-libs/lzo )
+ xattr? ( sys-apps/attr )
+ xz? ( app-arch/xz-utils )
+"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/squashfs${PV}/${PN}"
+
+if ${LIVE}
+then PROPERTIES="live"
+ EGIT_REPO_URI="git://github.com/plougher/${PN}"
+ inherit git-r3
+ SRC_URI=${EXTRA_URI}
+ KEYWORDS=""
+ S="${WORKDIR}/${P}/${PN}"
+src_unpack() {
+ default
+ git-r3_src_unpack
+}
+fi
+
+src_prepare() {
+ local i j
+ for i in "${WORKDIR}"/debian/patches/*.patch
+ do ${LIVE} && j=${i##*/} && case ${j%.*} in
+ 0002-fix_phys_mem_calculation)
+ continue;;
+ esac
+ eapply -p2 "${i}"
+ done
+ eapply -p2 "${FILESDIR}"/${Pm}-sysmacros.patch
+ eapply -p2 "${FILESDIR}"/${Pm}-aligned-data.patch
+ ${LIVE} || eapply -p2 "${FILESDIR}"/${Pm}-2gb.patch
+ eapply -p1 "${FILESDIR}"/${Pm}-local-cve-fix.patch
+ ${LIVE} || eapply -p2 "${FILESDIR}"/${Pm}-mem-overflow.patch
+ eapply -p2 "${FILESDIR}"/${Pm}-xattrs.patch
+ eapply "${FILESDIR}"/${Pm}-quiet.patch
+ eapply_user
+}
+
+use10() { usex $1 1 0 ; }
+
+src_configure() {
+ # set up make command line variables in EMAKE_SQUASHFS_CONF
+ EMAKE_SQUASHFS_CONF=(
+ LZMA_XZ_SUPPORT=$(use10 lzma)
+ LZO_SUPPORT=$(use10 lzo)
+ LZ4_SUPPORT=$(use10 lz4)
+ XATTR_SUPPORT=$(use10 xattr)
+ XZ_SUPPORT=$(use10 xz)
+ )
+ filter-flags -fno-common
+
+ tc-export CC
+}
+
+src_compile() {
+ emake "${EMAKE_SQUASHFS_CONF[@]}"
+}
+
+src_install() {
+ dobin mksquashfs unsquashfs
+ cd ..
+ dodoc CHANGES README*
+ ${LIVE} || dodoc PERFORMANCE.README pseudo-file.example OLD-READMEs/*
+ doman "${WORKDIR}"/debian/manpages/*.[0-9]
+}
diff --git a/sys-fs/squashfs-tools/squashfs-tools-4.3.ebuild b/sys-fs/squashfs-tools/squashfs-tools-4.3.ebuild
deleted file mode 100644
index e07ed4da..00000000
--- a/sys-fs/squashfs-tools/squashfs-tools-4.3.ebuild
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright 2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=6
-inherit flag-o-matic toolchain-funcs
-
-DESCRIPTION="Tool for creating compressed filesystem type squashfs. Patched to support -quiet"
-HOMEPAGE="http://squashfs.sourceforge.net"
-SRC_URI="mirror://sourceforge/squashfs/squashfs${PV}.tar.gz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-IUSE="+xz lzma lz4 lzo xattr"
-
-RDEPEND="
- sys-libs/zlib
- !xz? ( !lzo? ( sys-libs/zlib ) )
- lz4? ( app-arch/lz4 )
- lzma? ( app-arch/xz-utils )
- lzo? ( dev-libs/lzo )
- xattr? ( sys-apps/attr )
- xz? ( app-arch/xz-utils )
-"
-DEPEND="${RDEPEND}"
-
-S="${WORKDIR}/squashfs${PV}/${PN}"
-
-PATCHES=("${FILESDIR}/${PN}-4.3-quiet.patch")
-
-case ${PV} in
-*9999)
- PROPERTIES="live"
- EGIT_REPO_URI="git://github.com/plougher/${PN}"
- inherit git-r3
- SRC_URI=""
- KEYWORDS=""
- S="${WORKDIR}/${P}/${PN}";;
-esac
-
-src_configure() {
- # set up make command line variables in EMAKE_SQUASHFS_CONF
- EMAKE_SQUASHFS_CONF=(
- $(usex lzma LZMA_XZ_SUPPORT=1 LZMA_XS_SUPPORT=0)
- $(usex lzo LZO_SUPPORT=1 LZO_SUPPORT=0)
- $(usex lz4 LZ4_SUPPORT=1 LZ4_SUPPORT=0)
- $(usex xattr XATTR_SUPPORT=1 XATTR_SUPPORT=0)
- $(usex xz XZ_SUPPORT=1 XZ_SUPPORT=0)
- )
- filter-flags -fno-common
-
- tc-export CC
-}
-
-src_compile() {
- emake ${EMAKE_SQUASHFS_CONF[@]}
-}
-
-src_install() {
- dobin mksquashfs unsquashfs
- dodoc ../README
-}
-
-pkg_postinst() {
- ewarn "This version of mksquashfs requires a 2.6.29 kernel or better"
- use xz &&
- ewarn "XZ support requires a 2.6.38 kernel or better"
-}
diff --git a/sys-fs/squashfs-tools/squashfs-tools-99999999.ebuild b/sys-fs/squashfs-tools/squashfs-tools-99999999.ebuild
index e07ed4da..177749bb 100644
--- a/sys-fs/squashfs-tools/squashfs-tools-99999999.ebuild
+++ b/sys-fs/squashfs-tools/squashfs-tools-99999999.ebuild
@@ -1,18 +1,29 @@
# Copyright 2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Id$
EAPI=6
inherit flag-o-matic toolchain-funcs
+LIVE=false
+PVm=${PV}
+case ${PV} in
+*9999)
+ LIVE=:
+ PVm=4.3;;
+esac
+Pm=${PN}-${PVm}
+DEB_VER="3"
+
DESCRIPTION="Tool for creating compressed filesystem type squashfs. Patched to support -quiet"
HOMEPAGE="http://squashfs.sourceforge.net"
-SRC_URI="mirror://sourceforge/squashfs/squashfs${PV}.tar.gz"
+EXTRA_URI="mirror://debian/pool/main/${PN:0:1}/${PN}/${PN}_${PVm}-${DEB_VER}.debian.tar.xz"
+SRC_URI="mirror://sourceforge/squashfs/squashfs${PV}.tar.gz
+ ${EXTRA_URI}"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
-IUSE="+xz lzma lz4 lzo xattr"
+IUSE="lz4 lzma lzo xattr +xz"
RDEPEND="
sys-libs/zlib
@@ -27,26 +38,48 @@ DEPEND="${RDEPEND}"
S="${WORKDIR}/squashfs${PV}/${PN}"
-PATCHES=("${FILESDIR}/${PN}-4.3-quiet.patch")
-
-case ${PV} in
-*9999)
- PROPERTIES="live"
+if ${LIVE}
+then PROPERTIES="live"
EGIT_REPO_URI="git://github.com/plougher/${PN}"
inherit git-r3
- SRC_URI=""
+ SRC_URI=${EXTRA_URI}
KEYWORDS=""
- S="${WORKDIR}/${P}/${PN}";;
-esac
+ S="${WORKDIR}/${P}/${PN}"
+src_unpack() {
+ default
+ git-r3_src_unpack
+}
+fi
+
+src_prepare() {
+ local i j
+ for i in "${WORKDIR}"/debian/patches/*.patch
+ do ${LIVE} && j=${i##*/} && case ${j%.*} in
+ 0002-fix_phys_mem_calculation)
+ continue;;
+ esac
+ eapply -p2 "${i}"
+ done
+ eapply -p2 "${FILESDIR}"/${Pm}-sysmacros.patch
+ eapply -p2 "${FILESDIR}"/${Pm}-aligned-data.patch
+ ${LIVE} || eapply -p2 "${FILESDIR}"/${Pm}-2gb.patch
+ eapply -p1 "${FILESDIR}"/${Pm}-local-cve-fix.patch
+ ${LIVE} || eapply -p2 "${FILESDIR}"/${Pm}-mem-overflow.patch
+ eapply -p2 "${FILESDIR}"/${Pm}-xattrs.patch
+ eapply "${FILESDIR}"/${Pm}-quiet.patch
+ eapply_user
+}
+
+use10() { usex $1 1 0 ; }
src_configure() {
# set up make command line variables in EMAKE_SQUASHFS_CONF
EMAKE_SQUASHFS_CONF=(
- $(usex lzma LZMA_XZ_SUPPORT=1 LZMA_XS_SUPPORT=0)
- $(usex lzo LZO_SUPPORT=1 LZO_SUPPORT=0)
- $(usex lz4 LZ4_SUPPORT=1 LZ4_SUPPORT=0)
- $(usex xattr XATTR_SUPPORT=1 XATTR_SUPPORT=0)
- $(usex xz XZ_SUPPORT=1 XZ_SUPPORT=0)
+ LZMA_XZ_SUPPORT=$(use10 lzma)
+ LZO_SUPPORT=$(use10 lzo)
+ LZ4_SUPPORT=$(use10 lz4)
+ XATTR_SUPPORT=$(use10 xattr)
+ XZ_SUPPORT=$(use10 xz)
)
filter-flags -fno-common
@@ -54,16 +87,13 @@ src_configure() {
}
src_compile() {
- emake ${EMAKE_SQUASHFS_CONF[@]}
+ emake "${EMAKE_SQUASHFS_CONF[@]}"
}
src_install() {
dobin mksquashfs unsquashfs
- dodoc ../README
-}
-
-pkg_postinst() {
- ewarn "This version of mksquashfs requires a 2.6.29 kernel or better"
- use xz &&
- ewarn "XZ support requires a 2.6.38 kernel or better"
+ cd ..
+ dodoc CHANGES README*
+ ${LIVE} || dodoc PERFORMANCE.README pseudo-file.example OLD-READMEs/*
+ doman "${WORKDIR}"/debian/manpages/*.[0-9]
}