Blame SOURCES/0002-dump-Visually-separate-columns-0-7-and-8-15.patch

5893ea
From ec947323528725fcf12b5b9ba32b02d36dbd9621 Mon Sep 17 00:00:00 2001
5893ea
From: "Richard W.M. Jones" <rjones@redhat.com>
5893ea
Date: Thu, 30 Jun 2022 21:09:39 +0100
5893ea
Subject: [PATCH] dump: Visually separate columns 0-7 and 8-15
5893ea
MIME-Version: 1.0
5893ea
Content-Type: text/plain; charset=UTF-8
5893ea
Content-Transfer-Encoding: 8bit
5893ea
5893ea
Before:
5893ea
5893ea
0000090000: 68 65 72 65 20 77 65 20 61 72 65 00 68 65 72 65 │...
5893ea
0000090010: 20 77 65 20 61 72 65 00 68 65 72 65 20 77 65 20 │...
5893ea
0000090020: 61 72 65 00 68 65 72 65 20 77 65 20 61 72 65 00 │...
5893ea
5893ea
After:
5893ea
5893ea
0000090000: 68 65 72 65 20 77 65 20  61 72 65 00 68 65 72 65 │...
5893ea
0000090010: 20 77 65 20 61 72 65 00  68 65 72 65 20 77 65 20 │...
5893ea
0000090020: 61 72 65 00 68 65 72 65  20 77 65 20 61 72 65 00 │...
5893ea
5893ea
Updates: commit c4107b9a40d6451630dcccf1bf6596c8e56420be
5893ea
(cherry picked from commit 315a637d3eae003c1d84eb1b88a7b47b534f1e80)
5893ea
---
5893ea
 dump/dump-data.sh        | 22 +++++++++++-----------
5893ea
 dump/dump-empty-qcow2.sh |  4 ++--
5893ea
 dump/dump-pattern.sh     | 38 +++++++++++++++++++-------------------
5893ea
 dump/dump.c              |  5 ++++-
5893ea
 4 files changed, 36 insertions(+), 33 deletions(-)
5893ea
5893ea
diff --git a/dump/dump-data.sh b/dump/dump-data.sh
5893ea
index 23d09da..955cd3b 100755
5893ea
--- a/dump/dump-data.sh
5893ea
+++ b/dump/dump-data.sh
5893ea
@@ -37,21 +37,21 @@ nbdkit -U - data data='
5893ea
 
5893ea
 cat $output
5893ea
 
5893ea
-if [ "$(cat $output)" != '0000000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
5893ea
+if [ "$(cat $output)" != '0000000000: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
5893ea
 *
5893ea
-0000008000: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
5893ea
-0000008010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
5893ea
+0000008000: 01 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
5893ea
+0000008010: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
5893ea
 *
5893ea
-000000fff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 |...............h|
5893ea
-0000010000: 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21 00 00 00 00 |ello, world!....|
5893ea
-0000010010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
5893ea
+000000fff0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 68 |...............h|
5893ea
+0000010000: 65 6c 6c 6f 2c 20 77 6f  72 6c 64 21 00 00 00 00 |ello, world!....|
5893ea
+0000010010: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
5893ea
 *
5893ea
-00010ffff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 73 70 |..............sp|
5893ea
-0001100000: 61 6e 6e 69 6e 67 20 62 75 66 66 65 72 20 62 6f |anning buffer bo|
5893ea
-0001100010: 75 6e 64 61 72 79 00 00 00 00 00 00 00 00 00 00 |undary..........|
5893ea
-0001100020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
5893ea
+00010ffff0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 73 70 |..............sp|
5893ea
+0001100000: 61 6e 6e 69 6e 67 20 62  75 66 66 65 72 20 62 6f |anning buffer bo|
5893ea
+0001100010: 75 6e 64 61 72 79 00 00  00 00 00 00 00 00 00 00 |undary..........|
5893ea
+0001100020: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
5893ea
 *
5893ea
-0001312d00: 00                                              |.               |' ]; then
5893ea
+0001312d00: 00                                               |.               |' ]; then
5893ea
     echo "$0: unexpected output from nbddump command"
5893ea
     exit 1
5893ea
 fi
5893ea
diff --git a/dump/dump-empty-qcow2.sh b/dump/dump-empty-qcow2.sh
5893ea
index c9e583b..472b6eb 100755
5893ea
--- a/dump/dump-empty-qcow2.sh
5893ea
+++ b/dump/dump-empty-qcow2.sh
5893ea
@@ -38,9 +38,9 @@ qemu-img create -f qcow2 $file $size
5893ea
 nbddump -- [ $QEMU_NBD -r -f qcow2 $file ] > $output
5893ea
 cat $output
5893ea
 
5893ea
-if [ "$(cat $output)" != '0000000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
5893ea
+if [ "$(cat $output)" != '0000000000: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|
5893ea
 *
5893ea
-003ffffff0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|' ]; then
5893ea
+003ffffff0: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00 |................|' ]; then
5893ea
     echo "$0: unexpected output from nbddump command"
5893ea
     exit 1
5893ea
 fi
5893ea
diff --git a/dump/dump-pattern.sh b/dump/dump-pattern.sh
5893ea
index e4016a8..d512b77 100755
5893ea
--- a/dump/dump-pattern.sh
5893ea
+++ b/dump/dump-pattern.sh
5893ea
@@ -32,25 +32,25 @@ nbdkit -U - pattern size=299 --run 'nbddump "$uri"' > $output
5893ea
 
5893ea
 cat $output
5893ea
 
5893ea
-if [ "$(cat $output)" != '0000000000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 08 |................|
5893ea
-0000000010: 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 18 |................|
5893ea
-0000000020: 00 00 00 00 00 00 00 20 00 00 00 00 00 00 00 28 |....... .......(|
5893ea
-0000000030: 00 00 00 00 00 00 00 30 00 00 00 00 00 00 00 38 |.......0.......8|
5893ea
-0000000040: 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 48 |.......@.......H|
5893ea
-0000000050: 00 00 00 00 00 00 00 50 00 00 00 00 00 00 00 58 |.......P.......X|
5893ea
-0000000060: 00 00 00 00 00 00 00 60 00 00 00 00 00 00 00 68 |.......`.......h|
5893ea
-0000000070: 00 00 00 00 00 00 00 70 00 00 00 00 00 00 00 78 |.......p.......x|
5893ea
-0000000080: 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00 88 |................|
5893ea
-0000000090: 00 00 00 00 00 00 00 90 00 00 00 00 00 00 00 98 |................|
5893ea
-00000000a0: 00 00 00 00 00 00 00 a0 00 00 00 00 00 00 00 a8 |................|
5893ea
-00000000b0: 00 00 00 00 00 00 00 b0 00 00 00 00 00 00 00 b8 |................|
5893ea
-00000000c0: 00 00 00 00 00 00 00 c0 00 00 00 00 00 00 00 c8 |................|
5893ea
-00000000d0: 00 00 00 00 00 00 00 d0 00 00 00 00 00 00 00 d8 |................|
5893ea
-00000000e0: 00 00 00 00 00 00 00 e0 00 00 00 00 00 00 00 e8 |................|
5893ea
-00000000f0: 00 00 00 00 00 00 00 f0 00 00 00 00 00 00 00 f8 |................|
5893ea
-0000000100: 00 00 00 00 00 00 01 00 00 00 00 00 00 00 01 08 |................|
5893ea
-0000000110: 00 00 00 00 00 00 01 10 00 00 00 00 00 00 01 18 |................|
5893ea
-0000000120: 00 00 00 00 00 00 01 20 00 00 00                |....... ...     |' ]; then
5893ea
+if [ "$(cat $output)" != '0000000000: 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 08 |................|
5893ea
+0000000010: 00 00 00 00 00 00 00 10  00 00 00 00 00 00 00 18 |................|
5893ea
+0000000020: 00 00 00 00 00 00 00 20  00 00 00 00 00 00 00 28 |....... .......(|
5893ea
+0000000030: 00 00 00 00 00 00 00 30  00 00 00 00 00 00 00 38 |.......0.......8|
5893ea
+0000000040: 00 00 00 00 00 00 00 40  00 00 00 00 00 00 00 48 |.......@.......H|
5893ea
+0000000050: 00 00 00 00 00 00 00 50  00 00 00 00 00 00 00 58 |.......P.......X|
5893ea
+0000000060: 00 00 00 00 00 00 00 60  00 00 00 00 00 00 00 68 |.......`.......h|
5893ea
+0000000070: 00 00 00 00 00 00 00 70  00 00 00 00 00 00 00 78 |.......p.......x|
5893ea
+0000000080: 00 00 00 00 00 00 00 80  00 00 00 00 00 00 00 88 |................|
5893ea
+0000000090: 00 00 00 00 00 00 00 90  00 00 00 00 00 00 00 98 |................|
5893ea
+00000000a0: 00 00 00 00 00 00 00 a0  00 00 00 00 00 00 00 a8 |................|
5893ea
+00000000b0: 00 00 00 00 00 00 00 b0  00 00 00 00 00 00 00 b8 |................|
5893ea
+00000000c0: 00 00 00 00 00 00 00 c0  00 00 00 00 00 00 00 c8 |................|
5893ea
+00000000d0: 00 00 00 00 00 00 00 d0  00 00 00 00 00 00 00 d8 |................|
5893ea
+00000000e0: 00 00 00 00 00 00 00 e0  00 00 00 00 00 00 00 e8 |................|
5893ea
+00000000f0: 00 00 00 00 00 00 00 f0  00 00 00 00 00 00 00 f8 |................|
5893ea
+0000000100: 00 00 00 00 00 00 01 00  00 00 00 00 00 00 01 08 |................|
5893ea
+0000000110: 00 00 00 00 00 00 01 10  00 00 00 00 00 00 01 18 |................|
5893ea
+0000000120: 00 00 00 00 00 00 01 20  00 00 00                |....... ...     |' ]; then
5893ea
     echo "$0: unexpected output from nbddump command"
5893ea
     exit 1
5893ea
 fi
5893ea
diff --git a/dump/dump.c b/dump/dump.c
5893ea
index 76af04c..7818f1f 100644
5893ea
--- a/dump/dump.c
5893ea
+++ b/dump/dump.c
5893ea
@@ -429,10 +429,13 @@ do_dump (void)
5893ea
         else
5893ea
           ansi_grey ();
5893ea
         printf ("%02x ", buffer[j]);
5893ea
+        if ((j - i) == 7) printf (" ");
5893ea
       }
5893ea
       ansi_grey ();
5893ea
-      for (; j < i+16; ++j)
5893ea
+      for (; j < i+16; ++j) {
5893ea
         printf ("   ");
5893ea
+        if ((j - i) == 7) printf (" ");
5893ea
+      }
5893ea
 
5893ea
       /* Print the ASCII codes. */
5893ea
       printf ("%s", pipe);
5893ea
-- 
5893ea
2.31.1
5893ea