Skip to content

Commit

Permalink
sysutils/squashfs-tools: update the port to version 4.5.1 (finally)
Browse files Browse the repository at this point in the history
This is a long-awaited release which fixes known security issue [1]
and regression when working with extended attributes [2].

Install more complete documentation set while here and GC no longer
needed CFLAGS+= and USE_CSTD knobs.

Security:	CVE-2021-41072 [1]
PR:		256790 [2], 261334
  • Loading branch information
Alexey Dokuchaev authored and Alexey Dokuchaev committed Mar 27, 2022
1 parent aed6452 commit 812d786
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 23 deletions.
30 changes: 18 additions & 12 deletions sysutils/squashfs-tools/Makefile
@@ -1,10 +1,9 @@
# Created by: Ashish SHUKLA <wahjava@gmail.com>

PORTNAME= squashfs-tools
PORTVERSION= 4.4
PORTVERSION= 4.5.1
CATEGORIES= sysutils
MASTER_SITES= SF/squashfs/squashfs/${DISTNAME}/
DISTNAME= squashfs${PORTVERSION}
MASTER_SITES= SF/squashfs/squashfs/squashfs${PORTVERSION}
DISTFILES= ${DISTNAME}${EXTRACT_SUFX}

MAINTAINER= danfe@FreeBSD.org
Expand All @@ -13,10 +12,14 @@ COMMENT= Set of tools to manipulate squashfs images
LICENSE= GPLv2
LICENSE_FILE= ${WRKSRC}/../COPYING

BUILD_DEPENDS= gsed:textproc/gsed

USES= alias cpe gmake
BINARY_ALIAS= sed=gsed

PLIST_FILES= bin/mksquashfs \
bin/unsquashfs
PLIST_FILES= bin/mksquashfs bin/sqfscat bin/sqfstar bin/unsquashfs \
man/man1/mksquashfs.1.gz man/man1/sqfscat.1.gz \
man/man1/sqfstar.1.gz man/man1/unsquashfs.1.gz

OPTIONS_DEFINE= DOCS LZ4 LZMA LZO XZ ZSTD
OPTIONS_DEFAULT= LZ4 LZMA LZO XZ ZSTD
Expand All @@ -28,13 +31,8 @@ WRKSRC= ${WRKDIR}/${DISTNAME}/squashfs-tools
CPE_PRODUCT= squashfs
CPE_VENDOR= squashfs_project

USE_CSTD= gnu89

# Fix build with clang11
CFLAGS+= -fcommon

PORTDOCS= ACKNOWLEDGEMENTS CHANGES README-${PORTVERSION} USAGE \
pseudo-file.example
PORTDOCS= ACKNOWLEDGEMENTS ACTIONS-README CHANGES DONATIONS \
README-${PORTVERSION} USAGE pseudo-file.example

LZ4_LIB_DEPENDS= liblz4.so:archivers/liblz4
LZ4_MAKE_ARGS= LZ4_SUPPORT=1
Expand All @@ -51,7 +49,15 @@ XZ_MAKE_ARGS= XZ_SUPPORT=1
ZSTD_LIB_DEPENDS= libzstd.so:archivers/zstd
ZSTD_MAKE_ARGS= ZSTD_SUPPORT=1

post-patch:
@${REINPLACE_CMD} -e '/^#include <unistd\.h>/ { x; \
s,^,#include <signal.h>,; G; }' ${WRKSRC}/reader.c
@${REINPLACE_CMD} -e '/^#include "squashfs_fs\.h"/ { x; \
s,^,typedef struct __sFILE FILE;,; G; }' \
${WRKSRC}/lzma_wrapper.c

post-install:
@${MV} ${WRKSRC:H}/RELEASE-READMEs/[Dp]* ${WRKSRC:H}
@${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC:H}/|} ${STAGEDIR}${DOCSDIR}

Expand Down
6 changes: 3 additions & 3 deletions sysutils/squashfs-tools/distinfo
@@ -1,5 +1,5 @@
TIMESTAMP = 1567045250
SHA256 (squashfs4.4.tar.gz) = a981b3f3f2054b5a2e658851a3c06a2460ad04a9a8a645e0afe063a63fdbb07e
SIZE (squashfs4.4.tar.gz) = 190797
TIMESTAMP = 1647547267
SHA256 (squashfs-tools-4.5.1.tar.gz) = 277b6e7f75a4a57f72191295ae62766a10d627a4f5e5f19eadfbc861378deea7
SIZE (squashfs-tools-4.5.1.tar.gz) = 270112
SHA256 (lzma922.tar.bz2) = 9aade84f229fb25f7aef39d8866b375fe6d35a9e18098d7cd86a99e294902944
SIZE (lzma922.tar.bz2) = 546148
22 changes: 14 additions & 8 deletions sysutils/squashfs-tools/files/patch-Makefile
@@ -1,6 +1,6 @@
--- Makefile.orig 2019-08-29 01:58:04 UTC
--- Makefile.orig 2022-03-17 19:32:02 UTC
+++ Makefile
@@ -97,7 +97,7 @@ COMP_DEFAULT = gzip
@@ -101,7 +101,7 @@ COMP_DEFAULT = gzip
# If your C library or build/target environment doesn't support XATTRs then
# comment out the next line to build Mksquashfs and Unsquashfs without XATTR
# support
Expand All @@ -9,7 +9,7 @@

# Select whether you wish xattrs to be stored by Mksquashfs and extracted
# by Unsquashfs by default. If selected users can disable xattr support by
@@ -105,7 +105,7 @@ XATTR_SUPPORT = 1
@@ -109,7 +109,7 @@ XATTR_SUPPORT = 1
#
# If unselected, Mksquashfs/Unsquashfs won't store and extract xattrs by
# default. Users can enable xattrs by using the -xattrs option.
Expand All @@ -18,7 +18,7 @@


###############################################
@@ -160,7 +160,7 @@ UNSQUASHFS_OBJS = unsquashfs.o unsquash-1.o unsquash-2
@@ -177,7 +177,7 @@ UNSQUASHFS_OBJS = unsquashfs.o unsquash-1.o unsquash-2

CFLAGS ?= -O2
CFLAGS += $(EXTRA_CFLAGS) $(INCLUDEDIR) -D_FILE_OFFSET_BITS=64 \
Expand All @@ -27,15 +27,15 @@
-Wall

LIBS = -lpthread -lm
@@ -200,6 +200,7 @@ endif
@@ -217,6 +217,7 @@ endif

ifeq ($(LZO_SUPPORT),1)
CFLAGS += -DLZO_SUPPORT
+INCLUDEDIR += -I$(LOCALBASE)/include
MKSQUASHFS_OBJS += lzo_wrapper.o
UNSQUASHFS_OBJS += lzo_wrapper.o
LIBS += $(LZO_LIBDIR) -llzo2
@@ -208,17 +209,19 @@ endif
LIBS += -llzo2
@@ -225,17 +226,19 @@ endif

ifeq ($(LZ4_SUPPORT),1)
CFLAGS += -DLZ4_SUPPORT
Expand All @@ -57,13 +57,19 @@
COMPRESSORS += zstd
endif

@@ -360,6 +363,6 @@ clean:
@@ -417,9 +420,9 @@ clean:

.PHONY: install
install: mksquashfs unsquashfs
- mkdir -p $(INSTALL_DIR)
- cp mksquashfs $(INSTALL_DIR)
- cp unsquashfs $(INSTALL_DIR)
- ln -fs unsquashfs $(INSTALL_DIR)/sqfscat
- ln -fs mksquashfs $(INSTALL_DIR)/sqfstar
- ../generate-manpages/install-manpages.sh $(shell pwd)/.. "$(INSTALL_MANPAGES_DIR)"
+ mkdir -p $(DESTDIR)$(PREFIX)/bin
+ ${BSD_INSTALL_PROGRAM} mksquashfs $(DESTDIR)$(PREFIX)/bin
+ ${BSD_INSTALL_PROGRAM} unsquashfs $(DESTDIR)$(PREFIX)/bin
+ ln -fs unsquashfs $(DESTDIR)$(INSTALL_DIR)/sqfscat
+ ln -fs mksquashfs $(DESTDIR)$(INSTALL_DIR)/sqfstar
+ ../generate-manpages/install-manpages.sh $(shell pwd)/.. "$(DESTDIR)$(INSTALL_MANPAGES_DIR)"

0 comments on commit 812d786

Please sign in to comment.