Package: dpkg-dev
Followup-For: Bug #1081434
X-Debbugs-Cc: [email protected]
Excuse me for butting in; I'm not sure if this could be a solution or
not. I just proposed a patch in bug #1099170 "dpkg-source: Source/Patch:
fix parsing of patch header" and was pointed to this bug as a possible
duplicate - it is not.
However after working with the code I wonder if there might be an
elegant way to avoid the spawned 'patch' tool mis-reading the header in
this way:
analyze() keeps track of the entire header:
$patch_header .= "$line\n";
...
*$self->{analysis}{$destdir}{patchheader} = $patch_header;
return *$self->{analysis}{$destdir};
apply() and check_apply() both do:
my $analysis = $self->analyze($destdir, %opts);
...
$self->ensure_open('r');
At this point the spawned process is about to be passed its input via
standard input. Could the solution be to simply seek() beyond the header
before spawn() dup's the file descriptor - something like:
seek($self, length( %{$analysis->{patchheader}} ), 0);