Bug 254455 - BSD diff(1) compares same files and dirs
Summary: BSD diff(1) compares same files and dirs
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.2-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2021-03-21 09:31 UTC by Andre Albsmeier
Modified: 2021-03-22 14:11 UTC (History)
1 user (show)

See Also:

patch (1.35 KB, patch)
2021-03-21 09:31 UTC, Andre Albsmeier
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andre Albsmeier 2021-03-21 09:31:47 UTC
Created attachment 223468 [details]

I was wondering why a "diff -rq" on FreeBSD-12 (BSD diff) ran endlessly while on FreeBSD-11 (GNU diff) it terminated in 0.6 seconds.

This is because BSD diff compares files and dirs even if they are the same. I checked what GNU diff does in this case and added the corresponding code to diffdir() and diffreg(). The style is probably considered bad ;-).