Package: squashfs-tools
Version: 1:3.2r2-7
Severity: wishlist
Tags: upstream patch
X-Debbugs-Cc: [EMAIL PROTECTED]
Forwarded: [EMAIL PROTECTED]

For debian-live I wish to reduce the normal/expected output as much as
possible.  At present output remaining after a grep |sed filter is
15+% from mksquashfs, and this is the only remaining output (after my
filter) which IMO should normally be suppressed.

http://lists.alioth.debian.org/pipermail/debian-live-devel/2007-September/002249.html
(I also made the following filter for squash):
sed -re '/^Filesystem size/,/^Number of directories/d' \
-e '/^Number of [ug]ids/{:l; N; s/\n[[:space:]]//; t l; D}'

I note:
 . "silent" already exists; it's initialized to TRUE = 1.  Ulrich
   Drepper would say that initialization of globals and other statics
   should be to 0 whenever possible to minimize initialization
   overhead.
 . I've not tried to use the existing variable but rather submit a
   minimal patch.  I think the ideally situation is "int verbose=0"
   with -v verbose switch.
 . -quiet support isn't complete.  In particular read_fs outputs
   things during append but doesn't already have access to "silent"
   and I've not added "extern" entries to the header file or the other
   C files.  unsquashfs should probably also support -quiet.
 . I don't think this should be added as a debian-specific patch
   unless a compatible patch will be added upstream, otherwise debian
   people will end up writing things using -quiet which fail on other
   systems.
 . valgrind shows some potentially-interesting output, although it's
   my understanding that the zlib things are false positives and
   deliberate behavior by zlib for performance.
--- /tmp/mksquashfs.c   2007-09-22 22:49:41.000000000 -0400
+++ ./mksquashfs.c      2007-09-23 00:05:06.000000000 -0400
@@ -96,7 +96,7 @@
 /* filesystem flags for building */
 int duplicate_checking = 1, noF = 0, no_fragments = 0, always_use_fragments = 
0;
 int noI = 0, noD = 0, check_data = 0;
-int swap, silent = TRUE;
+int swap, silent = TRUE, quiet=0;
 long long global_uid = -1, global_gid = -1;
 int exportable = TRUE;
 int progress = TRUE;
@@ -2947,6 +2947,8 @@
                                exit(1);
                        }       
                        root_name = argv[i];
+               } else if(strcmp(argv[i], "-quiet") == 0) {
+                       quiet|=1;
                } else if(strcmp(argv[i], "-version") == 0) {
                        VERSION();
                } else {
@@ -2956,6 +2958,7 @@
                        ERROR("\nOptions are\n");
                        ERROR("-version\t\tprint version, licence and copyright 
message\n");
                        ERROR("-info\t\t\tprint files written to filesystem\n");
+                       ERROR("-quiet\t\t\tsuppress summary output\n");
                        ERROR("-no-exports\t\tdon't make the filesystem 
exportable via NFS\n");
                        ERROR("-no-progress\t\tdon't display the progress 
bar\n");
                        ERROR("-b <block_size>\t\tset data block to 
<block_size>.  Default %d bytes\n", SQUASHFS_FILE_SIZE);
@@ -3284,6 +3287,9 @@
                write_bytes(fd, bytes, 4096 - i, temp);
        }
 
+       close(fd);
+       if (quiet) return 0;
+
        total_bytes += total_inode_bytes + total_directory_bytes + uid_count
                * sizeof(unsigned short) + guid_count * sizeof(unsigned short) +
                sizeof(squashfs_super_block);
@@ -3329,6 +3335,5 @@
                struct group *group = getgrgid(guids[i]);
                printf("\t%s (%d)\n", group == NULL ? "unknown" : 
group->gr_name, guids[i]);
        }
-       close(fd);
        return 0;
 }

Reply via email to