From nobody Tue Mar 24 00:56:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1772733056; cv=none; d=zohomail.com; s=zohoarc; b=kTTngFyfVEHcW3rKoPmwmtn1nXRHOlAiZYhbUxI/3lVD47Uo+cPKsR35Y7aUHi2i2i5Zz6A8hi2aOST9VmX/bBV/PhDIAEJ2DZLuqf93Uh4ostup9m3nKiHiIFJsAAs8RxcEGIuWfzDhiJlT2GA0EX1PG1Rp7wLUR1kHVqbtwEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772733056; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=JKT2uXZ9IPbp+nH7ZQ7kgddtWf6rY1l9xOVO64XHbN8=; b=IAhgPAt6pbl90/6ianFhHefP/vkIVaZ80WfjKr1TimcQnsAwe1o4FiSuf38eSaLfLZAMIOvPjatSDUGoUpkyIE1nPdbnE1aoqv6w7ONuNV1/hrMMY6FWSYHUs9FiQIytaLagqBv+0sz4XDEu7YzKwQFW3znwdJiRPwrnoRtUwT8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1772733056626602.0690262358856; Thu, 5 Mar 2026 09:50:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vyCqX-0007Wb-C8; Thu, 05 Mar 2026 12:50:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vyCpu-0006C9-Op for qemu-devel@nongnu.org; Thu, 05 Mar 2026 12:50:11 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vyCpr-0002XI-K4 for qemu-devel@nongnu.org; Thu, 05 Mar 2026 12:50:09 -0500 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-5B12E497PYeOaHtG3cbE5Q-1; Thu, 05 Mar 2026 12:50:03 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1CC4F1956089; Thu, 5 Mar 2026 17:50:02 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.44.34.61]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 24F3D1956095; Thu, 5 Mar 2026 17:49:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1772733006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JKT2uXZ9IPbp+nH7ZQ7kgddtWf6rY1l9xOVO64XHbN8=; b=hU3TGTT4iiZtF5rqYsCeyisCBc99GfYKZ1eyE4O1og0bAe7T/0CrqxmqghF+IKj17e21aa jwBI1kKFp8SXPp10rvC9mdiHD/VNxVLfyod5dyXH00M1fGCJIP9tXkAetClXN5Vb2F7QOF +gEa5JdZaQuC4z+guwq/afhjiksb/Uw= X-MC-Unique: 5B12E497PYeOaHtG3cbE5Q-1 X-Mimecast-MFC-AGG-ID: 5B12E497PYeOaHtG3cbE5Q_1772733002 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , devel@lists.libvirt.org, qemu-rust@nongnu.org, "Dr. David Alan Gilbert" , Gerd Hoffmann , Christian Schoenebeck , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Manos Pitsidianakis , Eduardo Habkost , Pierrick Bouvier , Paolo Bonzini , Stefan Weil Subject: [PULL 24/27] util: don't skip error prefixes when QMP is active Date: Thu, 5 Mar 2026 17:47:40 +0000 Message-ID: <20260305174743.3084606-25-berrange@redhat.com> In-Reply-To: <20260305174743.3084606-1-berrange@redhat.com> References: <20260305174743.3084606-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -5 X-Spam_score: -0.6 X-Spam_bar: / X-Spam_report: (-0.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.892, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.622, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1772733059569154100 The vreport() function will print to HMP if available, otherwise to stderr. In the event that vreport() is called during execution of a QMP command, it will print to stderr, but mistakenly omit the message prefixes (timestamp, guest name, program name). This new usage of monitor_is_cur_qmp() from vreport() requires that we add a stub to satisfy linking of non-system emulator binaries. Signed-off-by: Daniel P. Berrang=C3=A9 --- stubs/monitor-core.c | 5 +++++ tests/unit/test-util-sockets.c | 1 + util/error-report.c | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c index a7c32297c9..078a5012e9 100644 --- a/stubs/monitor-core.c +++ b/stubs/monitor-core.c @@ -7,6 +7,11 @@ Monitor *monitor_cur(void) return NULL; } =20 +bool monitor_cur_is_qmp(void) +{ + return false; +} + Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) { return NULL; diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c index ee66d727c3..b9f2453e29 100644 --- a/tests/unit/test-util-sockets.c +++ b/tests/unit/test-util-sockets.c @@ -74,6 +74,7 @@ int monitor_get_fd(Monitor *mon, const char *fdname, Erro= r **errp) Monitor *monitor_cur(void) { return cur_mon; } Monitor *monitor_set_cur(Coroutine *co, Monitor *mon) { abort(); } int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) { abort(); } +bool monitor_cur_is_qmp(void) { abort(); }; =20 #ifndef _WIN32 static void test_socket_fd_pass_name_good(void) diff --git a/util/error-report.c b/util/error-report.c index f666ca4149..6b9e592bc1 100644 --- a/util/error-report.c +++ b/util/error-report.c @@ -226,6 +226,14 @@ static void vreport(report_type type, const char *fmt,= va_list ap) Monitor *cur =3D monitor_cur(); gchar *timestr; =20 + /* + * When current monitor is QMP, messages must go to stderr + * and have prefixes added + */ + if (monitor_cur_is_qmp()) { + cur =3D NULL; + } + if (message_with_timestamp && !cur) { timestr =3D real_time_iso8601(); fprintf(stderr, "%s ", timestr); --=20 2.53.0