Package: dput-ng
Version: 1.11
Severity: normal
Tags: patch

The local uploader does not check the result of running the install
command.  The attached patch adds in error handling like the other
uploaders. However, this currently breaks the test suite, since it uses
/dev/null as the path to install to, which gives an error that used to
be ignored.

Regards,
James



-- System Information:
Debian Release: 9.0
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 
'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)

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

Versions of packages dput-ng depends on:
ii  python-dput  1.11
pn  python:any   <none>

Versions of packages dput-ng recommends:
ii  bash-completion  1:2.1-4.3
ii  python-paramiko  2.0.0-1

dput-ng suggests no packages.

-- no debconf information
>From 019350b9ea2cc0176dbf2f1f53eb041f20e80965 Mon Sep 17 00:00:00 2001
From: James Clarke <jrt...@debian.org>
Date: Tue, 14 Feb 2017 15:19:03 +0000
Subject: [PATCH] Report errors in the local uploader and tidy up imports

---
 dput/uploaders/local.py | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/dput/uploaders/local.py b/dput/uploaders/local.py
index 737a9a1..9243b59 100644
--- a/dput/uploaders/local.py
+++ b/dput/uploaders/local.py
@@ -21,10 +21,20 @@
 Local Uploader implementation
 """
 
-from dput.uploader import AbstractUploader
-import dput.util
 import os.path
 
+from dput.uploader import AbstractUploader
+from dput.exceptions import UploadException
+from dput.util import run_command
+
+
+class LocalUploadException(UploadException):
+    """
+    Thrown in the event of a problem installing to a local file.
+    This is a subclass of :class:`dput.exceptions.UploadException`.
+    """
+    pass
+
 
 class LocalUploader(AbstractUploader):
     """
@@ -52,11 +62,15 @@ class LocalUploader(AbstractUploader):
         whereto = os.path.expanduser(whereto)
         if "HOME" in os.environ:
             whereto = os.path.join(os.environ["HOME"], whereto)
-        dput.util.run_command([
+        (_, e, x) = run_command([
             "install",
             filename,
             whereto
         ])
+        if x != 0:
+            raise LocalUploadException("Failed to upload %s to %s: %s" % (
+                filename, whereto, e)
+            )
 
     def shutdown(self):
         """
-- 
2.11.0

Reply via email to