From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v2 1/4] qmp client: encode JSON as UTF-8 to fix PBS backup when password contains multi-byte UTF-8
Date: Mon, 9 Mar 2026 14:06:40 +0100 [thread overview]
Message-ID: <20260309130653.90674-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260309130653.90674-1-f.ebner@proxmox.com>
As reported in the community forum, PBS backup of VMs would not work
when the password contained a multi-byte UTF-8 character [0].
The reason is that when writing a string in Perl's internal
representation with character values >= 128 to the QMP socket, QEMU
seems to have a bug where it reads too few characters (one less for
each char value >= 128). In such a case, the QMP client will just time
out, as the command is never completely read on the QEMU side.
Stuffing with additional characters would actually lead to QEMU
reading enough characters and executing the command, but Perl's
internal representation should not be submitted to QMP in the first
place. Encode the JSON properly as UTF-8 to avoid the issue.
In particular, this makes backing up a VM to PBS possible when the PBS
password contains multi-byte UTF-8 characters.
This also fixes future similar issues, for example when a QMP command
is passed a filesystem path with multi-byte UTF-8 characters.
[0]: https://forum.proxmox.com/threads/172871/post-804921
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Unfortunately, doing the same for QGA is not yet enough to fix issue
#6609.
src/PVE/QMPClient.pm | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/PVE/QMPClient.pm b/src/PVE/QMPClient.pm
index 723123a6..3cc5c3c8 100644
--- a/src/PVE/QMPClient.pm
+++ b/src/PVE/QMPClient.pm
@@ -295,12 +295,14 @@ my $check_queue = sub {
. "\n";
} else {
-
- $qmpcmd = to_json({
- execute => $cmd->{execute},
- arguments => $cmd->{arguments},
- id => $cmd->{id},
- });
+ $qmpcmd = to_json(
+ {
+ execute => $cmd->{execute},
+ arguments => $cmd->{arguments},
+ id => $cmd->{id},
+ },
+ { utf8 => 1 },
+ );
}
if ($fd >= 0) {
--
2.47.3
next prev parent reply other threads:[~2026-03-09 13:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 13:06 [PATCH-SERIES qemu-server/storage/common v2 0/4] fix UTF-8 handling for PBS_PASSWORD Fiona Ebner
2026-03-09 13:06 ` Fiona Ebner [this message]
2026-03-09 13:06 ` [PATCH qemu-server v2 2/4] pbs: properly encode PBS password as UTF-8 when setting the environment variable Fiona Ebner
2026-03-09 13:06 ` [PATCH storage v2 3/4] pbs plugin: raw client command: " Fiona Ebner
2026-03-09 13:06 ` [PATCH common v2 4/4] pbs client: allow using password that would be auto-encoded as neither ASCII nor UTF-8 Fiona Ebner
2026-03-09 13:45 ` [PATCH-SERIES qemu-server/storage/common v2 0/4] fix UTF-8 handling for PBS_PASSWORD Maximiliano Sandoval
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=20260309130653.90674-2-f.ebner@proxmox.com \
--to=f.ebner@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox