From nobody Sun Feb 8 17:41:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1690961394; cv=none; d=zohomail.com; s=zohoarc; b=BLkktN0XCaddGv/Q9xPEBuIvmaP1krZVD/Z7jtEW3S8ueTGcSFr/eA4gYuAPdNxwIHCMI3OsL19+82JYavz+JYBnzORltEFgQgoG6F+TffPWwwdbDYLDxvzI0WlpjI75Vw/urfbr3m2U6//PbxLxI+RKggrK3J4p0wET0Fzil00= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690961394; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=i3nPFehnOFJnR5YbAGhngVWkrhhcqT76YHEhr618qu4=; b=H+Zai5VeOJdYE5+OQbQ3sGmFCCuzWyp+mTRX0IBX4O1vSbZnl5EYBdx+IJB3jq+kKcktehAE8we2Bbs9U5bgsWi6UoV3MQ6dV563mr3/HtfmNglyvVm4EzlX/MAnrFCo9YncaRP9XXImVKnj9/ERklJ3oucchvhd3ggQBE8iDXE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1690961394691635.5509324051551; Wed, 2 Aug 2023 00:29:54 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-639-YX3YmhEhNYC0iWifiBqslA-1; Wed, 02 Aug 2023 03:29:50 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3DFD529AA2DE; Wed, 2 Aug 2023 07:29:48 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28CFF40D283C; Wed, 2 Aug 2023 07:29:48 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 90B79194721A; Wed, 2 Aug 2023 07:29:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CC2501946A43 for ; Wed, 2 Aug 2023 07:29:46 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 9E59E112132E; Wed, 2 Aug 2023 07:29:46 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25E9C1121325 for ; Wed, 2 Aug 2023 07:29:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690961392; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=i3nPFehnOFJnR5YbAGhngVWkrhhcqT76YHEhr618qu4=; b=dNIxA+ebWT5gKD+GLiRle67zcmm+kQKT0De/+ZNSxGcu7tnJ33i5zF7Xaj12QVj10kkjTi JuINCSwaXcevFYSsJMfZtbcXAFQkbtSQEUplxUuK4t+pl+i5lqm+vbc56Ba9RCyv07GJco +QSgUrGvlmeiTw7/VxlV7XqCcxLCrdE= X-MC-Unique: YX3YmhEhNYC0iWifiBqslA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/3] virLXCProcessReportStartupLogError: Strip trailing newline from error Date: Wed, 2 Aug 2023 09:29:42 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1690961395000100005 Content-Type: text/plain; charset="utf-8" Since the error message originates from a log file it contains a trailing newline. Strip it as all error handling adds it's own newline. Signed-off-by: Peter Krempa --- src/lxc/lxc_process.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 6b79bd737b..04642b56dd 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -1124,6 +1124,7 @@ virLXCProcessReportStartupLogError(virDomainObj *vm, { size_t buflen =3D 1024; g_autofree char *errbuf =3D g_new0(char, buflen); + char *p; int rc; if ((rc =3D virLXCProcessReadLogOutput(vm, logfile, pos, errbuf, bufle= n)) < 0) @@ -1132,6 +1133,11 @@ virLXCProcessReportStartupLogError(virDomainObj *vm, if (rc =3D=3D 0) return 0; + /* strip last newline */ + if ((p =3D strrchr(errbuf, '\n')) && + p[1] =3D=3D '\0') + *p =3D '\0'; + virReportError(VIR_ERR_INTERNAL_ERROR, _("guest failed to start: %1$s"), errbuf); --=20 2.41.0