all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Moayad Almalat <m.almalat@proxmox.com>
Cc: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH manager] fix #3037: include the split_list to shell_qoute
Date: Fri, 20 Jan 2023 14:23:14 +0100	[thread overview]
Message-ID: <20230120132314.oualy2tscwxoh6im@fwblub> (raw)
In-Reply-To: <20230120123823.261828-1-m.almalat@proxmox.com>

On Fri, Jan 20, 2023 at 01:38:23PM +0100, Moayad Almalat wrote:
> By including and using 'split_list' from PVE::Tools we can avoid the null
> (\000) bytes in the shell_quote() function, in which the 'split_list' takes
> a single argument, to return the array format.
> Thanks wolfgang.
> 
> Signed-off-by: Moayad Almalat <m.almalat@proxmox.com>
> ---
>  PVE/CLI/pvesh.pm | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/CLI/pvesh.pm b/PVE/CLI/pvesh.pm
> index 370fdb0e..c28a1588 100755
> --- a/PVE/CLI/pvesh.pm
> +++ b/PVE/CLI/pvesh.pm
> @@ -15,6 +15,7 @@ use PVE::CLIHandler;
>  use PVE::API2Tools;
>  use PVE::API2;
>  use JSON;
> +use PVE::Tools qw(split_list);
>  
>  use base qw(PVE::CLIHandler);
>  
> @@ -106,7 +107,7 @@ sub proxy_handler {
>      my $args = [];
>      foreach my $key (keys %$param) {
>  	next if $key eq 'quiet' || $key eq 'output-format'; # just to  be sure
> -	push @$args, "--$key", $param->{$key};
> +	push @$args, "--$key", $_ for split_list($param->{$key});

Looking at it again I think it might actually make more sense to just
use `split(/\0/, ...)` instead of `split_list()`, since I don't think we
want spaces, commas or semicolons cause splits here.

Given we're in a CLI tool here, I think this will always come as `\0`
separated data initially.

>      }
>  
>      my $remcmd = ['ssh', '-o', 'BatchMode=yes', "root\@$remip",
> -- 
> 2.30.2




      reply	other threads:[~2023-01-20 13:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-20 12:38 Moayad Almalat
2023-01-20 13:23 ` Wolfgang Bumiller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230120132314.oualy2tscwxoh6im@fwblub \
    --to=w.bumiller@proxmox.com \
    --cc=m.almalat@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal