delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/09/25/15:59:52

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type; q=dns; s=default; b=QNyLKY
JhgA3yZ9erhOkct38VqEDGQdOiKyJhkuRYTjv5HqIreLG4EEWHMh/ODwFUPBS+cR
TpuXYOgLpt6kclsA6tG2hYNmhfe9cGSj9Ljs0D2rnzq0+jzhd3yYKZhOHw1DlHBd
iqcmjKlK8geVVqa8g8esOg5erjjt1FRtyq0Io=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type; s=default; bh=6pbAjvu+JXB1
Okb6LLrYdPhb8FE=; b=HjSc8hQBzuykj7VZT1HGC+DHAjtSxl+XXxLMppsY+cdm
meyxUD9jVOVwwR8aQ6oIa380VzpaDZQR6uvYKc7LGZBEtpEu4TrC+Zydsf/zN9li
Og11fT8ObXcTQ2rB5IcOyAA7xn4aWKF+2KKNMVXLNC6KCLmUZcTcg9uBw2LVszM=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2
X-HELO: mx1.redhat.com
Message-ID: <524340A7.8050703@redhat.com>
Date: Wed, 25 Sep 2013 13:59:35 -0600
From: Eric Blake <eblake AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: [PATCH] tests: don't assume getdtablesize () <= 10000000
References: <517EF2F1 DOT 2030802 AT cs DOT ucla DOT edu> <5241DBE6 DOT 4000007 AT redhat DOT com> <20130925043225 DOT GB1192 AT ednor DOT casa DOT cgf DOT cx> <5242D173 DOT 2020901 AT redhat DOT com> <20130925150416 DOT GB3361 AT ednor DOT casa DOT cgf DOT cx> <52430E95 DOT 1080208 AT redhat DOT com>
In-Reply-To: <52430E95.1080208@redhat.com>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
X-IsSubscribed: yes

--ae6EORWn39ntFL1aLkOegUevgFOW1Imor
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 09/25/2013 10:25 AM, Eric Blake wrote:
> On 09/25/2013 09:04 AM, Christopher Faylor wrote:
>>
>> Since you've previously made modifications in this area, why not supply
>> a simple patch?
>=20
> Ah - the joys of having write access.  Yes, I'll post a patch for
> discussion.

What am I getting myself into?

$ cat foo.c
#include <stdio.h
#include <unistd.h>
int main(int argc, char **argv) {
  printf ("%d ", getdtablesize());
  if (argc > 1)
    printf ("%d ", dup2 (0, getdtablesize() - 1));
  printf ("%d\n", dup2 (0, getdtablesize()));
  return 0;
}
$ gcc -o foo -Wall -g foo.c
$ ./foo
Segmentation fault (core dumped)
$ strace -o /dev/null ./foo
256 256

Heisenbug!  The very act of trying to trace it makes it disappear :(

$ ./foo 1
Segmentation fault (core dumped)
$ strace -o /dev/null ./foo 1
  22687 [main] foo 2020 open_stackdumpfile: Dumping stack trace to
foo.exe.stackdump

probably some off-by-one at a boundary case, but not as simple as I had
originally hoped it would be.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--ae6EORWn39ntFL1aLkOegUevgFOW1Imor
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEbBAEBCAAGBQJSQ0CnAAoJEKeha0olJ0NqJt4H+LfOidGKC/2kGfhzeHBLTdX2
ByCM1QVEVLM9vRnnRFgIKxRvQ0Pre0Zx0YNsX19ENu0F3UpxHvohqkpm/E5Rishm
V9X6s05ROZqw348DyJZagUbCNg8ppP2gqkzE5MKhYOYry0wSmU8IqRTBqQbJPK40
YjzoZ8+kgiYUVqsau04agWsiiziDKxCYhG63cY5Tw3z8iTNT1YrYZvuBv9M2vsdC
eh2CgxHorv0SYj6ax/MvOHyZg9iCW2843ojy3Bb9xC2I2Hdy3dz4we8xEo9JFeDq
O7Vfd35ARS6kYgaQ/RvD/w+orKV+pC+tETqO4WXtN4uNty/bnXd6iNoGdkL/Ng==
=R+0i
-----END PGP SIGNATURE-----

--ae6EORWn39ntFL1aLkOegUevgFOW1Imor--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019