From nobody Thu Apr 25 11:22:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549379817777918.775410440202; Tue, 5 Feb 2019 07:16:57 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6F9DAA7E9; Tue, 5 Feb 2019 15:16:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0B0D45B6B0; Tue, 5 Feb 2019 15:16:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7ECDD3F7D5; Tue, 5 Feb 2019 15:16:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15FGXwx005636 for ; Tue, 5 Feb 2019 10:16:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0ABD61001F4D; Tue, 5 Feb 2019 15:16:33 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8530C1048130 for ; Tue, 5 Feb 2019 15:16:29 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 5 Feb 2019 16:16:21 +0100 Message-Id: <20190205151623.7395-2-abologna@redhat.com> In-Reply-To: <20190205151623.7395-1-abologna@redhat.com> References: <20190205151623.7395-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] vircommand: Ensure buffers are NULL-terminated X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 05 Feb 2019 15:16:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The memory allocated by VIR_REALLOC_N() is uninitialized, which means it's not possible to figure out whether any output was produced at all after the fact. Signed-off-by: Andrea Bolognani --- src/util/vircommand.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/util/vircommand.c b/src/util/vircommand.c index d965068369..6e9e56d0c0 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -2057,11 +2057,13 @@ virCommandProcessIO(virCommandPtr cmd) outfd =3D cmd->outfd; if (VIR_REALLOC_N(*cmd->outbuf, 1) < 0) ret =3D -1; + *cmd->outbuf[0] =3D '\0'; } if (cmd->errbuf) { errfd =3D cmd->errfd; if (VIR_REALLOC_N(*cmd->errbuf, 1) < 0) ret =3D -1; + *cmd->errbuf[0] =3D '\0'; } if (ret =3D=3D -1) goto cleanup; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 11:22:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549379801458277.23066264076147; Tue, 5 Feb 2019 07:16:41 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6BAEDC057E16; Tue, 5 Feb 2019 15:16:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E3BD1898C; Tue, 5 Feb 2019 15:16:39 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6EC43180339F; Tue, 5 Feb 2019 15:16:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15FGbrk005647 for ; Tue, 5 Feb 2019 10:16:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5998A104810C; Tue, 5 Feb 2019 15:16:37 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D272F100194A for ; Tue, 5 Feb 2019 15:16:33 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 5 Feb 2019 16:16:22 +0100 Message-Id: <20190205151623.7395-3-abologna@redhat.com> In-Reply-To: <20190205151623.7395-1-abologna@redhat.com> References: <20190205151623.7395-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] virfile: Report error in virFileWrapperFdFree() X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 05 Feb 2019 15:16:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Logging the error is fine and all, but getting the information to the user directly is even better. https://bugzilla.redhat.com/show_bug.cgi?id=3D1578741 Signed-off-by: Andrea Bolognani --- src/util/virfile.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/util/virfile.c b/src/util/virfile.c index 271bf5e796..30cad87df9 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -351,8 +351,12 @@ virFileWrapperFdFree(virFileWrapperFdPtr wfd) if (!wfd) return; =20 + /* If the command used to process IO has produced errors, it's fair + * to assume those will be more relevant to the user than whatever + * eg. QEMU can figure out on its own, so it's okay if we end up + * discarding an existing error */ if (wfd->err_msg && *wfd->err_msg) - VIR_WARN("iohelper reports: %s", wfd->err_msg); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", wfd->err_msg); =20 virCommandAbort(wfd->cmd); =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 11:22:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549379816503633.2294254971471; Tue, 5 Feb 2019 07:16:56 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4AB94C057F8F; Tue, 5 Feb 2019 15:16:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E86EB7C0AE; Tue, 5 Feb 2019 15:16:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 5021818033A5; Tue, 5 Feb 2019 15:16:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x15FGep0005657 for ; Tue, 5 Feb 2019 10:16:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id C3D9C104811A; Tue, 5 Feb 2019 15:16:40 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6E17A1001F4D for ; Tue, 5 Feb 2019 15:16:37 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 5 Feb 2019 16:16:23 +0100 Message-Id: <20190205151623.7395-4-abologna@redhat.com> In-Reply-To: <20190205151623.7395-1-abologna@redhat.com> References: <20190205151623.7395-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] iohelper: Don't include newlines in error messages X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 05 Feb 2019 15:16:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The newline was pretty arbitrary, and we're better off without it. Signed-off-by: Andrea Bolognani --- src/util/iohelper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/iohelper.c b/src/util/iohelper.c index 1ff4a7b314..aed7ef3184 100644 --- a/src/util/iohelper.c +++ b/src/util/iohelper.c @@ -236,7 +236,7 @@ main(int argc, char **argv) return 0; =20 error: - fprintf(stderr, _("%s: failure with %s\n: %s"), + fprintf(stderr, _("%s: failure with %s: %s"), program_name, path, virGetLastErrorMessage()); exit(EXIT_FAILURE); } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list