bug-diffutils
[Top][All Lists]
Advanced

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

Re: [bug-diffutils] diff: support for --no-dereference option


From: Bruno Haible
Subject: Re: [bug-diffutils] diff: support for --no-dereference option
Date: Sun, 08 Jan 2012 02:47:36 +0100
User-agent: KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; )

Paul Eggert wrote:
> Thanks for the patch!  I would like to fold something like
> this in.
> 
> Two thoughts.
> 
> First, many programs (e.g., cp) have three options:
> -H -L -P.  These distinctions seem to be useful for diff.
> This suggests that the new --no-dereference flag should
> be -P, not -h.  -h has a subtly different meaning from
> -P, in programs like chown.
> 
> Changing the patch to use -P instead of -h should be easy

But -P currently is equivalent to --unidirectional-new-file.
If we reassign -P immediately, we can silently break some users' scripts.
IMO we need to first deprecate the option -P and leave it that way for
some time (perhaps 1 year) before it can be used for a different purpose.

Find attached the revised set of patches.

> Second, and more important, the output of --no-dereference
> should be something that we can feed to an (augmented)
> 'patch' so that it can alter a copy of the old tree,
> symlinks and all, so that it looks like the new tree,
> symlinks and all.  This suggests that the output of
> 'diff' needs to contain the symlink contents, and needs
> to distinguish symlinks from regular files, so that 'patch'
> can reconstruct the symlinks.

Ideally, yes. But this can come later, for two reasons:

1) There are already other cases where 'diff' emits such lines that
   'patch' does not understand:

$ mkdir a
$ ln -s /dev/tty a/foo
$ mkdir b
$ diff -r a b
Only in a: foo
$ ln -s /dev/zero b/foo
$ diff -r a b
File a/foo is a character special file while file b/foo is a character special 
file

2) 'patch' does not break through this additional lines. It simply ignores
them.

Bruno

Attachment: 0001-Deprecate-old-option-P.patch
Description: Text Data

Attachment: 0002-New-option-no-dereference.patch
Description: Text Data


reply via email to

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