Passing an array of arrays to run_command will cause each
array to be treated like a command piped to the following
command. Each argument is shell-quoted unless its passed by
reference.
Else we get the following warning:
Subroutine PVE::ProcFSTools::getcwd redefined at /usr/share/perl/5.20/Exporter.pm line 66.
at /usr/share/perl5/PVE/ProcFSTools.pm line 9.
In future, we want to have a separate PVE::CLI::$binname class
for each binary. We can then simply load that class to verify
the API:
use PVE::CLI::pct;
PVE::CLI::pct->verify_api();
or to generate the docs:
PVE::CLI::pct->generate_pod_manpage();
Perl by default interprets + as a parameter prefix, which
means commands like `pct resize 103 rootfs +1G` error with
'Unknown option: 1g', we don't want that.
added 'extra-args' standard option
added 'extra-args' handling to PVE::JSONSchema::get_options
untainting 'extra-args' separately in RESTHandler::handle
We use Net::Ping twice in pve-storage (once for ISCSIPlugin
and once in GlusterfsPlugin, both with the 'tcp' variant.),
but Net::Ping doesn't support IPv6.
The following situations could lead to the 'unknown error':
1) As commented, when the alarm triggered after the first
signal handler was installed and before the new alarm was
installed. In this case the $signalcount was increased,
and worse: the original signal handler was never called.
2) When $code died, since the call itself wasn't in an eval
block, we'd leave the eval block containing the inner alarm
signal handler. Then there's a time window from leaving the
signal block (and with that restoring the first installed
only-counting signal-handler) and reaching the code to
restore the previous alarm where the counting alarm handler
could get triggered by our own alarm set before running
$code. In this case at least the the old alarm would be
restored, but we'd still trigger the 'unknown error'.
The new code starts off by suspending the original alarm
before installing any signal handler, then installing the
timeout handler inside the first eval block. The $code is
then run inside another eval block to make sure we reach the
alarm(0) statement before restoring the old signal handler
and alarm timeout.
Added a generic function to split a host+port string to the
host and port part supporting the two most common ipv6
notations beside domains and ipv4: with brackets for the
address or a dot as port separator.