Re: question: does "diff" use short cuts?

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

 



On Mon, 2023-07-10 at 14:31 +0200, Roberto Ragusa wrote:
> On 7/9/23 14:55, Robert Nichols wrote:
> 
> > Also, if you run diff with the "-q" (--brief) option it will simply
> > report which files differ, stopping after the first mismatch in
> > each file, similar to what the cmp command would do.
> 
> For completeness, since the original topic was "does diff use short
> cuts?" and I've not
> seen it mentioned in the thread yet, diff *does* use a shortcut: it
> doesn't open the files
> at all if they are hardlinks to the same file, because the content is
> for sure equal.
> Try this:
> - go in a directory with a very big file (iso, mkv, qcow2, ...)
> - ln myfile.iso myfile.iso2
> - diff myfile.iso myfile.iso2
> observe how the answer is immediate and the files are not opened at
> all
> (strace shows that after two "stat"s, it exits without any "open").
> 
> There is a common practice to have a source dir, "cp -al", then work
> on the second one (important: detach links when saving), finally do
> the diff,
> it is very fast since the majority of files under comparison are
> still hardlinked couples.

That reinforces the point about using a compatible filesystem on the
backup medium, i.e. one that supports hard links, so not FAT and the
like.

poc
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux