Package: dpkg-dev
Version: 1.16.0.3
Severity: normal
File: dpkg-mergechangelog
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

Not the test suite I promised, but I noticed that dpkg-mergechangelog does
not check the return value of close on the output handle.  This cause it
to claim things are fine when they are not.

 $ dpkg-mergechangelog ch-old ch-a ch-b /dev/full ; echo $?
 1
 $

With this patch (using syserr) it becomes:

 $ dpkg-mergechangelog ch-old ch-a ch-b /dev/full ; echo $?
 dpkg-mergechangelog: error: cannot write /dev/full: No space left on device
 28
 $

Which I believe is a better behaviour.

~Niels

PS: If you had not guessed it, the ch-* files are the ones from the test suite.

- -- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.39-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dpkg-dev depends on:
ii  base-files            6.3                Debian base system miscellaneous f
ii  binutils              2.21.52.20110606-2 The GNU assembler, linker and bina
ii  bzip2                 1.0.5-6            high-quality block-sorting file co
ii  libdpkg-perl          1.16.0.3           Dpkg perl modules
ii  make                  3.81-8.1           An utility for Directing compilati
ii  patch                 2.6.1-2            Apply a diff file to an original
ii  xz-utils              5.0.0-2            XZ-format compression utilities

Versions of packages dpkg-dev recommends:
ii  build-essential               11.5       Informational list of build-essent
ii  fakeroot                      1.16-1     tool for simulating superuser priv
ii  gcc [c-compiler]              4:4.6.0-6  GNU C compiler
ii  gcc-4.5 [c-compiler]          4.5.3-3    The GNU C compiler
ii  gcc-4.6 [c-compiler]          4.6.1-1    GNU C compiler
ii  gnupg                         1.4.11-3   GNU privacy guard - a free PGP rep
ii  gpgv                          1.4.11-3   GNU privacy guard - signature veri
pn  libalgorithm-merge-perl       <none>     (no description available)

Versions of packages dpkg-dev suggests:
ii  debian-keyring                2011.03.03 GnuPG keys of Debian Developers

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJOGuN/AAoJEAVLu599gGRCkOgP/jBRE3jKyqk5RwzIOpG4kJhV
Jyd9He9f9+uQIoPVlC7IN8Ch+dCQcxh0Gi9vW3IvTM27SbWkDjadufI+xaOob5bJ
CzO/lLsDNHziQznNZqP4QNtaNC5OdjvCsMrXd3gHOijBEhMm1DKM4y3h5o2spF7E
LvAz6OeYm0Yr16hJVO86ZNei6TEPrSodVJCoR7Q3Lqb2Zx18NXmsXZdU99lRbZvW
+iIOHauxeIcSDFXcEWbazZEpj/l21UpUos0UEhlUndYa3i+yA8jcD/6aVu7FL1/s
KO+tTmT51KM1PnImKZ+f5Tr4/ipXZvFHVU3L3EDF5v8SFcUkMh8EvwLIMLbwQfDA
DNHDpoYbKXuD5XXYjkWciOTlNYgFFim3Kv+gC80CUPxuViMwiW26P/2Karb4Pzqw
aBPBUoDN6SIseMNtmONTtyJ5SAwAB7qf+Wc+KgHffGPo/jwm3uwgOgZsLfVWlqot
p2m4QGW5WxCXqAUwr59s0SI72ZRQrNWKaK/QBMBC7n32vpwKArscZea3j8pw2FCR
rFwh6M9Syzj9EDvTs0SkkgFCy002Q9ZebeZI/qVm6uxSYpIZBhLkznW/ZDs/Z/bT
58RpaYdDvt6VRFYYIByNpj1X2RJYv4hXrseg6fnbPsL8pLfY/bhYbZocMNupE4g7
D8M+bzC6lrDnXAMkU0/i
=67z9
-----END PGP SIGNATURE-----
>From 239ee5e2797d88076f4551e4bac4f0c9c27e17bf Mon Sep 17 00:00:00 2001
From: Niels Thykier <ni...@thykier.net>
Date: Mon, 11 Jul 2011 13:27:44 +0200
Subject: [PATCH] dpkg-mergechangelog: fail if it cannot close the output file

Made dpkg-mergechangelog check the return value of close and fail
if it was not successful.  Previously dpkg-mergechangelog would
silently fail to write a file if (e.g.) the device was full.
---
 scripts/dpkg-mergechangelogs.pl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/scripts/dpkg-mergechangelogs.pl b/scripts/dpkg-mergechangelogs.pl
index cea7584..9cc84f2 100755
--- a/scripts/dpkg-mergechangelogs.pl
+++ b/scripts/dpkg-mergechangelogs.pl
@@ -128,7 +128,7 @@ while (1) {
 if (defined($out_file) and $out_file ne "-") {
     open(OUT, ">", $out_file) || syserr(_g("cannot write %s"), $out_file);
     print OUT ((blessed $_) ? "$_" : "$_\n") foreach @result;
-    close(OUT);
+    close(OUT) || syserr(_g("cannot write %s"), $out_file);
 } else {
     print ((blessed $_) ? "$_" : "$_\n") foreach @result;
 }
-- 
1.7.5.4

Reply via email to