Project

General

Profile

Actions

Bug #14224

closed

[Bug][Running a workflow] Correct shell quoting in command modal

Added by Tom Clegg about 6 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
Story points:
1.0
Release relationship:
Auto

Description

Each element of the command array in a container request is one argument to exec, even if it contains spaces. Joining the elements with a space separator loses the distinction between spaces in arguments and spaces between arguments.

Suggest shell-quoting/escaping array elements that contain spaces and other special characters, to produce a string that is unambiguous and can be pasted into a shell prompt.

Examples:

command (JSON-encoded) one possible shell-escaped version output
["sh", "-c", "echo $0", "OK"] sh -c "echo \$0" OK
OK
["sh", "-c", "echo $(printf %s \"'\"'\"'\\\\ | md5sum | head -c8)"] sh -c echo\ \$\(printf\ %s\ \"\'\"\'\"\'\\\\\ \|\ md5sum\ \|\ head\ -c8\)
9a33fb47
["sh", "-c", "echo $(printf %s \"'\"'\"'\\\\ | md5sum | head -c8)"] sh -c $'echo $(printf %s \"\'\"\'\"\'\\\\ | md5sum | head -c8)'
9a33fb47
["echo", "*\u0009*"] echo '*\t*'
*    *
Actions

Also available in: Atom PDF