[pve-devel] [PATCH v2 pve-zsync] parse cron: properly split commandline

Fabian Ebner f.ebner at proxmox.com
Tue Feb 22 10:12:29 CET 2022


Reported in the community forum:
https://forum.proxmox.com/threads/105254/

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

Changes from v1:
    * Use shellwords().

 pve-zsync | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pve-zsync b/pve-zsync
index 7246336..46b0ba7 100755
--- a/pve-zsync
+++ b/pve-zsync
@@ -9,6 +9,7 @@ use File::Path qw(make_path);
 use JSON;
 use IO::File;
 use String::ShellQuote 'shell_quote';
+use Text::ParseWords;
 
 my $PROGNAME = "pve-zsync";
 my $CONFIG_PATH = "/var/lib/${PROGNAME}";
@@ -308,8 +309,7 @@ sub parse_cron {
     my $cfg = {};
 
     while (my $line = shift(@text)) {
-
-	my @arg = split('\s', $line);
+	my @arg = Text::ParseWords::shellwords($line);
 	my $param = parse_argv(@arg);
 
 	if ($param->{source} && $param->{dest}) {
-- 
2.30.2






More information about the pve-devel mailing list