From 934790e7d55cdde6ae68e808237effb3e079f64c Mon Sep 17 00:00:00 2001 From: Jonas Jelten Date: Tue, 8 Nov 2022 00:33:10 +0100 Subject: [PATCH] M *-: Use literal heredoc to prevent bash evaluation of stdin data when the stdin of a command contains bash-evaluated characters, execution will fail with funny errors like: ``` bash: line 2: : command not found ``` this patch prevents the bash evaluation through a quoted here-doc word. `man 1 bash` says: > If word is unquoted, all lines of the here-document are subjected to parameter expansion, > command substitution, and arithmetic expansion, the character sequence \ is ignored, > and \ must be used to quote the characters \, $, and `. Signed-off-by: Jonas Jelten (cherry picked from commit beba07c57636a5bc034a279aba06914c57f492ad) --- src/mad/ruby/OpenNebulaDriver.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mad/ruby/OpenNebulaDriver.rb b/src/mad/ruby/OpenNebulaDriver.rb index 379483592b..1281f08b18 100644 --- a/src/mad/ruby/OpenNebulaDriver.rb +++ b/src/mad/ruby/OpenNebulaDriver.rb @@ -108,7 +108,7 @@ class OpenNebulaDriver < ActionManager @timeout) elsif options[:ssh_stream] if options[:stdin] - cmdin = "cat << EOT | #{command}" + cmdin = "cat << 'EOT' | #{command}" stdin = "#{options[:stdin]}\nEOT\n" else cmdin = command