Configurations registered as UTF-8 will be decoded after reading to Perl's internal string format and then contain wide characters. The Digest::SHA::sha1_hex() function croaks on wide characters, so encode again before calling the function if there are wide characters.
Signed-off-by: Fiona Ebner <f.eb...@proxmox.com> --- src/PVE/SectionConfig.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/PVE/SectionConfig.pm b/src/PVE/SectionConfig.pm index 6a297d3..e7dbd4c 100644 --- a/src/PVE/SectionConfig.pm +++ b/src/PVE/SectionConfig.pm @@ -99,6 +99,7 @@ use warnings; use Carp; use Digest::SHA; +use Encode; use PVE::Exception qw(raise_param_exc); use PVE::JSONSchema qw(get_standard_option); @@ -1184,7 +1185,10 @@ sub parse_config { $raw = '' if !defined($raw); - my $digest = Digest::SHA::sha1_hex($raw); + my $bytes = $raw; + $bytes = encode('utf8', $raw) if $raw =~ /[^\x00-\xFF]/; # Digest::SHA croaks on wide characters + + my $digest = Digest::SHA::sha1_hex($bytes); my $pri = 1; -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel