delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/01/16/03:50:49

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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=i5UM6s0WZQzxQpELPC44clP3GcWj2dO2xLde7Rf9rWdGdjfojo8RO
effb2Ui7HcAtiMiPvFYxPXLvdVUkj41DIlC7jMdbyTUJppvoiluSDuCRm9qV+j1k
NSAGfRiTYNsFZJUWRhKk9U/qwhtImEIChvLCYlgmfq6gPIl0qDvjE8=
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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=3s/YgCu1e1MbKo/0rCnSl6K7rr8=; b=Iw8VyqTxE5WdotCwrCGuwXfikM0C
HGUchavN7tU50AtpYhsi7o8ZIF4u29YIzZOdJ9f60WYhzai3wFRk6ywKhi3Ql9L9
PpZlLJsFK+Ov2v9TV/TfAuMbFH8nI4H8eceluww4NG5610CR7qhsbjN4u+WAyXog
FjRBUjxEnnnzigM=
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=-6.0 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Thu, 16 Jan 2014 09:50:26 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: fork() + file descriptor bug in 1.7.27(0.271/5/3) 2013-12-09 11:54
Message-ID: <20140116085026.GA26205@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <831845 DOT 98759 DOT bm AT smtp116 DOT sbc DOT mail DOT ne1 DOT yahoo DOT com> <52D55D96 DOT 8070407 AT redhat DOT com> <946338 DOT 89157 DOT bm AT smtp116 DOT sbc DOT mail DOT ne1 DOT yahoo DOT com> <CAG9p0OR8JYgC1rzBCn1bvXe5ffpJS3vpmnnxw-7brJi8E8+uhQ AT mail DOT gmail DOT com> <52D63CE2 DOT 9060308 AT lysator DOT liu DOT se> <858084 DOT 71265 DOT bm AT smtp116 DOT sbc DOT mail DOT ne1 DOT yahoo DOT com> <20140115163354 DOT GA30234 AT calimero DOT vinschen DOT de> <670957 DOT 90887 DOT bm AT smtp117 DOT sbc DOT mail DOT ne1 DOT yahoo DOT com>
MIME-Version: 1.0
In-Reply-To: <670957.90887.bm@smtp117.sbc.mail.ne1.yahoo.com>
User-Agent: Mutt/1.5.21 (2010-09-15)

--BXVAT5kNtrzKuDFl
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jan 15 23:42, tednolan AT bellsouth DOT net wrote:
> >> FWIW, FreeBSD, Linux and Solaris all compile and run the test program
> >> with the behavoir I expect..
> >
> >Just for completeness:  I can test on Linux, but not on FreeBSD and
> >Solaris.  Does the testcase also work as expected on both of them,
> >after you added fclose to the child?  On Linux it does.
> >
> >
> >Thanks,
> >Corinna
> >
>=20
> Well, it appears I spoke too soon about Solaris.  I saw that it terminated
> rather than running forever, and assumed it was working correctly.
> That turns out not to be the case: For 3 lines in the input file, it some=
how
> gets up to 8 processes before terminating.
>=20
> Here's what I can say per OS:
>=20
> FreeBSD 4.9
> FreeBSD 8.1
> FreeBSD 9.1
>=20
> 	Original test case works.
> 	Test case with fclose() works
> 	Test case with _exit() instead of exit() works
>=20
> Solaris 9:
>=20
> 	Original test case fails (but terminates)
> 	Test case with fclose() fails
> 	Test case with _exit() instead of exit() works
>=20
> Cygwin:
> 	Original test case fails (never terminates)
> 	Test case with fclose() fails
> 	Test case with _exit() instead of exit() works
>=20
> Gentoo Linux:
> 	Original test case works
> 	Test case with fclose() -- don't have access right now
> 	Test case with _exit() instead of exit() -- don't have access rght now

Can you change your testcase another bit, please?  Enable your
`ftell' printf, but rather than printing the result of ftell,
print the result of lseek:

  fprintf(stderr, "(%s) (%s) %d %ld\n", infile,
        outfile, i, lseek(fileno(fp), 0, SEEK_CUR));

I would be curious what happens on Solaris here.

> So, as per other posters, exit() is wrong and should be _exit().  I accept
> that, and will fix it, but it still seems to be that the Linux and FreeBSD
> behavior is better here.  If the spec allows "spooky action at a distance=
",
> that's not the same as encouraging it..

Well, not quite.  In theory, Linux is our role model for this kind of
behaviour, so I would opt for changing that to follow Linux.  It's an
easy patch, but it's a bit dangerous, because the code in question is
shared with newlib, so a change affects a lot of other targets as well.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--BXVAT5kNtrzKuDFl
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJS151SAAoJEPU2Bp2uRE+g8dAP/24AhZKhvYOjuF3k7p2OYOws
5qaCTZ/B3TI+jbJp2K/N2zDuebvA3RUU1CN+CdvJcuY9sIzHyjWeetdlpuTkb79V
lcCzFBBHl9mcqGO6yiTpb2wsejC7VSojyEsFKuoRu9Dl+vTA74e/DmanGt+WZY0z
blCXt/CE9+Oo1XwtCB1FDBCKUJa11JIMwBpwk1nNjqsihB/peD3fgCcg4U1ThRnf
Pkw/myRz56iQbGw4v4lxB59TSYrbh8q0uxxWt4C2dC+wcMsK7i+4XPRJuiOvyy6f
YDW6S5DUqx2MeSv4qJT9R0W+oH5gxvE1qGOKQFiRlVLUJlijGxrMUXa7rx6oCcIX
RKYGvdv5eIrWAO2IJBSiXTb3fo1nSDRIfMUszZT+fD/myUS3Gn5ppmw973va0bbn
D5stmU0R9rdocsEYkiR+UpSP9I4Ik0y0YICG1Ma8Hg7cTbBtuwkUqV6G8elqFBVA
Ec69aQrPE5odmOXeV+NMN12KsK1gDgH57i87KuqwZWyORCg0lIvN1qHvAhmAYUCW
GMzOr9PqMR8GBuxL1Zb131ZqYDY6g7AZBB2f0CNOCSEpOAdHDbVFj53ui1425kti
FHKIUKQ7qSqANVNCnGhSucR2xmTTOZJivhGk05bDU6Ny0oKW+Ac5fci+q2ae/fti
k5WO+yA72kM9/h1lE+0d
=846I
-----END PGP SIGNATURE-----

--BXVAT5kNtrzKuDFl--

- Raw text -


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