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

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

Re: diff: bad treatment of symlinks


From: Andries Brouwer
Subject: Re: diff: bad treatment of symlinks
Date: Tue, 18 Oct 2011 17:39:50 +0200
User-agent: Mutt/1.5.9i

On Tue, Oct 18, 2011 at 11:08:10AM -0400, John Cowan wrote:
> Andries E. Brouwer scripsit:
> 
> > A symlink is a small file that contains a filename.
> 
> I disagree.  The fact that symlinks are implemented as files is an
> accident.  They could be implemented as logical relations in kernel
> or user memory, as is done for mounts, for example.  This is what
> is done on Plan 9, where the filesystem is purely hierarchical.
> 
> > This means that diff should never use the contents of the
> > symlink target. (Maybe when the two files to be compared
> > are given as command parameters, depending on option flags,
> > but certainly not in a recursive diff of two trees.)
> 
> To say that "diff foo1 foo2", where foo1 or foo2 are symlinks,
> should report the symlink status is to say that "cat foo", where
> foo is a symlink, should print the contents of the symlink.  To
> take that view would make symlinks useless.

No, certain operations are defined to follow symlinks.
But a symlink is not the same thing as its target.
For example, if lk is a symlink, then lk/../a is not the same as ./a .

People who designed this system may have had something in mind
similar to what you describe, but current Unix/Linux reality is different.

[differences: (i) space: 5 symlinks to a 800GB file take almost
zero space, (ii) location: if a directory contains a makefile
that refers to .. then a symlink to the directory and an in-place
copy of that directory are not equivalent]

Andries




reply via email to

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