[pve-devel] [PATCH] Patch for UTF8 encoding in Tools.pm

James Brown randomvoidmail at foxmail.com
Sun Oct 13 12:26:43 CEST 2024


Do you mean if I operate this within the ESXi file reading sub block then it would be fine?


How about putting these lines on top of /usr/share/perl5/PVE/Storage/ESXiPlugin.pm?


Or just within "get_manifest" and  "get_import_metadata" sub blocks in ESXiPlugin.pm?



---Original---
From: "Thomas Lamprecht"<t.lamprecht at proxmox.com>
Date: Wed, Oct 9, 2024 14:10 PM
To: "James Brown"<randomvoidmail at foxmail.com>;"pve-devel"<pve-devel at lists.proxmox.com>;
Subject: Re: [pve-devel] [PATCH] Patch for UTF8 encoding in Tools.pm


Am 09/10/2024 um 02:45 schrieb James Brown:
> From 8ed0c20251c464a058ea08872bc7d54f6701d912 Mon Sep 17 00:00:00 2001
> From: James Brown <randomvoidmail at foxmail.com>
> Date: Wed, 9 Oct 2024 08:40:10 +0800
> Subject: [PATCH] Add UTF8 encoding
> 

Please provide some actual commit message for why this is done, and evaluating
the actual fall out of the change.

> ---
>  src/PVE/Tools.pm | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> 
> diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm
> index bd305bd..cf86a0e 100644
> --- a/src/PVE/Tools.pm
> +++ b/src/PVE/Tools.pm
> @@ -3,6 +3,10 @@ package PVE::Tools;
>  use strict;
>  use warnings;

the patch is broken, please submit it with a mail user agent that does not
messes with whitespace, if in doubt use git send-email [0].

[0]: https://git-send-email.io/
 
> +use open qw(:std :utf8);

that can have lots of fallout, or did you check all sites using PVE::Tools and
opening files to ensure that all definitively will write valid UTF-8 only?

> +use Encode qw(decode_utf8);
> + at ARGV = map { decode_utf8($_, 1) } @ARGV;

why are you re-encoding the system argument list in some library module?!
That is really a no-go, this must stay in the control of the actual executable.

> +
>  use Date::Format qw(time2str);
>  use Digest::MD5;
>  use Digest::SHA;
> --
> 2.34.1


More information about the pve-devel mailing list