[31272] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Properly quote command strings in k5test.py

daemon@ATHENA.MIT.EDU (ghudson@mit.edu)
Tue Aug 22 02:11:34 2023

From: ghudson@mit.edu
To: <cvs-krb5@mit.edu>
Message-ID: <20230822061124.CCB0510175B@krbdev.mit.edu>
Date: Tue, 22 Aug 2023 02:11:24 -0400 (EDT)
MIME-Version: 1.0
Reply-To: krbdev@mit.edu
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/ae704daad5caa502387aa39ed6d596cb117d5b3a
commit ae704daad5caa502387aa39ed6d596cb117d5b3a
Author: Greg Hudson <ghudson@mit.edu>
Date:   Thu Jul 27 23:54:16 2023 -0400

    Properly quote command strings in k5test.py
    
    Requiring Python 3.4 gives us shlex.quote() (added in Python 3.3).
    Use it in _shell_equiv() to quote command arguments.

 src/util/k5test.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/util/k5test.py b/src/util/k5test.py
index 8e5f5ba8e..f205f0ab3 100644
--- a/src/util/k5test.py
+++ b/src/util/k5test.py
@@ -672,11 +672,10 @@ def _cfg_merge(cfg1, cfg2):
     return result
 
 
-# Python gives us shlex.split() to turn a shell command into a list of
-# arguments, but oddly enough, not the easier reverse operation.  For
-# now, do a bad job of faking it.
+# We would like to use shlex.join() from Python 3.8.  For now use
+# shlex.quote() from Python 3.3.
 def _shell_equiv(args):
-    return " ".join(args)
+    return ' '.join(shlex.quote(x) for x in args)
 
 
 # Add a valgrind prefix to the front of args if specified in the
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post