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

Perl expert wanted to solve dpkg-source bug#16415, please



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 



Reply to: