[Piuparts-commits] [piuparts] 04/06: p, p-s: make logged command lines shell-safe with pipes.quote()

Holger Levsen holger at layer-acht.org
Tue Mar 7 11:44:38 UTC 2017


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

holger pushed a commit to branch develop
in repository piuparts.

commit 36bc7827843208f20f05526c4fdef22ae91f9056
Author: Andreas Beckmann <anbe at debian.org>
Date:   Mon Mar 6 22:41:33 2017 +0100

    p, p-s: make logged command lines shell-safe with pipes.quote()
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 debian/changelog  | 2 ++
 piuparts-slave.py | 3 ++-
 piuparts.py       | 3 ++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 687cea9..e3c9d20 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,7 @@ piuparts (0.76) UNRELEASED; urgency=medium
     - Add --install-suggests option.
     - Fall back to generating the reference chroot state on-the-fly if the
       --end-meta file is missing.
+    - Make logged command lines shell-safe with pipes.quote().
   * piuparts.conf:
     - Use --warn-on-install-over-symlink for tests ending before stretch.
     - Enable scripts-log-alternatives for [sid] and [stretch].  (See: #850917)
@@ -20,6 +21,7 @@ piuparts (0.76) UNRELEASED; urgency=medium
   * piuparts-slave.py:
     - Replace literal ESC (0x1b) chars with string '[ESC]' for easier
       copy+paste from logfiles.
+    - Make logged command lines shell-safe with pipes.quote().
   * piuparts-analyze.py:
     - Also process untestable/*.log.
   * instances/*: Generate the config files piuparts.conf.pejacevic,
diff --git a/piuparts-slave.py b/piuparts-slave.py
index caa0d06..1a5cef4 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -36,6 +36,7 @@ import fcntl
 import random
 import ConfigParser
 import apt_pkg
+import pipes
 
 import piupartslib.conf
 import piupartslib.packagesdb
@@ -783,7 +784,7 @@ def log_name(package, version):
 
 
 def quote_spaces(vlist):
-    return ["'%s'" % x if ' ' in x else x for x in vlist]
+    return [pipes.quote(x) for x in vlist]
 
 
 def run_test_with_timeout(cmd, maxwait, kill_all=True):
diff --git a/piuparts.py b/piuparts.py
index ee21aa8..3b4ba76 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -52,6 +52,7 @@ import subprocess
 import urllib
 import uuid
 import apt_pkg
+import pipes
 from collections import namedtuple
 from signal import alarm, signal, SIGALRM, SIGTERM, SIGKILL
 
@@ -486,7 +487,7 @@ def indent_string(str):
 
 
 def quote_spaces(vlist):
-    return ["'%s'" % x if ' ' in x else x for x in vlist]
+    return [pipes.quote(x) for x in vlist]
 
 
 def unqualify(packages):

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



More information about the Piuparts-commits mailing list