From ff8a79c34a7e625012a0b4e2c80ec34b984b71cb Mon Sep 17 00:00:00 2001 From: Zhiqiang Liu Date: Mon, 13 Jul 2020 11:46:17 +0800 Subject: [PATCH 1/3] squashfs-tools: backport upstream bugfix patches squashfs-tools: backport upstream bugfix patches Signed-off-by: Zhiqiang Liu (cherry picked from commit e6a6afcc7a96fab3fe3b87baad354bcd70917909) --- ...date-URLs-in-squashfs-tools-Makefile.patch | 65 ++++++++++++++++++ ...pport-creating-sockets-in-unsquashfs.patch | 67 +++++++++++++++++++ ...ols-fix-build-failure-against-gcc-10.patch | 46 +++++++++++++ ...ize-header-to-avoid-valgrind-warning.patch | 30 +++++++++ squashfs-tools.spec | 9 ++- 5 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 0001-Fix-typos-update-URLs-in-squashfs-tools-Makefile.patch create mode 100644 0002-Support-creating-sockets-in-unsquashfs.patch create mode 100644 0003-squashfs-tools-fix-build-failure-against-gcc-10.patch create mode 100644 0004-xattr-Initialize-header-to-avoid-valgrind-warning.patch diff --git a/0001-Fix-typos-update-URLs-in-squashfs-tools-Makefile.patch b/0001-Fix-typos-update-URLs-in-squashfs-tools-Makefile.patch new file mode 100644 index 0000000..cc549b5 --- /dev/null +++ b/0001-Fix-typos-update-URLs-in-squashfs-tools-Makefile.patch @@ -0,0 +1,65 @@ +From 515b2579acd24241eefd7237debcecab11c7f2cd Mon Sep 17 00:00:00 2001 +From: Blake Riley +Date: Thu, 29 Aug 2019 14:41:50 +1000 +Subject: [PATCH 1/4] Fix typos, update URLs in squashfs-tools Makefile + +This updates URLs for a few compression libraries, which have moved since the Makefile instructions were written. +Also, instructions now refer to the appropriate compressor arg, not always "the XZ_SUPPORT line below". +--- + squashfs-tools/Makefile | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/squashfs-tools/Makefile b/squashfs-tools/Makefile +index 46c0772..aee4b96 100644 +--- a/squashfs-tools/Makefile ++++ b/squashfs-tools/Makefile +@@ -42,7 +42,7 @@ GZIP_SUPPORT = 1 + # your distribution package manager. + # + # To build install the library and uncomment +-# the XZ_SUPPORT line below. ++# the LZO_SUPPORT line below. + # + #LZO_SUPPORT = 1 + +@@ -50,8 +50,8 @@ GZIP_SUPPORT = 1 + ########### Building LZ4 support ############# + # + # Yann Collet's LZ4 tools are supported +-# LZ4 homepage: http://fastcompression.blogspot.com/p/lz4.html +-# LZ4 source repository: http://code.google.com/p/lz4 ++# LZ4 homepage: https://lz4.github.io/lz4/ ++# LZ4 source repository: https://github.com/lz4/lz4/ + # + # Development packages (libraries and header files) should be + # supported by most modern distributions. Please refer to +@@ -66,7 +66,7 @@ GZIP_SUPPORT = 1 + ########### Building ZSTD support ############ + # + # The ZSTD library is supported +-# ZSTD homepage: http://zstd.net ++# ZSTD homepage: https://facebook.github.io/zstd/ + # ZSTD source repository: https://github.com/facebook/zstd + # + # Development packages (libraries and header files) should be +@@ -74,7 +74,7 @@ GZIP_SUPPORT = 1 + # your distribution package manager. + # + # To build install the library and uncomment +-# the XZ_SUPPORT line below. ++# the ZSTD_SUPPORT line below. + # + #ZSTD_SUPPORT = 1 + +@@ -273,7 +273,7 @@ endif + # COMP_DEFAULT must be a selected compressor + # + ifeq (, $(findstring $(COMP_DEFAULT), $(COMPRESSORS))) +-$(error "COMP_DEFAULT is set to ${COMP_DEFAULT}, which isn't selected to be \ ++$(error "COMP_DEFAULT is set to ${COMP_DEFAULT}, which isn't selected to be \ + built!") + endif + +-- +1.8.3.1 + diff --git a/0002-Support-creating-sockets-in-unsquashfs.patch b/0002-Support-creating-sockets-in-unsquashfs.patch new file mode 100644 index 0000000..32ba4ef --- /dev/null +++ b/0002-Support-creating-sockets-in-unsquashfs.patch @@ -0,0 +1,67 @@ +From 585656b9aeb942c48b810149f976d59c54b9199d Mon Sep 17 00:00:00 2001 +From: Kevin Vigor +Date: Mon, 9 Sep 2019 08:55:40 -0700 +Subject: [PATCH 2/4] Support creating sockets in unsquashfs. + +--- + squashfs-tools/unsquashfs.c | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +diff --git a/squashfs-tools/unsquashfs.c b/squashfs-tools/unsquashfs.c +index 727f1d5..aec66c7 100644 +--- a/squashfs-tools/unsquashfs.c ++++ b/squashfs-tools/unsquashfs.c +@@ -55,7 +55,7 @@ squashfs_operations *(*read_filesystem_tables)(); + struct compressor *comp; + + int bytes = 0, swap, file_count = 0, dir_count = 0, sym_count = 0, +- dev_count = 0, fifo_count = 0; ++ dev_count = 0, fifo_count = 0, socket_count = 0; + struct hash_table_entry *inode_table_hash[65536], *directory_table_hash[65536]; + int fd; + unsigned int cached_frag = SQUASHFS_INVALID_FRAG; +@@ -1192,7 +1192,14 @@ int create_inode(char *pathname, struct inode *i) + case SQUASHFS_SOCKET_TYPE: + case SQUASHFS_LSOCKET_TYPE: + TRACE("create_inode: socket\n"); +- ERROR("create_inode: socket %s ignored\n", pathname); ++ ++ if (mknod(pathname, S_IFSOCK | i->mode, 0) == -1) { ++ ERROR("create_inode: failed to create socket %s, " ++ "because %s\n", ++ pathname, strerror(errno)); ++ goto failed; ++ } ++ socket_count++; + break; + default: + EXIT_UNSQUASH_STRICT("Unknown inode type %d in create_inode_table!\n", +@@ -2217,7 +2224,7 @@ void *progress_thread(void *arg) + if(progress_enabled) { + pthread_mutex_lock(&screen_mutex); + progress_bar(sym_count + dev_count + +- fifo_count + cur_blocks, total_inodes - ++ fifo_count + socket_count + cur_blocks, total_inodes - + total_files + total_blocks, columns); + pthread_mutex_unlock(&screen_mutex); + } +@@ -2410,7 +2417,7 @@ void disable_progress_bar() + { + pthread_mutex_lock(&screen_mutex); + if(progress_enabled) { +- progress_bar(sym_count + dev_count + fifo_count + cur_blocks, ++ progress_bar(sym_count + dev_count + fifo_count + socket_count + cur_blocks, + total_inodes - total_files + total_blocks, columns); + printf("\n"); + } +@@ -2983,6 +2990,7 @@ options: + printf("created %d symlinks\n", sym_count); + printf("created %d devices\n", dev_count); + printf("created %d fifos\n", fifo_count); ++ printf("created %d sockets\n", socket_count); + } + + return exit_code; +-- +1.8.3.1 + diff --git a/0003-squashfs-tools-fix-build-failure-against-gcc-10.patch b/0003-squashfs-tools-fix-build-failure-against-gcc-10.patch new file mode 100644 index 0000000..9e6a58d --- /dev/null +++ b/0003-squashfs-tools-fix-build-failure-against-gcc-10.patch @@ -0,0 +1,46 @@ +From ce42828b8f2001eb691bf378ff5a351484f1f4c2 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sun, 26 Jan 2020 18:35:13 +0000 +Subject: [PATCH 3/4] squashfs-tools: fix build failure against gcc-10 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On gcc-10 (and gcc-9 -fno-common) build fails as: + +``` +cc ... -o mksquashfs +ld: read_fs.o:(.bss+0x0): + multiple definition of `fwriter_buffer'; mksquashfs.o:(.bss+0x400c90): first defined here +ld: read_fs.o:(.bss+0x8): + multiple definition of `bwriter_buffer'; mksquashfs.o:(.bss+0x400c98): first defined here +``` + +gcc-10 will change the default from -fcommon to fno-common: +https://gcc.gnu.org/PR85678. + +The error also happens if CFLAGS=-fno-common passed explicitly. + +Reported-by: Toralf Förster +Bug: https://bugs.gentoo.org/706456 +Signed-off-by: Sergei Trofimovich +--- + squashfs-tools/mksquashfs.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/squashfs-tools/mksquashfs.h b/squashfs-tools/mksquashfs.h +index 1beefef..b650306 100644 +--- a/squashfs-tools/mksquashfs.h ++++ b/squashfs-tools/mksquashfs.h +@@ -143,7 +143,7 @@ struct append_file { + #endif + + extern struct cache *reader_buffer, *fragment_buffer, *reserve_cache; +-struct cache *bwriter_buffer, *fwriter_buffer; ++extern struct cache *bwriter_buffer, *fwriter_buffer; + extern struct queue *to_reader, *to_deflate, *to_writer, *from_writer, + *to_frag, *locked_fragment, *to_process_frag; + extern struct append_file **file_mapping; +-- +1.8.3.1 + diff --git a/0004-xattr-Initialize-header-to-avoid-valgrind-warning.patch b/0004-xattr-Initialize-header-to-avoid-valgrind-warning.patch new file mode 100644 index 0000000..e37307e --- /dev/null +++ b/0004-xattr-Initialize-header-to-avoid-valgrind-warning.patch @@ -0,0 +1,30 @@ +From 250f2f52fa3074c66b426a20200ad6934bc071de Mon Sep 17 00:00:00 2001 +From: Henrik Grindal Bakken +Date: Wed, 6 Dec 2017 13:18:51 +0100 +Subject: [PATCH 4/4] xattr: Initialize header to avoid valgrind warning + +The 'unused' field was written uninitialized to disk. This introduces +a randomness into the file system, and it also ends up as a valgrind +warning. + +Signed-off-by: Phillip Lougher +--- + squashfs-tools/xattr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/squashfs-tools/xattr.c b/squashfs-tools/xattr.c +index 64dfd82..b802965 100644 +--- a/squashfs-tools/xattr.c ++++ b/squashfs-tools/xattr.c +@@ -425,7 +425,7 @@ long long write_xattrs() + int i, avail_bytes; + char *datap = data_cache; + long long start_bytes = bytes; +- struct squashfs_xattr_table header; ++ struct squashfs_xattr_table header = {}; + + if(xattr_ids == 0) + return SQUASHFS_INVALID_BLK; +-- +1.8.3.1 + diff --git a/squashfs-tools.spec b/squashfs-tools.spec index 878a0d2..07a3d98 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -1,12 +1,16 @@ Name: squashfs-tools Version: 4.4 -Release: 1 +Release: 2 Summary: Utility for the squashfs filesystems License: GPLv2+ URL: http://squashfs.sourceforge.net/ Source0: http://downloads.sourceforge.net/squashfs/squashfs%{version}.tar.gz +Patch1: 0001-Fix-typos-update-URLs-in-squashfs-tools-Makefile.patch +Patch2: 0002-Support-creating-sockets-in-unsquashfs.patch +Patch3: 0003-squashfs-tools-fix-build-failure-against-gcc-10.patch +Patch4: 0004-xattr-Initialize-header-to-avoid-valgrind-warning.patch BuildRequires: zlib-devel xz-devel libzstd-devel git BuildRequires: lzo-devel libattr-devel lz4-devel @@ -37,6 +41,9 @@ install -D -m 755 squashfs-tools/unsquashfs %{buildroot}%{_sbindir}/unsquashfs %changelog +* Mon Jul 13 2020 Zhiqiang Liu - 4.4-2 +- backport upstream bugfix patches + * Tue Oct 15 2019 zhanghaibo - 4.4-1 - Rebase to version 4.4 -- Gitee From b945836a8cde7c0b1e2c634606456b407f41eb21 Mon Sep 17 00:00:00 2001 From: zhouwenpei Date: Tue, 29 Jun 2021 17:06:23 +0800 Subject: [PATCH 2/3] add buildrequire gcc (cherry picked from commit 8a87c9e1af4304c33dfa4c89db4f1f334c45f006) --- squashfs-tools.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/squashfs-tools.spec b/squashfs-tools.spec index 07a3d98..147299b 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -1,6 +1,6 @@ Name: squashfs-tools Version: 4.4 -Release: 2 +Release: 3 Summary: Utility for the squashfs filesystems License: GPLv2+ URL: http://squashfs.sourceforge.net/ @@ -13,7 +13,7 @@ Patch3: 0003-squashfs-tools-fix-build-failure-against-gcc-10.patch Patch4: 0004-xattr-Initialize-header-to-avoid-valgrind-warning.patch BuildRequires: zlib-devel xz-devel libzstd-devel git -BuildRequires: lzo-devel libattr-devel lz4-devel +BuildRequires: lzo-devel libattr-devel lz4-devel gcc %description Squashfs is a highly compressed read-only filesystem for Linux. @@ -41,6 +41,9 @@ install -D -m 755 squashfs-tools/unsquashfs %{buildroot}%{_sbindir}/unsquashfs %changelog +* Tue Jun 29 2021 zhouwenpei - 4.4-3 +- add buildrequire gcc. + * Mon Jul 13 2020 Zhiqiang Liu - 4.4-2 - backport upstream bugfix patches -- Gitee From 3d375034a31d959e07ede8553e551aff853dc847 Mon Sep 17 00:00:00 2001 From: chenyanpanHW Date: Fri, 30 Jul 2021 23:35:39 +0800 Subject: [PATCH 3/3] delete -S git from %autosetup, and delete BuildRequires git (cherry picked from commit 8398379b1a43bf4f5a38e833837f66fb9f5e8a1e) --- squashfs-tools.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/squashfs-tools.spec b/squashfs-tools.spec index 147299b..2b6ba19 100644 --- a/squashfs-tools.spec +++ b/squashfs-tools.spec @@ -1,6 +1,6 @@ Name: squashfs-tools Version: 4.4 -Release: 3 +Release: 4 Summary: Utility for the squashfs filesystems License: GPLv2+ URL: http://squashfs.sourceforge.net/ @@ -12,7 +12,7 @@ Patch2: 0002-Support-creating-sockets-in-unsquashfs.patch Patch3: 0003-squashfs-tools-fix-build-failure-against-gcc-10.patch Patch4: 0004-xattr-Initialize-header-to-avoid-valgrind-warning.patch -BuildRequires: zlib-devel xz-devel libzstd-devel git +BuildRequires: zlib-devel xz-devel libzstd-devel BuildRequires: lzo-devel libattr-devel lz4-devel gcc %description @@ -21,7 +21,7 @@ It uses either gzip/xz/lzo/lz4/zstd compression to compress both files, inodes and directories. %prep -%autosetup -n squashfs%{version} -p1 -S git +%autosetup -n squashfs%{version} -p1 %build CFLAGS="%{optflags}" XZ_SUPPORT=1 LZO_SUPPORT=1 LZMA_XZ_SUPPORT=1 LZ4_SUPPORT=1 ZSTD_SUPPORT=1 \ @@ -41,6 +41,9 @@ install -D -m 755 squashfs-tools/unsquashfs %{buildroot}%{_sbindir}/unsquashfs %changelog +* Fri Jul 30 2021 chenyanpanHW - 4.4-4 +- DESC: delete -S git from %autosetup, and delete BuildRequires git + * Tue Jun 29 2021 zhouwenpei - 4.4-3 - add buildrequire gcc. -- Gitee