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


View this message in rfc822 format

From: Ondřej Svoboda <ondrej <at> svobodasoft.cz>
To: 19508 <at> debbugs.gnu.org
Subject: bug#19508: [bug-diffutils] bug#19508: bug#19508: [PATCH] diff: compare major, minor numbers of block/character special files
Date: Sat, 12 Mar 2016 15:16:49 +0100
Please see the follow-up on testing below.

On 12.3.2016 14:55, Ondřej Svoboda wrote:
> 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.

# touch /tmp/b/*

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

# LC_ALL=C diff -s -r /tmp/a /tmp/b
File /tmp/a/block1 is a block special file while file /tmp/b/block1 is a 
block special file
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
File /tmp/a/char1 is a character special file while file /tmp/b/char1 is 
a character special file
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)

After changing the modification datetime, both block1 and char1 compared 
differently with diffutils 3.3-2 (on Arch Linux) while they were found 
to be the same with the patched diff from master.

> Please share your comments!
>
> Cheers,
> Ondra





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

Previous Next


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