bug-diffutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-diffutils] bug#33467: "diff" can not scan directories with same dev


From: Delian Krustev
Subject: [bug-diffutils] bug#33467: "diff" can not scan directories with same dev/inode
Date: Thu, 22 Nov 2018 15:44:56 +0200
User-agent: KMail/5.2.3 (Linux/4.9.0-8-amd64; KDE/5.28.0; x86_64; ; )

        Hi,

NILFS is a log structured file system which supports snapshotting.
I've tried to see the differences between two snapshots using diff:

  address@hidden:/mnt/protected# diff -qr tmp/ bkp_srv1/

and was amazed to find out that I can't.

Here are the mounts:

  # the HEAD of the filesystem, mounted read/write:
  /dev/mapper/bkp_srv1 on /mnt/protected/bkp_srv1 type nilfs2 
(rw,nosuid,nodev,noexec,relatime)
  # an older snapshot, mounted read only:
  /dev/mapper/bkp_srv1 on /mnt/protected/tmp type nilfs2 
(ro,relatime,cp=2171601)


At first I've decided that I've mounted the wrong checkpoint(snapshot) or
have done something else wrong. Then I've double checked and have verified
that there ARE actually different file contents on both mounts.

So my guess is that diff checks the stat information on the dirs and if
its the same dev&inode it does not bother to compare:

address@hidden:/mnt/protected# stat tmp bkp_srv1
  File: tmp
  Size: 4096            Blocks: 1          IO Block: 4096   directory
Device: fd05h/64773d    Inode: 2           Links: 4
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-02-11 22:16:50.545497340 +0000
Modify: 2014-02-11 22:16:50.545497340 +0000
Change: 2014-02-11 22:16:50.545497340 +0000
 Birth: -

  File: bkp_srv1
  Size: 4096            Blocks: 1          IO Block: 4096   directory
Device: fd05h/64773d    Inode: 2           Links: 4
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-02-11 22:16:50.545497340 +0000
Modify: 2014-02-11 22:16:50.545497340 +0000
Change: 2014-02-11 22:16:50.545497340 +0000
 Birth: -

I've checked the man page and was not able to find a usable diff option,
e.g. force the comparison anyway.

I've also run:

  rsync -a --dry-run --verbose tmp/. bkp_srv1/.

and it shows the differences as expected.

So "diff" is unable to do its job and show the differences between
files/dirs when they exist.

Thus I consider this to be a bug.


P.S. I am aware that "diff" is crucially important software for
lots of software developers and infrastructure and making changes
to it or its interface (e.g. command line options) is a responsible
task.


Best regards
--
Delian







reply via email to

[Prev in Thread] Current Thread [Next in Thread]