From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25280 invoked by alias); 29 Jun 2011 21:30:17 -0000 Received: (qmail 25272 invoked by uid 22791); 29 Jun 2011 21:30:17 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_FD,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Jun 2011 21:30:03 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5TLU2QA019026 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 29 Jun 2011 17:30:02 -0400 Received: from [10.3.113.74] (ovpn-113-74.phx2.redhat.com [10.3.113.74]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p5TLU2Rc018739 for ; Wed, 29 Jun 2011 17:30:02 -0400 Message-ID: <4E0B9959.6060903@redhat.com> Date: Wed, 29 Jun 2011 21:30:00 -0000 From: Eric Blake User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10 MIME-Version: 1.0 To: cygwin Subject: bug in pipe() and pipe2() OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig3949EC4F562740A3C5F81E2B" X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-06/txt/msg00328.txt.bz2 --------------enig3949EC4F562740A3C5F81E2B Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-length: 1082 I was testing the behavior when pipe() fails, in order to propose an update to POSIX wording: http://austingroupbugs.net/view.php?id=3D467 However, cygwin's pipe implementation dumps core when it runs out of fds, so I could not definitively state whether cygwin properly leaves the fd array unchanged on error, the way Linux does. According to a gdb run and while using stock 1.7.9 cygwin1.dll, the crash is in fhandler_pipe::create(). #define _POSIX_C_SOURCE 200811L #include #include #include #include int main (int argc, char **argv) { int i =3D 0; while (1) { int fd[2] =3D {-2,-3}; int err =3D pipe(fd); if (err) { printf ("iteration %d, pipe returned %d errno %d %s, fds %d %d\n", i, err, errno, strerror(errno), fd[0], fd[1]); break; } i++; } return 0; } Expected behavior is EMFILE and fd unchanged, after however many iterations it takes to reach the ulimit on max fd. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig3949EC4F562740A3C5F81E2B Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" Content-length: 619 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJOC5lZAAoJEKeha0olJ0Nq9p4H/i0CSyHCKNCmu57n9FCk/Y3Z gsQ15Vxj3brofFgG62AiXjRx99ttDKfMr106OOTjlCpasJRf92Wr2BqPU+OxiShD +LNrYVAhZ4v51K3ycAfMi0/TxSaxTXbl9Do3mp+Hv3DFQ7iLW/0KKKdqFCHweF6r hbhiBbzmqEiriZQYFRUmMgB5vTERdZUrgW70+XDj8aAFh2s/X5+p5kh1izjqybXR b8FIwNIB64gkt0qYCZYU/ErLVwqGn0Tu/EGTG/alBC/efpmpqpn29xsPwmXT4qKf xVPxX1FPP1uOswuR+KuJXFJKZoXKahr/z3A1lSj5AX4lXN9x69OFcYc3IunlXo8= =EzQ6 -----END PGP SIGNATURE----- --------------enig3949EC4F562740A3C5F81E2B--