From 63bb0c9c7edaf3cdaf8d03eb0fbcdbba40b65d36 Mon Sep 17 00:00:00 2001 From: Tiago Gomes Date: Tue, 1 Sep 2015 15:08:49 +0000 Subject: Replace cliapp.shell_quote() with pipes.quote() Replace cliapp.shell_quote() with pipes.quote() to produce the chroot scripts. Despite pipes.quote() being deprecated, it produces much less escaping than cliapp.shell_quote(). This method should be replaced with shlex.quote() when migrating to Python 3. Change-Id: I4b8e8eefe0cd321458bb3fae72f6d0552680f84f --- morphlib/builder.py | 3 ++- morphlib/stagingarea.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/morphlib/builder.py b/morphlib/builder.py index a9fe8957..443741b0 100644 --- a/morphlib/builder.py +++ b/morphlib/builder.py @@ -25,6 +25,7 @@ import traceback import subprocess import tempfile import warnings +import pipes import cliapp @@ -697,7 +698,7 @@ class SystemBuilder(BuilderBase): # pragma: no cover with open(chroot_script, 'w') as f: cmdline = morphlib.util.containerised_cmdline( shell_command, **container_config) - f.write(' '.join(map(cliapp.shell_quote, cmdline))) + f.write(' '.join(map(pipes.quote, cmdline))) with open(logfilepath, 'r') as log: shutil.copyfileobj(log, self.app.output) diff --git a/morphlib/stagingarea.py b/morphlib/stagingarea.py index ba2bf39c..6965252d 100644 --- a/morphlib/stagingarea.py +++ b/morphlib/stagingarea.py @@ -21,6 +21,7 @@ import cliapp from urlparse import urlparse import tempfile import fcntl +import pipes import morphlib @@ -292,7 +293,7 @@ class StagingArea(object): cmdline = morphlib.util.containerised_cmdline( shell_command, **container_config) with open(chroot_script, 'w') as f: - f.write(' '.join(map(cliapp.shell_quote, cmdline))) + f.write(' '.join(map(pipes.quote, cmdline))) return exit -- cgit v1.2.1