squashfs-tools: backport upstream bugfix patches

squashfs-tools: backport upstream bugfix patches

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
This commit is contained in:
Zhiqiang Liu 2020-07-13 11:46:17 +08:00
parent f3afbfc054
commit 6f65f8ac04
5 changed files with 216 additions and 1 deletions

View File

@ -0,0 +1,65 @@
From 515b2579acd24241eefd7237debcecab11c7f2cd Mon Sep 17 00:00:00 2001
From: Blake Riley <blake.riley@gmail.com>
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

View File

@ -0,0 +1,67 @@
From 585656b9aeb942c48b810149f976d59c54b9199d Mon Sep 17 00:00:00 2001
From: Kevin Vigor <kvigor@gmail.com>
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

View File

@ -0,0 +1,46 @@
From ce42828b8f2001eb691bf378ff5a351484f1f4c2 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
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 <slyfox@gentoo.org>
---
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

View File

@ -0,0 +1,30 @@
From 250f2f52fa3074c66b426a20200ad6934bc071de Mon Sep 17 00:00:00 2001
From: Henrik Grindal Bakken <henribak@cisco.com>
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 <phillip@squashfs.org.uk>
---
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

View File

@ -1,12 +1,16 @@
Name: squashfs-tools Name: squashfs-tools
Version: 4.4 Version: 4.4
Release: 1 Release: 2
Summary: Utility for the squashfs filesystems Summary: Utility for the squashfs filesystems
License: GPLv2+ License: GPLv2+
URL: http://squashfs.sourceforge.net/ URL: http://squashfs.sourceforge.net/
Source0: http://downloads.sourceforge.net/squashfs/squashfs%{version}.tar.gz 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: zlib-devel xz-devel libzstd-devel git
BuildRequires: lzo-devel libattr-devel lz4-devel BuildRequires: lzo-devel libattr-devel lz4-devel
@ -37,6 +41,9 @@ install -D -m 755 squashfs-tools/unsquashfs %{buildroot}%{_sbindir}/unsquashfs
%changelog %changelog
* Mon Jul 13 2020 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 4.4-2
- backport upstream bugfix patches
* Tue Oct 15 2019 zhanghaibo <ted.zhang@huawei.com> - 4.4-1 * Tue Oct 15 2019 zhanghaibo <ted.zhang@huawei.com> - 4.4-1
- Rebase to version 4.4 - Rebase to version 4.4