openwrt-mirror/tools/squashfs4/patches/0003-mksquashfs-fix-regression-introduced-by-SEEK_DATA-op.patch
Shiji Yang 64432358e0 tools/squashfs4: update to 4.7.3
Release Note:
  https://github.com/plougher/squashfs-tools/releases/tag/4.7.3

The three backported patches fixed the regression and build
issue on squashfs-tools v4.7.3.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/20683
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-11-09 22:45:12 +01:00

49 lines
1.7 KiB
Diff

From 02e51727923da21bd654ddf0ec8c006f751d86c9 Mon Sep 17 00:00:00 2001
From: Phillip Lougher <phillip@squashfs.org.uk>
Date: Fri, 7 Nov 2025 23:13:03 +0000
Subject: [PATCH] mksquashfs: fix regression introduced by SEEK_DATA
optimisation
The representation of a sparse block was changed from 0 to a negative
number. This was to optimise sparse buffer passing between threads, and
where a single buffer can now represent a multi-block sparse span.
Unfortunately some code was not correctly updated, and this was not
picked up in testing.
Fixes: https://github.com/plougher/squashfs-tools/issues/336
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
---
squashfs-tools/mksquashfs.c | 4 ++--
squashfs-tools/process_fragments.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -2889,11 +2889,11 @@ static struct file_info *write_file_proc
sizeof(unsigned int));
block_list[block ++] = read_buffer->c_byte;
if(!is_sparse(read_buffer)) {
- if(sparse_count(read_buffer) > 1)
- BAD_ERROR("Sparse block too large in write file process\n");
file_bytes += read_buffer->size;
put_write_buffer_hash(read_buffer);
} else {
+ if(sparse_count(read_buffer) > 1)
+ BAD_ERROR("Sparse block too large in write file process\n");
sparse += read_buffer->size;
gen_cache_block_put(read_buffer);
}
--- a/squashfs-tools/process_fragments.c
+++ b/squashfs-tools/process_fragments.c
@@ -285,7 +285,7 @@ void *frag_thrd(void *destination_file)
int res;
if(sparse_files && sparse) {
- file_buffer->c_byte = 0;
+ set_sparse(file_buffer, 1);
file_buffer->fragment = FALSE;
} else
file_buffer->c_byte = file_buffer->size;