could not compare disk images with partition table
Hi,
I am using diffscope to compare two disk images that are created using yocto wks files that means the image has partition table and they are not comparing using diffoscope tool.
Below is the debug output of diffoscope
$ diffoscope --debug image1.wic image2.wic
2023-02-27 14:09:09 D: diffoscope.main: Starting diffoscope 236
2023-02-27 14:09:09 D: diffoscope.presenters.formats: Will generate the following presenter formats: text
2023-02-27 14:09:09 D: diffoscope.environ: Normalising locale, timezone, etc. PATH is /srv/diffoscope/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/x86_64-linux-gnu
2023-02-27 14:09:09 D: diffoscope.main: Starting comparison
2023-02-27 14:09:09 D: diffoscope.comparators.decompile: radare2 not found, disabling decompiler
2023-02-27 14:09:11 D: diffoscope.comparators: Loaded 90 comparator classes
2023-02-27 14:09:12 D: diffoscope.comparators.utils.specialize: image1.wic not identified by any comparator. Magic says: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 12546899 sectors, extended partition table (last)
2023-02-27 14:09:12 D: diffoscope.comparators.utils.specialize: image2.wic not identified by any comparator. Magic says: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 12546899 sectors, extended partition table (last)
2023-02-27 14:09:12 D: diffoscope.comparators.utils.compare: Comparing image1.wic (FilesystemFile) and image2.wic (FilesystemFile)
2023-02-27 14:09:12 D: diffoscope.comparators.utils.specialize: image1.wic not identified by any comparator. Magic says: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 12546899 sectors, extended partition table (last)
2023-02-27 14:09:12 D: diffoscope.comparators.utils.specialize: image2.wic not identified by any comparator. Magic says: DOS/MBR boot sector; partition 1 : ID=0xee, start-CHS (0x0,0,2), end-CHS (0x3ff,255,63), startsector 1, 12546899 sectors, extended partition table (last)
2023-02-27 14:09:12 D: diffoscope.comparators.utils.file: has_same_content(image1.wic, image2.wic)
2023-02-27 14:09:12 D: diffoscope.comparators.utils.command: Executing xxd {} Killed
$ sudo fdisk -l image1.wic
Disk image1.wic: 953.67 MiB, 1000000000 bytes, 1953125 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 382094AB-756B-40C1-B99F-79355F018C3A
Device Start End Sectors Size Type
image1.wic1 2048 1951743 1949696 952M Linux filesystem
But same is working when single partition or whole disk image (with no partition table) is used
diffoscope output
2023-02-27 14:34:04 D: diffoscope.main: Starting diffoscope 236
2023-02-27 14:34:04 D: diffoscope.presenters.formats: Will generate the following presenter formats: text
2023-02-27 14:34:04 D: diffoscope.environ: Normalising locale, timezone, etc. PATH is /srv/diffoscope/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/x86_64-linux-gnu
2023-02-27 14:34:04 D: diffoscope.main: Starting comparison
2023-02-27 14:34:04 D: diffoscope.comparators.decompile: radare2 not found, disabling decompiler
2023-02-27 14:34:04 D: diffoscope.comparators: Loaded 90 comparator classes
2023-02-27 14:34:04 D: diffoscope.comparators.utils.specialize: Using fsimage.FsImageFile for image1.disk
2023-02-27 14:34:04 D: diffoscope.comparators.utils.specialize: Using fsimage.FsImageFile for image2.disk
2023-02-27 14:34:04 D: diffoscope.comparators.utils.compare: Comparing image1.disk (FsImageFile) and image2.disk (FsImageFile)
2023-02-27 14:34:04 D: diffoscope.comparators.utils.file: has_same_content(image1.disk, image2.disk)
2023-02-27 14:34:04 D: diffoscope.comparators.utils.file: Instantiating a fsimage.FsImageContainer for image1.disk
2023-02-27 14:34:04 D: diffoscope.comparators.fsimage: Launching guestfs; this may take some time
2023-02-27 14:34:18 D: diffoscope.comparators.fsimage: guestfs successfully launched
2023-02-27 14:34:19 D: diffoscope.comparators.utils.file: Instantiating a fsimage.FsImageContainer for image2.disk
2023-02-27 14:34:20 D: diffoscope.comparators.fsimage: Launching guestfs; this may take some time
2023-02-27 14:34:35 D: diffoscope.comparators.fsimage: guestfs successfully launched
2023-02-27 14:34:35 D: diffoscope.tempfiles: Created top-level temporary directory: /tmp/diffoscope_p1tf2km1_ (free space: 1.57 TiB)
2023-02-27 14:34:35 D: diffoscope.diff: Running diff -a -U7 /tmp/diffoscope_p1tf2km1_/tmp3b_0_94z/fifo1 /tmp/diffoscope_p1tf2km1_/tmp3b_0_94z/fifo2
2023-02-27 14:34:35 D: diffoscope.diff: diff -a -U7 /tmp/diffoscope_p1tf2km1_/tmp3b_0_94z/fifo1 /tmp/diffoscope_p1tf2km1_/tmp3b_0_94z/fifo2: returncode 1, parsed True
2023-02-27 14:34:35 D: diffoscope.comparators.utils.archive: Unpacking image1.disk.tar from image1.disk to /tmp/diffoscope_p1tf2km1_/tmpff9_32xi_FsImageContainer
2023-02-27 14:34:35 D: diffoscope.comparators.fsimage: filesystem image extracting to /tmp/diffoscope_p1tf2km1_/tmpff9_32xi_FsImageContainer/image1.disk.tar
2023-02-27 14:34:35 D: diffoscope.comparators.utils.archive: Unpacking image2.disk.tar from image2.disk to /tmp/diffoscope_p1tf2km1_/tmpwjgv6nix_FsImageContainer
2023-02-27 14:34:35 D: diffoscope.comparators.fsimage: filesystem image extracting to /tmp/diffoscope_p1tf2km1_/tmpwjgv6nix_FsImageContainer/image2.disk.tar
2023-02-27 14:34:35 D: diffoscope.comparators.utils.compare: Comparing image1.disk.tar (ArchiveMember) and image2.disk.tar (ArchiveMember)
2023-02-27 14:34:35 D: diffoscope.comparators.utils.specialize: Using tar.TarFile for image1.disk.tar
2023-02-27 14:34:35 D: diffoscope.comparators.utils.specialize: Using tar.TarFile for image2.disk.tar
2023-02-27 14:34:35 D: diffoscope.comparators.utils.file: has_same_content(/tmp/diffoscope_p1tf2km1_/tmpff9_32xi_FsImageContainer/image1.disk.tar, /tmp/diffoscope_p1tf2km1_/tmpwjgv6nix_FsImageContainer/image2.disk.tar)
2023-02-27 14:34:35 D: diffoscope.diff: Running diff -a -U7 /tmp/diffoscope_p1tf2km1_/tmpetjnke4m/fifo1 /tmp/diffoscope_p1tf2km1_/tmpetjnke4m/fifo2
2023-02-27 14:34:35 D: diffoscope.diff: diff -a -U7 /tmp/diffoscope_p1tf2km1_/tmpetjnke4m/fifo1 /tmp/diffoscope_p1tf2km1_/tmpetjnke4m/fifo2: returncode 1, parsed True
2023-02-27 14:34:35 D: diffoscope.comparators.utils.file: Instantiating a tar.TarContainer for image1.disk.tar
2023-02-27 14:34:35 D: diffoscope.comparators.utils.file: Instantiating a tar.TarContainer for image2.disk.tar
2023-02-27 14:34:35 D: diffoscope.comparators.utils.archive: Unpacking ./test_File from image1.disk.tar to /tmp/diffoscope_p1tf2km1_/tmpqp2a3gt2_TarContainer
2023-02-27 14:34:35 D: diffoscope.comparators.utils.libarchive: Extracting /tmp/diffoscope_p1tf2km1_/tmpff9_32xi_FsImageContainer/image1.disk.tar to /tmp/diffoscope_p1tf2km1_/tmp7isfy__l_TarContainer
2023-02-27 14:34:35 D: diffoscope.comparators.utils.libarchive: Extracting ./test_File to /tmp/diffoscope_p1tf2km1_/tmp7isfy__l_TarContainer/0/1
2023-02-27 14:34:35 D: diffoscope.comparators.utils.libarchive: Extracted 1 entries from /tmp/diffoscope_p1tf2km1_/tmpff9_32xi_FsImageContainer/image1.disk.tar to /tmp/diffoscope_p1tf2km1_/tmp7isfy__l_TarContainer
2023-02-27 14:34:35 D: diffoscope.comparators.utils.archive: Unpacking ./test_File from image2.disk.tar to /tmp/diffoscope_p1tf2km1_/tmpojhb9w9x_TarContainer
2023-02-27 14:34:35 D: diffoscope.comparators.utils.libarchive: Extracting /tmp/diffoscope_p1tf2km1_/tmpwjgv6nix_FsImageContainer/image2.disk.tar to /tmp/diffoscope_p1tf2km1_/tmp6_5yw01j_TarContainer
2023-02-27 14:34:35 D: diffoscope.comparators.utils.libarchive: Extracting ./test_File to /tmp/diffoscope_p1tf2km1_/tmp6_5yw01j_TarContainer/0/1
2023-02-27 14:34:35 D: diffoscope.comparators.utils.libarchive: Extracted 1 entries from /tmp/diffoscope_p1tf2km1_/tmpwjgv6nix_FsImageContainer/image2.disk.tar to /tmp/diffoscope_p1tf2km1_/tmp6_5yw01j_TarContainer
2023-02-27 14:34:35 D: diffoscope.comparators.utils.compare: Comparing ./test_File (LibarchiveMember) and ./test_File (LibarchiveMember)
2023-02-27 14:34:35 D: diffoscope.comparators.utils.specialize: Using text.TextFile for ./test_File
2023-02-27 14:34:35 D: diffoscope.comparators.utils.specialize: Using text.TextFile for ./test_File
2023-02-27 14:34:35 D: diffoscope.comparators.utils.file: has_same_content(/tmp/diffoscope_p1tf2km1_/tmp7isfy__l_TarContainer/0/1, /tmp/diffoscope_p1tf2km1_/tmp6_5yw01j_TarContainer/0/1)
2023-02-27 14:34:35 D: diffoscope.diff: Running diff -a -U7 /tmp/diffoscope_p1tf2km1_/tmpv_ljh1jt/fifo1 /tmp/diffoscope_p1tf2km1_/tmpv_ljh1jt/fifo2
2023-02-27 14:34:35 D: diffoscope.diff: diff -a -U7 /tmp/diffoscope_p1tf2km1_/tmpv_ljh1jt/fifo1 /tmp/diffoscope_p1tf2km1_/tmpv_ljh1jt/fifo2: returncode 1, parsed True
2023-02-27 14:34:35 D: diffoscope.comparators.directory: Excluding directory metadata for paths (./test_File, ./test_File)
2023-02-27 14:34:35 D: diffoscope.comparators.directory: Excluding directory metadata for paths (image1.disk.tar, image2.disk.tar)
2023-02-27 14:34:35 D: diffoscope.presenters.formats: Generating 'text' output at '-'
--- image1.disk
+++ image2.disk
├── filetype from file(1)
│ @@ -1 +1 @@
│ -Linux rev 1.0 ext4 filesystem data, UUID=b8e07622-e64c-4ecd-bc70-e8f6e8a9a086 (extents) (64bit) (large files) (huge files) │ +Linux rev 1.0 ext4 filesystem data, UUID=8116aaa5-de66-4bef-8a45-76e6cce95191 (extents) (64bit) (large files) (huge files)
│ --- image1.disk.tar
├── +++ image2.disk.tar
│ ├── file list
│ │ @@ -1,3 +1,3 @@
│ │ -drwxr-xr-x 0 0 0 0 2023-02-26 07:39:37.000000 ./
│ │ --rw-r--r-- 0 0 0 6 2023-02-26 07:39:37.000000 ./test_File
│ │ -drwx------ 0 0 0 0 2023-02-26 07:37:40.000000 ./lost+found/
│ │ +drwxr-xr-x 0 0 0 0 2023-02-26 07:44:01.000000 ./
│ │ +-rw-r--r-- 0 0 0 12 2023-02-26 07:44:01.000000 ./test_File
│ │ +drwx------ 0 0 0 0 2023-02-26 07:41:37.000000 ./lost+found/
│ ├── ./test_File
│ │ @@ -1 +1 @@
│ │ -test1
│ │ +test file 2
$ sudo fdisk -l image1.disk
Disk image1.disk: 10 MiB, 10485760 bytes, 20480 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
does diffoscope support disk image comparision with partition table?