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

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

Re: diff -r with symlink to dir


From: Denis McKeon
Subject: Re: diff -r with symlink to dir
Date: Fri, 25 May 2001 18:26:38 -0700

In <address@hidden> Gilles Lamiral wrote:
>Bonjour,
>
>An old bug I still have with a recent upgrade.
>All debian distributions have that sort of self link ("link -> .")
>diff should not go (and break) in an endless loop, at least
>with a --notfollowsymlink option, no?
>
>Now an example:
>
>mkdir -p /tmp/diffbug/foo
>cd /tmp/diffbug/foo
>ln -s . selflink
>cp -a . ../foo2
>cd ..
>find . -ls
>162367    4 ...   4096 May 23 03:30 .
>162368    4 ...   4096 May 23 03:30 ./foo
>164507    1 ...      1 May 23 03:30 ./foo/selflink -> .
>131570    4 ...   4096 May 23 03:30 ./foo2
>131573    1 ...      1 May 23 03:30 ./foo2/selflink -> .
>
>diff -r foo foo2
>.. # A recursive endless loop...
>..link/selflink/selflink: File name too long
>
>diff --version
>diff - GNU diffutils version 2.7

No fix, but I see similar problems in RedHat with:

    foo -> foo
    bar -> .
    baz -> ..

I can see that it might be <handwave>fairly easy to handle the trivial
sorts of cases </handwave> where symlinks point to themselves or the
current, or parent directory, but to be more robust for strangness like:

    foo -> /mnt/other_disk/dir/../../../proc/self/cwd

would probably mean keeping a list of traversed dirs, or a (per-device)
bitmap of visited inodes, but then there's NFS, and so forth.  
The symlinks(8) cleanup utility in RedHat might help,
and may be available elsewhere.

Bonne chance,

-- 
Denis McKeon



reply via email to

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