path: root/dgit
diff options
authorIan Jackson <>2018-06-27 00:16:29 +0100
committerIan Jackson <>2018-06-27 00:59:22 +0100
commitef0c4cd40f2c8bd50ea252f7de56dae3b64eeced (patch)
tree09af9db92887b64ec76243c557fdfa06df8dfa7f /dgit
parent047db2064cbc162d8fceff77ec6dd38eab135c6c (diff)
dgit: Do not introduce duplicate origs in .changes files
The .dsc and .changes matching code contained roughly $fieldbody =~ / \Q$item\E\n/m but this is wrong when the $fieldbody matches $item in its last line, and there is no trailing newline (as would be usual). This code is obviouslu confused because m affects only ^ $ which don't appear in the regexp. Change these to / \Q$item\E$/m which is what ought to have been, and probably was, intended. In one case we are trying to delete a line. In that case we need to remove the leading newline. The field body always starts with a newline so the use of \n rather than ^ is fine. Closes:#869146. Signed-off-by: Ian Jackson <>
Diffstat (limited to 'dgit')
1 files changed, 3 insertions, 3 deletions
diff --git a/dgit b/dgit
index bbfaea1..d18cc73 100755
--- a/dgit
+++ b/dgit
@@ -1975,12 +1975,12 @@ END
if ($found_same) {
# in archive, delete from .changes if it's there
$changed{$file} = "removed" if
- $changes->{$fname} =~ s/^.* \Q$file\E$(?:)\n//m;
- } elsif ($changes->{$fname} =~ m/^.* \Q$file\E$(?:)\n/m) {
+ $changes->{$fname} =~ s/\n.* \Q$file\E$(?:)$//m;
+ } elsif ($changes->{$fname} =~ m/^.* \Q$file\E$(?:)$/m) {
# not in archive, but it's here in the .changes
} else {
my $dsc_data = getfield $dsc, $fname;
- $dsc_data =~ m/^(.* \Q$file\E$)\n/m or die "$dsc_data $file ?";
+ $dsc_data =~ m/^(.* \Q$file\E$)$/m or die "$dsc_data $file ?";
my $extra = $1;
$extra =~ s/ \d+ /$&$placementinfo /
or die "$fname $extra >$dsc_data< ?"