Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
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):
scl-utils-20130529-17.el7
How reproducible:
Always
Steps to Reproduce:
1. Create /usr/bin/argprint with the following contents:
#!/bin/bash
for a in "$@"; do echo $a; done
2. scl enable ruby193 -- argprint a '["b"]'
Actual results:
a
[b]
Expected results:
a
["b"]
Additional info:
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
echo "$PATH"
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
echo '$PATH'
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\"]'
["hello"]