Bug 233402 - diff -N: loss of functionality
Summary: diff -N: loss of functionality
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs mailing list
Depends on:
Reported: 2018-11-22 11:26 UTC by Roman Neuhauser
Modified: 2020-05-19 09:42 UTC (History)
4 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Roman Neuhauser 2018-11-22 11:26:15 UTC
-N works without -r in GNU diff, which is useful because it can make scripts a tiny bit simpler.  this functionality got lost with the switch from GNU diff to the OpenBSD one.


roman@crowbar ~ master 0 1002 0 . echo fubar > snafu
roman@crowbar ~ master 0 1003 0 . diff snafu wtf
diff: wtf: No such file or directory
roman@crowbar ~ master 0 1004 2 . diff -N snafu wtf 
< fubar


roman@sheeba ~ master :M 0 1003 2 . echo fubar > snafu
roman@sheeba ~ master :M 0 1004 0 . diff snafu wtf
diff: wtf: No such file or directory
roman@sheeba ~ master :M 0 1005 2 . diff -N snafu wtf 
diff: wtf: No such file or directory
Comment 1 fehmi noyan isi 2020-05-19 09:42:27 UTC
Is being able to use -N without -r the desired behaviour for diff(1)? From diff(1) man page, I understand that FreeBSD diff(1) requires the second file to be present in the directory where a recursive call starts but necessarily in the current working directory.

FreeBSD man 1 diff 
-N --new-file
    If a file is found in only one directory, act as if it was found
    in the other directory too but was of zero size.

man for GNU diff
-N, --new-file
    treat absent files as empty