Bug 49856 - diff -r blindly follows symlinks
Summary: diff -r blindly follows symlinks
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: diffutils
Version: 7.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Tim Waugh
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-07-24 16:35 UTC by David Nečas
Modified: 2007-04-18 16:35 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2001-07-24 16:35:08 UTC
Embargoed:


Attachments (Terms of Use)

Description David Nečas 2001-07-24 16:35:04 UTC
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 11:45:53 UTC
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.