Bug#822849: qemubuilder: fix --update by checking for the correct asprintf() return value

Peter Pentchev roam at ringlet.net
Thu Apr 28 10:28:54 UTC 2016


Package: qemubuilder
Version: 0.79
Severity: grave
Tags: patch

Hi,

Thanks for writing and maintaining cowdancer, cowbuilder, and qemubuilder!

What do you think about the attached patch that makes "qemubuilder --update"
actually work by checking the asprintf() return value for the correct error
indication? :)

Actually, the error checking after asprintf() in the whole cowdancer source
is a bit inconsistent - some places check for < 0 (or 0>), some places check
for the IMHO more precise == -1, some places don't check at all...   I have
a larger change in the works that makes the checks a bit more consistent and
introduces a couple more of them, along with some other checks, but it's not
quite ready yet.

Thanks for cowbuilder and qemubuilder anyway, and keep up the great work!

G'luck,
Peter

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'oldoldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.5.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=bg_BG.UTF-8, LC_CTYPE=bg_BG.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages qemubuilder depends on:
ii  debootstrap     1.0.80
ii  libc6           2.22-7
ii  pbuilder        0.223
ii  qemu-kvm [kvm]  1:2.5+dfsg-5+b1
ii  qemu-system     1:2.5+dfsg-5+b1

qemubuilder recommends no packages.

qemubuilder suggests no packages.

-- no debconf information
-------------- next part --------------
From 3296d05efd2d7e450d6f0e07c5dbdcfdaf0abb10 Mon Sep 17 00:00:00 2001
From: Peter Pentchev <roam at ringlet.net>
Date: Thu, 28 Apr 2016 13:17:22 +0300
Subject: [PATCH] Fix a wrong check for asprintf()'s return code.

Thus, make qemubuilder --update actually work again.
---
 qemubuilder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qemubuilder.c b/qemubuilder.c
index 1aa927f..fc4592a 100755
--- a/qemubuilder.c
+++ b/qemubuilder.c
@@ -973,7 +973,7 @@ int cpbuilder_update(const struct pbuilderconfig* pc)
      There is no way to change distribution in this code-path...
    */
   char *script;
-  if (0<asprintf(&script,
+  if (0>asprintf(&script,
 		 //TODO: installaptlines if required.
 		 //TODO: "dpkg --purge $REMOVEPACKAGES\n"
 		 //TODO: add error code handling.
-- 
2.8.0.rc3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pbuilder-maint/attachments/20160428/1ee171ca/attachment.sig>


More information about the Pbuilder-maint mailing list