Package: squashfs-tools Version: 3.0-7 Severity: important Tags: patch
The progress information patch suggested in #364089 (http://err.no/patches/mksquashfs_progress.diff) was originally generated for squashfs-2.2 which had a file size limitation of 4GB. However, as of squashfs-3.0, this limitation has been removed. Unfortunately this patch does not behave correctly with squashfs-3.0. When generating a compressed volume > 4GB, mksquashfs starts looping in the progress bar code, dumping dots for 0-4080 MB over and over without making forward progress. This is due to the "progress" variable being of type unsigned int whereas in squashfs-3.0 it really should be of type long long. I've included an updated version of 03-mksquashfs.dpatch. I've changed progress to type long long, and also removed an extraneous "int i" that seems to serve no purpose. Thanks!
#!/bin/sh /usr/share/dpatch/dpatch-run ## 01-mksquashfs.dpatch ## ## DP: Show progress information for mksquashfs @DPATCH@ diff -uNr squashfs-3.0.orig/squashfs-tools/mksquashfs.c squashfs-3.0/squashfs-tools/mksquashfs.c --- squashfs-3.0.orig/squashfs-tools/mksquashfs.c 2006-03-15 16:36:20.000000000 -0500 +++ squashfs-3.0/squashfs-tools/mksquashfs.c 2006-08-12 15:57:15.744712504 -0400 @@ -100,6 +100,7 @@ /* write position within data section */ long long bytes = 0, total_bytes = 0; +long long progress = 0; /* in memory directory table - possibly compressed */ char *directory_table = NULL; @@ -932,6 +933,19 @@ compressed_size = SQUASHFS_COMPRESSED_SIZE_BLOCK(fragment_table[fragments].size); write_bytes(fd, bytes, compressed_size, buffer); bytes += compressed_size; + + if (bytes - progress > 1024*1024) { + while (bytes - progress > 1024*1024) { + fprintf(stdout, "."); + if (progress / (1024*1024) % 10 == 0) + fprintf(stdout, " "); + if (progress / (1024*1024) % 60 == 0) + fprintf(stdout, "\n%4d MB ", progress /(1024*1024)); + progress += 1024*1024; + } + fflush(stdout); + } + total_uncompressed += fragment_size; total_compressed += compressed_size; TRACE("Writing fragment %d, uncompressed size %d, compressed size %d\n",fragments, fragment_size, compressed_size); @@ -985,7 +999,7 @@ } for(i = 0; i < meta_blocks; i++) { - int avail_bytes = i == meta_blocks - 1 ? frag_bytes % SQUASHFS_METADATA_SIZE : SQUASHFS_METADATA_SIZE; + int avail_bytes = i == meta_blocks - 1 ? frag_bytes - SQUASHFS_METADATA_SIZE * i : SQUASHFS_METADATA_SIZE; c_byte = mangle(cbuffer + block_offset, buffer + i * SQUASHFS_METADATA_SIZE , avail_bytes, SQUASHFS_METADATA_SIZE, noF, 0); if(!swap) memcpy(cbuffer, &c_byte, sizeof(unsigned short));