delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/01/14/05:18:44

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=YxkZPw1m/nXypkiHQnj9i2f6O8xhcMtNZRt80ooAP2OoQudkJt9ig
IG2LvvF0SP58fejJzKP2c62OSWaeq33agc59m6/409TqeUdwTZ5Q+wEIPvBx8qOM
qN5aLNB1kC3xnglXLsHNycIoRpngaL8kYVFvdjKceD7gkZfJVT6WP0=
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=k2NomY3uW5E4xapVpqVqvKI/8uM=; b=RFWN6fuLc4EBndoXCHr3boEfjrSo
IwBk1K7ZWOIHUVnchN3EJzNPfzptxHV56X6VQbQ7/aHHuveXN8mKkN6rz9V2opXZ
EiYEwW5IHA2BE7DNdVYFij9mi1B+tkZE1hZVyCLKPUoB8XVcpSytrD2/zuH3pC6C
FfkQH5UUaA14iSM=
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=0.9 required=5.0 tests=AWL,BAYES_50 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Tue, 14 Jan 2014 11:18: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: <20140114101826.GC2380@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>
MIME-Version: 1.0
In-Reply-To: <831845.98759.bm@smtp116.sbc.mail.ne1.yahoo.com>
User-Agent: Mutt/1.5.21 (2010-09-15)

--f+W+jCU1fRNres8c
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jan 13 11:06, tednolan AT bellsouth DOT net wrote:
> Hello,
>=20
> I'm running:
>=20
> CYGWIN_NT-6.1 prog5 1.7.27(0.271/5/3) 2013-12-09 11:54 x86_64 Cygwin
> gcc (GCC) 4.8.2
>=20
> on a 64 bit Win7 system.
>=20
> I have just run into an odd bug, which I have boiled down into the program
> below (which started as a mod to tiff2ps).
>=20
> If you compile this program:
>=20
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3DCUT HERE=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> [...]
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3DEnd code=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>=20
> and run it with this data:
>=20
> 00.tif  00.eps
> 01.tif  01.eps
> 02.tif  02.eps
>=20
> It will run forever.
>=20
> However, if you uncomment the fprintf with the ftell(), it runs as
> expected.

Alternatively it runs as expected when dropping the fork() call.  I'm
totally baffled, especially because this is such a blatant misbehaviour
that it should have been found much earlier.  I ran your testcase under
Cygwin versions from 2010, and the problem showed up, too, so this
problem is not exactly new.

I tried to debug it a bit already and for some reason the *Windows* call
reading the input file always starts reading at position 0 again.

Still to debug:

- Why on earth does the OS "forget" the current file position, just
  because the process calls fork?

- Why on earth does the OS not forget the current file position, just
  because the process calls ftell before fork?

Thanks for the report and the testcase.


Corinna

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

--f+W+jCU1fRNres8c
Content-Type: application/pgp-signature

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

iQIcBAEBAgAGBQJS1Q7yAAoJEPU2Bp2uRE+g+H8P/3mFvAg8ymB26/Y/r9jDjIUU
u2tvUNfsDR04gx5ZxbdT3blDxav/Uv3DPJ7LgxyNROgDdsNuVsgKX52lwtqMmwZv
cuT7hLLqQ32lbaDqqaoZCUcinsuZlyAEujKcy9gmoNoUe5KapqDDGezUjYypswxT
BrwVuIXHZld5N10MA8pcUIGUH9iqudJl5DZyC5k8SUOo9nDFmnE5iapOEv+qob67
atKWK+OWVvIaNAJ3/glxoxhF2I8D3c90NlJLFM9neIIXBSsRTNuuE5290OOQaH5v
QAQTGw0c+glUM+rvQevJOyBWKdYOJQUtbkbtNPrL1VCBtYA20lpVVMKixu2bQV2b
20/fsaCb+nJ47vYzKrP96AZHplh9TrWrpQQ77hb5vOo9UPTdL9z29UJDvxsoR/vf
96IxOmrz1uLc84Hen6ND8lYW4V4/MaUDHBQvMdQ8YNGLbN0y0PjZ5bPV5hbqvyfQ
uTgXt/SGhd3EJ3fy8+yOn6Pnf7E9+1fk7fVOs1T0NamuTlPH1xBTZIEQZ+EJFP+f
tqJuQ5OWCqsquTGUOaeZ6VvyT1SbHzYbOoFhyX72Nx4oxbOebVJOMIOhXNzRPNHH
ewqcAOMQaSavseyYwMKm3AkeFB2ADwXjsFPfSqZdPvK6LqoeJYJ1dQAMbdT7M0Je
2WNzAmqq13wA4OJn9iJW
=Ss0q
-----END PGP SIGNATURE-----

--f+W+jCU1fRNres8c--

- Raw text -


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