Bug 49856 - diff -r blindly follows symlinks
diff -r blindly follows symlinks
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: diffutils (Show other bugs)
7.1
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Aaron Brown
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-07-24 12:35 EDT by David Nečas
Modified: 2007-04-18 12:35 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-07-24 12:35:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description David Nečas 2001-07-24 12:35:04 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux 2.2.19 i686; en-US; rv:0.9.1)
Gecko/20010607

Description of problem:
diff -r blindly follows symlinks, namely directory symlinks.  When the
compared directories accidentaly contain link cycles, strange things
happen.  It's not possible to use diff -r at such directory structures at all.

How reproducible:
Always

Steps to Reproduce:
1. Create two identical directory structures with link cycles using
following commands:

  mkdir 1 2
  cd 1
  mkdir a b
  cd a
  ln -s ../b b
  cd ../b
  ln -s ../a a
  cd ../../2
  mkdir a b
  cd a
  ln -s ../b b
  cd ../b
  ln -s ../a a
  cd ../..

2. run

  diff -r 1 2
	

Actual Results:  For a good while it seems nothing is happening, then diff
prints two messages like (several hundreds of `a/b/'s omitted in the place
of `...')

   diff: 1/a/b/a/b/a/b/a/b/a/b/a/b/.../a/b/a/b/a/b: File name too long

and after a while it ends.

Expected Results:  diff realizes the directories are identical, realizes it
pretty fast and doesn't print any error messages.

Additional info:

It is arguable what diff should do in similar situations.  I don't see why
it should follow symlinks at all, namely directory symlinks.  Maybe it
could be made optional, at least.
Comment 1 Tim Waugh 2001-07-30 07:45:53 EDT
This behaviour is fixed in our rawhide tree.  diffutils-2.7.2-1 gives this:

diff: 1/a/b/a: recursive directory loop
diff: 1/b/a/b: recursive directory loop


Note You need to log in before you can comment on or make changes to this bug.