Re: Perl expert wanted to solve dpkg-source bug#16415, please
You can try this if you dare, all disclamers on, not tested, except it
compiles.
===============================================================================
--- dpkg-source.modified Tue Jan 12 03:44:26 1999
+++ /usr/bin/dpkg-source Tue Jun 23 23:17:47 1998
@@ -506,7 +506,7 @@
checktarsane("$dscdir/$tarfile",$expectprefix);
if (length($difffile)) {
- my ($mcnt, $pcnt);
+
&forkgzipread("$dscdir/$difffile");
$/="\n";
while (<GZIP>) {
@@ -528,24 +528,8 @@
$_ eq '+++ '.$newdirectory.substr($fn,length($expectprefix)) ||
&error("line after --- for file $fn isn't as expected");
$filepatched{$fn}++ && &error("diff patches file $fn twice");
- $_= <GZIP>; s/\n$// ||
- &error("diff finishes in middle of +++/@@@ (line $.)");
- m/^\@\@ -\d+,(\d+) \+\d+,(\d+) \@\@$/ ||
- &error("$_: (line $.) mismatch in diff's unified output syntax");
- ($mcnt, $pcnt) = ($1, $2);
- while ($mcnt || $pcnt) {
- $_= <GZIP>; s/\n$// ||
- &error("premature eof (line $.)");
- if (/^-/) {
- $mcnt--;
- } elsif (/^ /) {
- $mcnt--;
- $pcnt--;
- } elsif (/^\+/) {
- $pcnt--;
- }
- }
} elsif (/^\\ No newline at end of file$/) {
+ } elsif (/^[-+ \@]/) {
} else {
&error ("diff contains unknown line \`$_'");
}
===============================================================================
-------------------------------------------------------------------------------
Karl Hammar Aspö Data karl@kalle.csb.ki.se
Lilla Aspö 2340 0173 140 57
S-742 94 Östhammar 070 511 97 84 Professionella Linuxlösningar
Sweden
-------------------------------------------------------------------------------
On Mon, 11 Jan 1999, Oliver Elphick wrote:
> I need a solution to this dpkg-source bug, because it is preventing
> one of my packages from being extracted.
>
> dpkg-source fails to cope with diff files where the lines changed begin
> with --, because the diff then contains lines starting `--- ' which do
> not introduce new files to patch.
>
> For instance:
> --- smalleiffel-1.6.0.79.orig/contrib/lib/header.txt
> +++ smalleiffel-1.6.0.79/contrib/lib/header.txt
> @@ -1,12 +1,12 @@
> --- This file is free software, which comes along with SmallEiffel. This
> --- software is distributed in the hope that it will be useful, but WITHOUT
> ...
>
> This causes an error at the first --- line of text, because dpkg-source
> tries to interpret the text as a path name.
>
> This is the relevant Perl code from dpkg-source:
>
> if (length($difffile)) {
>
> &forkgzipread("$dscdir/$difffile");
> $/="\n";
> while (<GZIP>) {
> s/\n$// || &error("diff is missing trailing newline");
> if (/^--- /) {
>
> ^^^^^^^^^^^^^^^ Here is the problem ^^^^^^^^^^^
>
> $fn= $';
> substr($fn,0,length($expectprefix)+1) eq "$expectprefix/" ||
> &error("diff patches file ($fn) not in expected
> subdirectory
> ");
> $fn =~ m/\.dpkg-orig$/ &&
> &error("diff patches file with name ending .dpkg-orig");
> $dirname= $fn;
> if ($dirname =~ s,/[^/]+$,, && !defined($dirincluded{$dirname})
> )
> {
> $dirtocreate{$dirname} = 1;
> }
> defined($notfileobject{$fn}) &&
> &error("diff patches something which is not a plain file");
> $_= <GZIP>; s/\n$// ||
> &error("diff finishes in middle of ---/+++ (line $.)");
> $_ eq '+++ '.$newdirectory.substr($fn,length($expectprefix)) ||
> &error("line after --- for file $fn isn't as expected");
> $filepatched{$fn}++ && &error("diff patches file $fn twice");
> } elsif (/^\\ No newline at end of file$/) {
> } elsif (/^[-+ \@]/) {
> } else {
> &error ("diff contains unknown line \`$_'");
> }
> }
> close(GZIP);
>
> &reapgzip;
> }
>
> what this code needs to do is to note the first --- line and check the path.
> It then needs to note the +++ line and parse the next line to extract the
> length in lines of the original and changed text.
>
> It then needs to count past the text, ignoring any /^--- / until it has
> exhausted the text lines.
>
> Can anyone supply a patch to do this, please? I don't know Perl :-(
>
>
>
> --
> Oliver Elphick Oliver.Elphick@lfix.co.uk
> Isle of Wight http://www.lfix.co.uk/oliver
> PGP key from public servers; key ID 32B8FAA1
> ========================================
> "Enter into his gates with thanksgiving, and into his
> courts with praise. Be thankful unto him, and bless
> his name." Psalms 100:4
>
>
>
> --
> To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
Reply to: