bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

diffutils V. 2.7: diff -r is buggy (faulty treatment of links)


From: Christoph Jaekel
Subject: diffutils V. 2.7: diff -r is buggy (faulty treatment of links)
Date: Sat, 7 Jul 2001 02:52:10 +0200

Ladies and Gentlemen,

Oops! I goofed! I just sent you a mail with a crumpled attachment. Now here ist 
the honest and straightforward text:

Topic: Bug, Feature, or Missing Command Line Option in 'diff', V. 2.7?

Occurrence with command line: << diff -rqw <directory path 1> <directory
path 2> >>

Conditions of occurrence:

(1) Commonly: Descends into directories referenced by links, treating the
links as valid directories.

(2) Particularly: The SuSE Distribution V. 6.1 (never mind this particular
occurrence, meaning it is only an example of common improper use of links)
contains the following entry in /etc:
'~rc.d' as a symlink to '../sbin/init.d'.
/sbin/init.d has the following directory entries:
"...
~init.d as a link to '.'
..."
Resulting output:
"...
Files /etc/ld.so.cache and /backup_partition/etc/ld.so.cache differ
Files /etc/psdevtab and /backup_partition/etc/psdevtab differ
diff: /backup_partition/etc/rc.d/init.d/init.d/init.d/init.d/init.d/init.d/
...
/init.d/init.d/init.d/boot.local: File name is too long"
[and so forth for megabytes on end ...]

Evaluation:
I was always wondering why any <<diff -r ...>> took so long to accomplish
things. The reason is simple: 'diff' does not interpret the file type bit
and thus mixes links with directories. While this may be of some use (but
rarely), it does not reflect the standard, i.e., the way recursive directory
scans are done, e.g., by 'ls'. Moreover, if I want to compare the active file 
system with a backup done with tar or cp I am *NEVER* interested to know how 
much time meandering symlinks (and hard links, too) take to break 
'diff -r ...', but I *DO* want to know if the text of the links is preserved in
the backup. And I like to automatize with customized shell scripts. They cannot
be done properly without a reliable 'diff'...  Besides, there are better ways
to do link checks ('symlinks' by Mark Lord does it nicely) or benchmarks than
by way of 'diff'.

Source code patch:
You have got me there! I simply haven't got the time to trace and correct
the bug (or feature).

Educated guess:
diff.c of Sep-20, 1994, contains:
"compare_files (dir0, name0, dir1, name1, depth)
...
 /* Stat the files.  Record whether they are directories.  */"
[ Should be here where the fixed code goes. ]

To-do:
Well, it's either a question of an additional command line option or
(rather) an internal bug fix.

Thanks a lot for reading patiently down to here.
Yours
Christopher Jaekel
address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]