Skip to content

Instantly share code, notes, and snippets.

@pa-jberanek
Created December 8, 2020 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pa-jberanek/8942f39573edf6044e42bf8724d657a5 to your computer and use it in GitHub Desktop.
Save pa-jberanek/8942f39573edf6044e42bf8724d657a5 to your computer and use it in GitHub Desktop.
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
)
=====================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment