From nobody Sun Feb 8 22:53:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1750167940; cv=none; d=zohomail.com; s=zohoarc; b=MC6+abTxAmM2vZ9FWYlIvjibAJ07CMUNoRaWxL2i4HPa/ZTHnLuTtPebqxoVwq9BKWTXmRZuKrpEf5Yk8gCMObOqirwMdm/v/3DAED9cvYn3gxJZb78mpmcOF3ZKcXS0mUm7o6dDfZ+r25FTxmePzIQBeC/GpVCCntEnGtH0AyU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750167940; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=IRFkX4M/+8/c80BhQ5Rum2N3YYKUxR3KSXkKw7l0yW8=; b=d9f5iUgPMO0uqR+sC7WuOxjNlWIol9XU06+dFABgbMpWb9okjxt+wYFmdBymsVHLdjAG7TxXD3Gmwb/dS0Td2ZElMVNBijgo+lXlqcfUWbGiGwpb4RmecP5PVWiFi8XrigB930T3msG6EvlX0D5wrtMdSRkVJrTRfyBP5l8SiCE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1750167940903343.75942059599015; Tue, 17 Jun 2025 06:45:40 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C1B64B64; Tue, 17 Jun 2025 09:45:39 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 1C32ED47; Tue, 17 Jun 2025 09:44:18 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 324181171; Tue, 17 Jun 2025 09:44:14 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 00AD5C4F for ; Tue, 17 Jun 2025 09:44:08 -0400 (EDT) Received: from mx-prod-mc-04.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-451-ivrQCaGOPSej2S_reL-8qw-1; Tue, 17 Jun 2025 09:44:06 -0400 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 25EE21955F42 for ; Tue, 17 Jun 2025 13:44:06 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.10]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 58B97180035C for ; Tue, 17 Jun 2025 13:44:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1750167848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IoI35iqgwnORnngx4OO2X/ZZbT8v3VQRoLS2Sv+DBcc=; b=DfgtIMUgo6dZs6oCSZmkJx3AQ9qtnjGKK66AbQIomXaaEgYMZ+qLowYRqCfG7mQbAhzHCN yBpqZ3ABFpZHgukJc7YviGXPEeFdLhO1XWFTVrrxxyCCrtjlnOkmXqQv8UiMz9NkNSxCjV kFZTj8V2FqlNvuaLnspxuKtNSeAk11I= X-MC-Unique: ivrQCaGOPSej2S_reL-8qw-1 X-Mimecast-MFC-AGG-ID: ivrQCaGOPSej2S_reL-8qw_1750167846 To: devel@lists.libvirt.org Subject: [PATCH 3/6] virshPrintJobProgress: Don't rewrite migration status line on non-terminals Date: Tue, 17 Jun 2025 15:43:56 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: CJouAZX_tSnHLhEPFDVdM0_gyLH7z6KpOUeBCUhN1Po_1750167846 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: AVRGQFPIJTJREX44VXHFQREUOLZE3SY4 X-Message-ID-Hash: AVRGQFPIJTJREX44VXHFQREUOLZE3SY4 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1750167941341116600 Content-Type: text/plain; charset="utf-8" From: Peter Krempa On non-terminals print each progress report on a new line. Fix based on suggestion in the issue report. Closes: https://gitlab.com/libvirt/libvirt/-/issues/756 Signed-off-by: Peter Krempa --- tools/virsh-domain.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 8d615b6e7a..7253596f4a 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2091,10 +2091,13 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) static void -virshPrintJobProgress(const char *label, unsigned long long remaining, +virshPrintJobProgress(const char *label, + unsigned long long remaining, unsigned long long total) { double progress =3D 100.00; + const char *term_start =3D "\r"; + const char *term_end =3D ""; /* if remaining =3D=3D 0 migration has completed */ if (remaining !=3D 0) { @@ -2106,10 +2109,16 @@ virshPrintJobProgress(const char *label, unsigned l= ong long remaining, } } + if (!isatty(STDERR_FILENO)) { + term_start =3D ""; + term_end =3D "\n"; + } + /* see comments in vshError about why we must flush */ fflush(stdout); /* avoid auto-round-off of double by keeping only 2 decimals */ - fprintf(stderr, "\r%s: [%5.2f %%]", label, (int)(progress*100)/100.0); + fprintf(stderr, "%s%s: [%5.2f %%]%s", + term_start, label, (int)(progress*100)/100.0, term_end); fflush(stderr); } --=20 2.49.0