Package: dpkg
Version: 1.17.9
Severity: wishlist
Tags: patch
Hi,
dpkg produces an unnecessary whitespace after the fieldname of multiline
fields. Not having this extra whitespace would save 16kb of an
uncompressed Sources file.
Here is a simple patch and updated testcase:
diff --git a/scripts/Dpkg/Control/HashCore.pm b/scripts/Dpkg/Control/HashCore.pm
index 6d6f1c5..155c8ce 100644
--- a/scripts/Dpkg/Control/HashCore.pm
+++ b/scripts/Dpkg/Control/HashCore.pm
@@ -358,12 +358,18 @@ sub output {
$value .= "\n $_";
}
}
+ # do not print a trailing space if value starts with a newline
+ if ($value =~ /^\n/) {
+ $value = "$key:$value\n";
+ } else {
+ $value = "$key: $value\n";
+ }
# Print it out
if ($fh) {
- print { $fh } "$key: $value\n"
+ print { $fh } $value
or syserr(_g('write error on control data'));
}
- $str .= "$key: $value\n" if defined wantarray;
+ $str .= $value if defined wantarray;
}
}
return $str;
diff --git a/scripts/t/Dpkg_Changelog.t b/scripts/t/Dpkg_Changelog.t
index 43bccea..d6372a2 100644
--- a/scripts/t/Dpkg_Changelog.t
+++ b/scripts/t/Dpkg_Changelog.t
@@ -173,7 +173,7 @@ Urgency: high
Maintainer: Frank Lichtenheld <[email protected]>
Date: Sun, 13 Jan 2008 15:49:19 +0100
Closes: 1000000 1111111 2222222
-Changes:
+Changes:
fields (2.0-0etch1) stable; urgency=low
.
* Upload to stable (Closes: #1111111, #2222222)
@@ -214,7 +214,7 @@ Urgency: medium
Maintainer: Frank Lichtenheld <[email protected]>
Date: Sun, 12 Jan 2008 15:49:19 +0100
Closes: 1111111 2222222
-Changes:
+Changes:
fields (2.0-1) unstable frozen; urgency=medium
.
[ Frank Lichtenheld ]
@@ -244,7 +244,7 @@ Distribution: unstable
Urgency: low
Maintainer: Frank Lichtenheld <[email protected]>
Date: Sun, 11 Jan 2008 15:49:19 +0100
-Changes:
+Changes:
fields (2.0~b1-1) unstable; urgency=low,xc-userfield=foobar
.
* Beta
@@ -257,7 +257,7 @@ Urgency: high
Maintainer: Frank Lichtenheld <[email protected]>
Date: Sun, 10 Jan 2008 15:49:19 +0100
Closes: 1000000
-Changes:
+Changes:
fields (1.0) experimental; urgency=high,xb-userfield2=foobar
.
* First upload (Closes: #1000000)
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]