Bug 170624 - diff(1): diff -qr produces incorrect output
Summary: diff(1): diff -qr produces incorrect output
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: gnu (show other bugs)
Version: 9.0-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-14 03:50 UTC by Lachlan Kang
Modified: 2018-08-12 09:25 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lachlan Kang 2012-08-14 03:50:12 UTC
diff(1) produces incorrect output when recursively comparing folders that
contains links to different character devices.

Given the following directories and links:
dir1/a -> /dev/random
dir2/a -> /dev/zero
"diff -qr dir1 dir2" prints "File dir1/a is a character special file
while file dir2/a is a character special file".
It should print "Files dir1/a and dir2/a differ".

How-To-Repeat: mkdir dir1 dir2
ln -s /dev/random dir1/a
ln -s /dev/zero dir2/a
diff -qr dir1 dir2
Comment 1 Ed Maste freebsd_committer freebsd_triage 2017-11-22 03:29:17 UTC
BSD diff in HEAD does not emit the somewhat confusing error message, and as described in the man page just skips the devices.

% man diff | grep -A2 'directory mode'
     directory are described as such.  In directory mode only regular files
     and directories are compared.  If a non-regular file such as a device
     special file or FIFO is encountered, a diagnostic message is printed.
% diff -qr dir1 dir2    
File dir1/a is not a regular file or directory and was skipped
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2018-05-20 23:53:35 UTC
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017

Do
- Set Status to "Open"
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2018-08-12 09:25:39 UTC
GNU diff removed and replaced in base r315051