From nobody Thu Apr 18 00:03:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=yadro.com ARC-Seal: i=1; a=rsa-sha256; t=1602165928; cv=none; d=zohomail.com; s=zohoarc; b=ICs3VbJSpdfGrfkPR/zXADnPdBW6b7qzW/1LgvnWECR9EiBeg6a/8vrGbIq6fsaJawzPbtXGN7N1Nv3FA3zxbEl87tgbZrxL1ibHIn5GPG25TygSc5w8C5Xya8TlrcvDxIjQy09005Kbb75lnJkUPGHuU2KAlHPjXSTu9FCfngs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602165928; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=GC/jT+UEWoiGCzJz9iq822Z4Pwf5dm6idrDbTzDi0bg=; b=NM8+bU8BgufvdpG76R8EBA6U/lFXp9rVeFhQsJfPDDb83KUI9ixT87NU9kUS2Ge3FqXQKoXa9dgCKrUn3avFfvSOxmxiFoNkLAIUR4592EShBxvJokahA4MkifcsP708K0Wu83CyZjRvVK9RGdXv9TQsJhc/Z4SbgfwmkaIk/BE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1602165928127157.9460589078186; Thu, 8 Oct 2020 07:05:28 -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-453-N5-ib87qNGqPBdahO3-tag-1; Thu, 08 Oct 2020 10:05:24 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E6E35811064; Thu, 8 Oct 2020 14:05:17 +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 B44A85C1BD; Thu, 8 Oct 2020 14:05:16 +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 1E97C1832FC1; Thu, 8 Oct 2020 14:05:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 098E5DS3014428 for ; Thu, 8 Oct 2020 10:05:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 39CCF10166DC; Thu, 8 Oct 2020 14:05:13 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 35657117DB1D for ; Thu, 8 Oct 2020 14:05:11 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 00AF0805F53 for ; Thu, 8 Oct 2020 14:05:11 +0000 (UTC) Received: from mta-01.yadro.com (mta-02.yadro.com [89.207.88.252]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-228-XndfriYUOMCEE-qlsA6oPQ-1; Thu, 08 Oct 2020 10:05:06 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id BCB44412D0; Thu, 8 Oct 2020 14:05:03 +0000 (UTC) Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9_1ynUiqWLTQ; Thu, 8 Oct 2020 17:05:02 +0300 (MSK) Received: from T-EXCH-04.corp.yadro.com (t-exch-04.corp.yadro.com [172.17.100.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id F147741389; Thu, 8 Oct 2020 17:05:01 +0300 (MSK) Received: from localhost (172.17.204.212) by T-EXCH-04.corp.yadro.com (172.17.100.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Thu, 8 Oct 2020 17:05:01 +0300 X-MC-Unique: N5-ib87qNGqPBdahO3-tag-1 X-MC-Unique: XndfriYUOMCEE-qlsA6oPQ-1 X-Virus-Scanned: amavisd-new at yadro.com From: Roman Bolshakov To: Subject: [PATCH v2] tests: commandhelper: Accept POLLNVAL on macOS Date: Thu, 8 Oct 2020 17:02:08 +0300 Message-ID: <20201008140207.80362-1-r.bolshakov@yadro.com> MIME-Version: 1.0 X-Originating-IP: [172.17.204.212] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-04.corp.yadro.com (172.17.100.104) X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 098E5DS3014428 X-loop: libvir-list@redhat.com Cc: Roman Bolshakov , =?UTF-8?q?J=C3=A1n=20Tomko?= , Andrea Bolognani 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.79 on 10.5.11.16 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 commandhelper hangs indefinitely in poll() on macOS on commandtest test2 and later because POLLNVAL is returned on revents for input file descriptor opened from /dev/null, i.e this hangs: $ tests/commandhelper < /dev/null BEGIN STDOUT BEGIN STDERR ^C But it works fine with regular stdin: $ tests/commandhelper <<< test BEGIN STDOUT BEGIN STDERR test test END STDOUT END STDERR The issue is mentioned in poll(2): BUGS The poll() system call currently does not support devices. With the change all 28 cases in commandtest pass. Signed-off-by: Roman Bolshakov --- Chnges since v1: - Extract expected events into a variable (Andrea) - Provide upstream issue # and fix a typo (J=C3=A1n) tests/commandhelper.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/commandhelper.c b/tests/commandhelper.c index 7c260c4e13..ba5681b715 100644 --- a/tests/commandhelper.c +++ b/tests/commandhelper.c @@ -190,7 +190,17 @@ int main(int argc, char **argv) { } =20 for (i =3D 0; i < numpollfds; i++) { - if (fds[i].revents & (POLLIN | POLLHUP | POLLERR)) { + short revents =3D POLLIN | POLLHUP | POLLERR; + +# ifdef __APPLE__ + /* + * poll() on /dev/null will return POLLNVAL + * Apple-Feedback: FB8785208 + */ + revents |=3D POLLNVAL; +# endif + + if (fds[i].revents & revents) { fds[i].revents =3D 0; =20 got =3D read(fds[i].fd, buf, sizeof(buf)); --=20 2.28.0