Description of problem:
Commands with arguments containing double quotes run through "scl enable" have the quotes stripped out. This seems to happen during creation of the bash script internally.
This is problematic when passing JSON through as an argument to a command.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create /usr/bin/argprint with the following contents:
for a in "$@"; do echo $a; done
2. scl enable ruby193 -- argprint a '["b"]'
While this is a valid issue and we should indeed wrap the arguments in single quotes instead of double quotes (and escape any inner single quotes), changing the code at this point could break existing scripts that rely on the current behavior for one reason or another. As an example, consider the following command:
# scl enable <collection> -- echo '$PATH'
Currently, this would internally translate into calling
and thus printing the $PATH value as configured within the collection environment.
If we changed the code so that single quotes were used instead, we would translate the arguments into
and thus print the literal $PATH string.
I don't think it's really worth the risk at this point (and this request is a few years old anyway), so I'm closing it now. There surely is a way (yet a bit hacky, admittedly) to achieve the desired result, by escaping the double quotes like this:
# scl enable <collection> -- echo '[\"hello\"]'
*** Bug 1826600 has been marked as a duplicate of this bug. ***