GNU bug report logs - #19508
[PATCH] diff: compare major, minor numbers of block/character special files

Previous Next

Package: diffutils;

Reported by: Ondřej Svoboda <ondrej <at> svobodasoft.cz>

Date: Sun, 4 Jan 2015 21:24:02 UTC

Severity: normal

Tags: patch

Full log


Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ondřej Svoboda <ondrej <at> svobodasoft.cz>
To: bug-diffutils <at> gnu.org
Subject: [bug-diffutils] bug#19508: [PATCH] diff: compare major, minor numbers
 of block/character special files
Date: Sat, 12 Mar 2016 14:55:56 +0100
[Message part 1 (text/plain, inline)]
Hi everybody,

I rebased the patch on current master and tested it (as root) like this:

# mkdir /tmp/a /tmp/b
# mknod /tmp/a/block1 b 1 2; mknod /tmp/b/block1 b 1 2
# mknod /tmp/a/block2 b 2 3; mknod /tmp/b/block2 b 2 4
# mknod /tmp/a/block3 b 3 4; mknod /tmp/b/block3 b 5 4
# mknod /tmp/a/char1 c 1 2; mknod /tmp/b/char1 c 1 2
# mknod /tmp/a/char2 c 2 3; mknod /tmp/b/char2 c 2 4
# mknod /tmp/a/char3 c 3 4; mknod /tmp/b/char3 c 5 4

# LC_ALL=C ls -l /tmp/a
total 0
brw-r--r-- 1 root root 1, 2 Mar 12 14:51 block1
brw-r--r-- 1 root root 2, 3 Mar 12 14:51 block2
brw-r--r-- 1 root root 3, 4 Mar 12 14:51 block3
crw-r--r-- 1 root root 1, 2 Mar 12 14:51 char1
crw-r--r-- 1 root root 2, 3 Mar 12 14:51 char2
crw-r--r-- 1 root root 3, 4 Mar 12 14:51 char3

# LC_ALL=C ls -l /tmp/b
total 0
brw-r--r-- 1 root root 1, 2 Mar 12 14:51 block1
brw-r--r-- 1 root root 2, 4 Mar 12 14:51 block2
brw-r--r-- 1 root root 5, 4 Mar 12 14:51 block3
crw-r--r-- 1 root root 1, 2 Mar 12 14:51 char1
crw-r--r-- 1 root root 2, 4 Mar 12 14:51 char2
crw-r--r-- 1 root root 5, 4 Mar 12 14:51 char3

# LC_ALL=C diff -s -r /tmp/a /tmp/b
Files /tmp/a/block1 and /tmp/b/block1 are identical
File /tmp/a/block2 is a block special file while file /tmp/b/block2 is a 
block special file
File /tmp/a/block3 is a block special file while file /tmp/b/block3 is a 
block special file
Files /tmp/a/char1 and /tmp/b/char1 are identical
File /tmp/a/char2 is a character special file while file /tmp/b/char2 is 
a character special file
File /tmp/a/char3 is a character special file while file /tmp/b/char3 is 
a character special file

# LC_ALL=C /usr/local/bin/diff -s -r /tmp/a /tmp/b
Files /tmp/a/block1 and /tmp/b/block1 are identical
Block special files /tmp/a/block2 and /tmp/b/block2 differ: 2,3 (2,4)
Block special files /tmp/a/block3 and /tmp/b/block3 differ: 3,4 (5,4)
Files /tmp/a/char1 and /tmp/b/char1 are identical
Character special files /tmp/a/char2 and /tmp/b/char2 differ: 2,3 (2,4)
Character special files /tmp/a/char3 and /tmp/b/char3 differ: 3,4 (5,4)

The reason why diff compared block1 as identical perhaps because it 
descended to diff_2_files, I would know if I stepped through the code 
which I currently don't have much time to do.

Please share your comments!

Cheers,
Ondra
[0001-diff-compare-major-minor-numbers-of-block-character-.patch (text/x-patch, attachment)]

This bug report was last modified 9 years and 96 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.