Re: Non-unified patches and dpkg source format ‘3.0 (quilt)’.
Pierre Habouzit <email@example.com> writes:
> FWIW I've read this sub-thread with some kind of consternation,
> especially seeing how wrong some arguments are.
> First of all, non-unified diffs are called "context diffs", and can have
> ... wait for it ... context. Those are actually valid ed scripts IIRC.
> The reason why unified diffs are prefered is because those are usually
> way more readable.
I think you're confusing the many different non-unified diff formats.
There are at least four.
1. Classic diff format (the default)
2. ed script format (diff -e)
3. RCS diff format (diff -n)
4. Classic context diff format (diff -c)
*** foo.1 2009-08-06 09:38:26.000000000 -0700
--- foo.2 2009-08-06 09:38:35.000000000 -0700
*** 1,6 ****
--- 1,6 ----
The fourth format is entirely equivalent, in informational content, to a
unified diff, just formatted differently. That form and unified diff form
are mutually convertible.
Unified diff is generally considered to be easier to read for most use
cases, but can be nigh-incomprehensible when there are lots of changes in
the same area of the code since it tries a bit too hard to find
similarities and tends to think that some blank line or brace in the
middle of a changed block is the same line between the two versions. In
those cases, classic context diff is easier to read.
The first three formats have no context, are extremely fragile if anything
changes about the file to which one is applying the diff (*particularly*
two and three), and should basically never be used for anything any more.
The fourth style above is exactly equivalent to a unified diff in terms of
information content and is really just a matter of taste.
> I concur with Charles that it's a dpkg-dev bug,
> I don't think his patch is valid though. I'm unsure if it needed all
> that trolling, and that a minor bug on dpkg-dev asking for non-unified
> diffs support is in order.
I think dpkg should accept old-format context diffs but reject all diffs
without context (including unified diffs without context). Diffs without
context are dangerous. They may apply in places where they're not
supposed to and make changes that are entirely unexpected.
Russ Allbery (firstname.lastname@example.org) <http://www.eyrie.org/~eagle/>