]> git.proxmox.com Git - pve-cluster.git/commitdiff
cfs_write_file: fix accidental UTF-8 re-encoding
authorFiona Ebner <f.ebner@proxmox.com>
Tue, 9 Jan 2024 11:55:07 +0000 (12:55 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 16 Jan 2024 10:23:04 +0000 (11:23 +0100)
by correclty passing the $force_utf8 flag to
PVE::Tools::file_set_contents(). The idea was that only callers that
are ready will opt-in to the behavior.

When reading files with PVE::Tools::file_get_contents() or
ipcc_get_config(), the UTF-8 flag on the Perl string is not set, even
if the data is UTF-8. Such data would then be encoded a second time,
as reported in the community forum [0] and bug tracker [1].

[0]: https://forum.proxmox.com/threads/139282/
[1]: https://bugzilla.proxmox.com/show_bug.cgi?id=1909#c1

Fixes: 90c824b ("cluster fs: allow to force UTF-8 encoding for cfs_write_file")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Filip Schauer <f.schauer@proxmox.com>
src/PVE/Cluster.pm

index 4c828c185f4c82e4cad654d5f7ddaff4cbaa096b..f899dbecae923c577ddc6473cc933abbb4e89d95 100644 (file)
@@ -594,7 +594,7 @@ sub cfs_write_file {
        $ci->{version} = undef;
     }
 
-    PVE::Tools::file_set_contents($fsname, $raw, undef, 1);
+    PVE::Tools::file_set_contents($fsname, $raw, undef, $force_utf8);
 }
 
 my $cfs_lock = sub {