|
@@ -0,0 +1,48 @@
|
|
|
|
|
+From 02e51727923da21bd654ddf0ec8c006f751d86c9 Mon Sep 17 00:00:00 2001
|
|
|
|
|
+From: Phillip Lougher <[email protected]>
|
|
|
|
|
+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 <[email protected]>
|
|
|
|
|
+---
|
|
|
|
|
+ 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;
|