From 808ff71b8205aeb84cd8607c05fb5e906e78a401 Mon Sep 17 00:00:00 2001 From: Raphael Hertzog Date: Sat, 7 Jun 2008 22:08:05 +0200 Subject: [PATCH] dpkg-source: accept patches with missing context at the end * scripts/Dpkg/Source/Patch.pm (analyze): Accept unexpected end-of-file in patches if we're missing no more than 2 lines of context. Output a warning instead. --- ChangeLog | 6 ++++++ scripts/Dpkg/Source/Patch.pm | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7226c04a..59f5007b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-06-07 Raphael Hertzog + + * scripts/Dpkg/Source/Patch.pm (analyze): Accept unexpected + end-of-file in patches if we're missing no more than 2 lines + of context. Output a warning instead. + 2008-06-07 Raphael Hertzog * scripts/Dpkg/Source/Package/V3/quilt.pm (register_autopatch): diff --git a/scripts/Dpkg/Source/Patch.pm b/scripts/Dpkg/Source/Patch.pm index 42484932..052389d1 100644 --- a/scripts/Dpkg/Source/Patch.pm +++ b/scripts/Dpkg/Source/Patch.pm @@ -368,7 +368,12 @@ sub analyze { # read hunk while ($olines || $nlines) { unless (defined($_ = getline($diff_handle))) { - error(_g("unexpected end of diff `%s'"), $diff); + if (($olines == $nlines) and ($olines < 3)) { + warning(_g("unexpected end of diff `%s'"), $diff); + last; + } else { + error(_g("unexpected end of diff `%s'"), $diff); + } } next if /^\\ No newline/; # Check stats -- 2.39.5