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.
Bug 1826600 - scl enable rh-python36 -- python in shebang script cut out argument after special chracter like '$'
Summary: scl enable rh-python36 -- python in shebang script cut out argument after spe...
Keywords:
Status: CLOSED DUPLICATE of bug 1248418
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: scl-utils
Version: 7.4
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Packaging Maintenance Team
QA Contact: BaseOS QE - Apps
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-22 04:12 UTC by Park Inseo
Modified: 2020-05-18 15:32 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-18 15:31:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Park Inseo 2020-04-22 04:12:43 UTC
Description of problem:
When python3 script is used with shebang line to rh-python36, argument which includes special chracter $ disappear after '$'


Version-Release number of selected component (if applicable):
20130529-19

How reproducible:
call below test script like :
./test1.py --restpwd '2020U$ser'


test script: test1.py (with chmod +x test1.py)

#!/usr/bin/scl enable rh-python36 -- python3

import argparse
import sys

class MyParser(argparse.ArgumentParser):
    def error(self, message):
        sys.stderr.write('error: %s\n' % message)
        self.print_help()
        sys.exit(2)

def main():
    parser = MyParser()
    parser.add_argument('--restpwd',   required=False, default='rest_passwd', help='provide rest api password')

    print (sys.argv[1:])
    args, unknown = parser.parse_known_args()

    print ("rest pw: " + args.restpwd)


if __name__ == '__main__':
    main()



Steps to Reproduce:
1. run test1.py  : ./test1.py --restpwd '2020U$er'
2. check result
3.

Actual results:
['--restpwd', '2020U']
rest pw: 2020U

Expected results:

['--restpwd', '2020U$er']
rest pw: 2020U$er


Additional info:
All Redhat linux 7.4 ~ 7.7, 7.8 might be affected.

Comment 2 Michal Domonkos 2020-05-18 15:31:38 UTC
This is caused by the fact that scl(8) does not escape the arguments to be passed to the underlying binary with single quotes (so any variables end up being expanded in the environment's context; in this case, $er is interpreted as such a variable).

Unfortunately, while fixing this would be quite easy, now that RHEL-7 is in the Maintenance Support 1 Phase, we can't risk breakage of our customers' scripts that rely on the current behavior, therefore I'm closing this one as a duplicate of another BZ that's also closed (please see the other BZ for more details).

Thank you for your understanding!

*** This bug has been marked as a duplicate of bug 1248418 ***

Comment 3 Michal Domonkos 2020-05-18 15:32:31 UTC
(In reply to Michal Domonkos from comment #2)
> This is caused by the fact that scl(8) does not escape the arguments to be

s/scl(8)/scl(1)/


Note You need to log in before you can comment on or make changes to this bug.