[Reproducible-commits] [dpkg] 16/26: libdpkg: Print correct integer parse error for short-only options

Jérémy Bobbio lunar at moszumanska.debian.org
Fri Jan 15 21:11:29 UTC 2016


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit 36e272e27c16460109604b1fa942e06187bc287c
Author: Guillem Jover <guillem at debian.org>
Date:   Mon Dec 28 04:36:24 2015 +0100

    libdpkg: Print correct integer parse error for short-only options
    
    Some options do not provide a long name, we should handle that and
    print an appropriate message, instead of passing NULL to printf.
    
    Closes: #809174
---
 debian/changelog   | 2 ++
 lib/dpkg/options.c | 8 ++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 5921caa..887b784 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,7 @@
 dpkg (1.18.5) UNRELEASED; urgency=medium
 
+  * Print correct integer parse error for short-only command-line options.
+    This affects «dpkg-deb -z». Closes: #809174
   * Documentation:
     - Say value instead of option in deb-control(5).
     - Mark debian changelog format in bold in dpkg-parsechangelog(1).
diff --git a/lib/dpkg/options.c b/lib/dpkg/options.c
index aefa2ae..62d4aca 100644
--- a/lib/dpkg/options.c
+++ b/lib/dpkg/options.c
@@ -287,8 +287,12 @@ dpkg_options_parse_arg_int(const struct cmdinfo *cmd, const char *str)
 
   errno = 0;
   value = strtol(str, &end, 0);
-  if (str == end || *end || value < 0 || value > INT_MAX || errno != 0)
-    badusage(_("invalid integer for --%s: '%.250s'"), cmd->olong, str);
+  if (str == end || *end || value < 0 || value > INT_MAX || errno != 0) {
+    if (cmd->olong)
+      badusage(_("invalid integer for --%s: '%.250s'"), cmd->olong, str);
+    else
+      badusage(_("invalid integer for -%c: '%.250s'"), cmd->oshort, str);
+  }
 
   return value;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list