[pve-devel] [PATCH pve-zsync 2/2] parse cron: handle additional whitespace

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Feb 21 16:05:59 CET 2022


On 21.02.22 10:07, Fabian Ebner wrote:
> Can only happen by manually editing AFAICT, but cron does execute the
> jobs, so just be a bit less restrictive when parsing.

I mean, it won't get more broken as already but can we avoid white-space splitting
on command arguments in general?

We could use the same underlying helper as PVE::Tools::split_args uses,
Text::ParseWords::shellwords (included in perl-modules directly)..

> 
> Reported in the community forum:
> https://forum.proxmox.com/threads/105254/
> 
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
>  pve-zsync | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/pve-zsync b/pve-zsync
> index 7246336..f69e126 100755
> --- a/pve-zsync
> +++ b/pve-zsync
> @@ -308,8 +308,7 @@ sub parse_cron {
>      my $cfg = {};
>  
>      while (my $line = shift(@text)) {
> -
> -	my @arg = split('\s', $line);
> +	my @arg = split('\s+', $line);
>  	my $param = parse_argv(@arg);
>  
>  	if ($param->{source} && $param->{dest}) {






More information about the pve-devel mailing list