So, just discovered what looks like a bug in the 'scl' wrapper with handling 
double-quote (at least) characters in command parameters. This is with:

scl-utils-20130529-19.el7.x86_64

Given the test scripts:

===============test.pl======================
#!/usr/bin/perl

print "SCL wrapper\n===============\n";

system(
       'scl',
       'enable',
       'rh-php72',
       '--',
       'php',
       'test.php',
       '"hello world"'
      );

system(
       'scl',
       'enable',
       'rh-php72',
       '--',
       'php',
       'test.php',
       'another"test'
      );

print "\nWithout wrapper\n===============\n";

system(
       '/opt/rh/rh-php72/root/bin/php',
       'test.php',
       '"hello world"'
      );

system(
       '/opt/rh/rh-php72/root/bin/php',
       'test.php',
       'another"test'
      );
===================================================

==============test.php==============================
<?php
print("\$argv:\n");
print_r($argv);
?>
===================================================

This is the rather unexpected output:

===================================================
$ ./test.pl
SCL wrapper
===============
$argv:
Array
(
    [0] => test.php
    [1] => hello
    [2] => world
)
/var/tmp/sclbhWRnY: line 8: unexpected EOF while looking for matching `"'
/var/tmp/sclbhWRnY: line 9: syntax error: unexpected end of file

Without wrapper
===============
$argv:
Array
(
    [0] => test.php
    [1] => "hello world"
)
$argv:
Array
(
    [0] => test.php
    [1] => another"test
)
=====================================================

All the above available in a gist, in case it's hard to read from the list post:
https://gist.github.com/pa-jberanek/8942f39573edf6044e42bf8724d657a5

Cheers,

John

--
John Beranek

This email is from the PA Media Group. For more information, see 
www.pamediagroup.com. This email may contain confidential information. Only the 
addressee is permitted to read, copy, distribute or otherwise use this email or 
any attachments. If you have received it in error, please contact the sender 
immediately. Any opinion expressed in this email is personal to the sender and 
may not reflect the opinion of the PA Media Group. Any email reply to this 
address may be subject to interception or monitoring for operational reasons or 
for lawful business practices.


_______________________________________________
SCLorg mailing list
SCLorg@redhat.com
https://www.redhat.com/mailman/listinfo/sclorg

Reply via email to