From nobody Mon Apr 29 23:12:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1600709846; cv=none; d=zohomail.com; s=zohoarc; b=QsLV6Xb5p186HvJz9aI01h9pbmQOvmzRL6GC8SLfW5DQ2n23lRoPQgOyzDjXvC8BoRrZ63dwCM1jYK+7EnmLm73XOZv7ffLtT5qps/MwNsn7CezdmMQkhBn1Cmmrc1Ev9nM6zcKalyL0roIp1SCz08Y9MpMaIkr/S50rbp+mLss= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1600709846; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=rqKa8zw2w6cQvVnBTDmxu2P0RIzhI6Y9d6XaADRvNJ4=; b=YF5rgHdzFcmGweDDCdcL3PjPSgevqoWsjnzDJwLJhliWdu1XxQyeiV7Qb1b+S6+oadYrDTJ75o+tKzmrkUtpbAttBzM4VGb82yNyfZX5eoMR0ThixBGKm5VC8tMfjpPZbtgabDh50hLOOna+SDYRswf9hU200ybdXyshU5FWh+s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1600709846004521.2433030421739; Mon, 21 Sep 2020 10:37:26 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-3--Z88ZtwHNlK0mbaSoACmDA-1; Mon, 21 Sep 2020 13:37:21 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 236611074656; Mon, 21 Sep 2020 17:37:15 +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 736F610013BD; Mon, 21 Sep 2020 17:37:12 +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 AD3AA8C7AA; Mon, 21 Sep 2020 17:37:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08LHaw6I020261 for ; Mon, 21 Sep 2020 13:36:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5EA0D513F0; Mon, 21 Sep 2020 17:36:58 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-113-113.ams2.redhat.com [10.36.113.113]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89CC75C1DC; Mon, 21 Sep 2020 17:36:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600709844; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rqKa8zw2w6cQvVnBTDmxu2P0RIzhI6Y9d6XaADRvNJ4=; b=Kjt0llI59fh3Yu4PIDUH0fK74qNxRF9bGIboqshj0IVlguRlFpkdaLAFYXcJXw021JnxBe p9DJxy5JFt240G8JZ26J0nsO9oFniFMIZUYTPjP2RJQA4N7dTcLYgs2uJ3/1ZukMderVgr VvzAl02o88JBm5clp0C2cKxs/PhZKPM= X-MC-Unique: -Z88ZtwHNlK0mbaSoACmDA-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH] tests: don't mix FILE* and UNIX FD I/O on same stream Date: Mon, 21 Sep 2020 18:36:53 +0100 Message-Id: <20200921173653.1986867-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) There is currently a hand in test27 that exhibits itself on FreeBSD 11.4 only. The behaviour is that virCommandProcessIO gets POLLIN on the FD for stdout, but read() blocks. Meanwhile commandtest also blocks in write for stderr because the pipe buffers are full. This fix in commandhelper likely does not really address the root cause just hides it due to the buffering done by FILE *. Mixing UNIX FD I/O and FILE * I/O is bad practice regardles. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Eric Blake --- tests/commandhelper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/commandhelper.c b/tests/commandhelper.c index 05f577730f..7c260c4e13 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -221,9 +221,9 @@ int main(int argc, char **argv) { } =20 for (i =3D 0; i < numpollfds; i++) { - if (write(STDOUT_FILENO, buffers[i], buflen[i]) !=3D buflen[i]) + if (fwrite(buffers[i], 1, buflen[i], stdout) !=3D buflen[i]) goto cleanup; - if (write(STDERR_FILENO, buffers[i], buflen[i]) !=3D buflen[i]) + if (fwrite(buffers[i], 1, buflen[i], stderr) !=3D buflen[i]) goto cleanup; } =20 --=20 2.26.2