Richard W.M. Jones
2023-Jul-20 14:15 UTC
[Libguestfs] [PATCH guestfs-tools] diff: Don't compare st_dev or st_ino fields
See comment for details. Link: https://listman.redhat.com/archives/libguestfs/2023-July/032061.html --- diff/diff.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/diff/diff.c b/diff/diff.c index fb66a2bbd3..b6344b4ec2 100644 --- a/diff/diff.c +++ b/diff/diff.c @@ -717,8 +717,20 @@ changed (guestfs_h *g1, struct file *file1, output_string ("changed:"); #define COMPARE_STAT(n) \ if (file1->stat->n != file2->stat->n) output_string (#n) - COMPARE_STAT (st_dev); - COMPARE_STAT (st_ino); + /* Comparing st_dev and st_ino is disabled for now, see the longer + * discussion here: + * https://listman.redhat.com/archives/libguestfs/2023-July/032061.html + * Even if we fixed the libguestfs API to do translation of this + * field correctly, it seems unlikely that there would ever be a + * meaningful difference in the st_dev or st_ino fields. We + * already know the fields refer to the same filename. Is it + * interesting that the file might have moved to a different disk? + * Everything else is comparing the content or direct metadata of + * the file, but st_dev and st_ino represent the metadata of the + * filesystem which is (arguably) different. + */ +// COMPARE_STAT (st_dev); +// COMPARE_STAT (st_ino); COMPARE_STAT (st_mode); COMPARE_STAT (st_nlink); COMPARE_STAT (st_uid); -- 2.41.0
Laszlo Ersek
2023-Jul-20 15:31 UTC
[Libguestfs] [PATCH guestfs-tools] diff: Don't compare st_dev or st_ino fields
On 7/20/23 16:15, Richard W.M. Jones wrote:> See comment for details. > > Link: https://listman.redhat.com/archives/libguestfs/2023-July/032061.html > --- > diff/diff.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/diff/diff.c b/diff/diff.c > index fb66a2bbd3..b6344b4ec2 100644 > --- a/diff/diff.c > +++ b/diff/diff.c > @@ -717,8 +717,20 @@ changed (guestfs_h *g1, struct file *file1, > output_string ("changed:"); > #define COMPARE_STAT(n) \ > if (file1->stat->n != file2->stat->n) output_string (#n) > - COMPARE_STAT (st_dev); > - COMPARE_STAT (st_ino); > + /* Comparing st_dev and st_ino is disabled for now, see the longer > + * discussion here: > + * https://listman.redhat.com/archives/libguestfs/2023-July/032061.html > + * Even if we fixed the libguestfs API to do translation of this > + * field correctly, it seems unlikely that there would ever be a > + * meaningful difference in the st_dev or st_ino fields. We > + * already know the fields refer to the same filename. Is it > + * interesting that the file might have moved to a different disk? > + * Everything else is comparing the content or direct metadata of > + * the file, but st_dev and st_ino represent the metadata of the > + * filesystem which is (arguably) different. > + */ > +// COMPARE_STAT (st_dev); > +// COMPARE_STAT (st_ino); > COMPARE_STAT (st_mode); > COMPARE_STAT (st_nlink); > COMPARE_STAT (st_uid);This seems to remain compatible with the existent virt-diff(1) manual, which says: https://libguestfs.org/virt-diff.1.html> This tool will find differences in filenames, file sizes, checksums, > extended attributes, file content and more from a virtual machine or > disk image. However it does not look at the boot loader, unused space > between partitions or within filesystems, "hidden" sectors and so on. > In other words, it is not a security or forensics tool.Acked-by: Laszlo Ersek <lersek at redhat.com> Laszlo