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 \<newline> is ignored,
> and \ must be used to quote the characters \, $, and `.

Signed-off-by: Jonas Jelten <jj@sft.lol>
(cherry picked from commit beba07c576)
This commit is contained in:
Jonas Jelten authored and Ruben S. Montero committed 2022-11-28 11:25:08 +01:00
1 parent c115b36328
commit 934790e7d5
1 file changed
+1 -1
+1 -1
View File
@@ -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