On Wed, Aug 05, 2009 at 10:07:02PM +0900, Charles Plessy wrote: > After deleting the following check, my source package builds fine. > > --- a/scripts/Dpkg/Source/Patch.pm > +++ b/scripts/Dpkg/Source/Patch.pm > @@ -325,9 +325,6 @@ sub analyze { > unless (defined($_ = getline($diff_handle))) { > error(_g("diff `%s' finishes in middle of ---/+++ (line %d)"), > $diff, $.); > } > - unless (s/^\+\+\+ //) { > - error(_g("line after --- isn't as expected in diff `%s' (line > %d)"), $diff, $.); > - } > $_ = strip_ts($_); > if ($_ eq '/dev/null' or s{^(\./)?[^/]+/}{$destdir/}) { > $fn2 = $_; > > Why not just applying the patches and catch errors if there are, instead of > writing a new patch parser from scratch just to check that it looks like being > in the unified format?
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. For example, vim upstream is using non unified diffs with context as a way to release its incremental versions, still nowadays. That said, yes, using non-unified diff is as laughable as using RCS or SCCS nowadays. Though I consider it a bug if dpkg refuses to apply a patch that patch(1) (that it uses in the end) would apply fine. I shall say that I absolutely don't get why there even is an "analyze()" routine in Patch.pm, if you want that, let patch(1) do it using its --dry-run mode. It'll report failed hunk and bad syntax the same way. 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. In between there are as many already said many workarounds, the easier one being to regenerate the diff, which you can easily do using combinediff (I've not checked if there is anything more straightforward): $ cat aa toto tuti titi $ cat ab toto tutu titi $ diff -C2 aa ab | tee aa-to-ab.diff *** aa 2009-08-06 18:25:44.875327948 +0200 --- ab 2009-08-06 18:25:50.107327652 +0200 *************** *** 1,3 **** toto ! tuti titi --- 1,3 ---- toto ! tutu titi $ combinediff aa-to-ab.diff /dev/null unchanged: --- aa 2009-08-06 18:25:44.875327948 +0200 +++ ab 2009-08-06 18:25:50.107327652 +0200 @@ -1,3 +1,3 @@ toto -tuti +tutu titi Cheers, -- Intersec <http://www.intersec.com> Pierre Habouzit <pierre.habou...@intersec.com> Tél : +33 (0)1 5570 3346 Mob : +33 (0)6 1636 8131 Fax : +33 (0)1 5570 3332 37 Rue Pierre Lhomme 92400 Courbevoie -- To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org