This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fork() + file descriptor bug in 1.7.27(0.271/5/3) 2013-12-09 11:54


On Jan 13 11:06, tednolan@bellsouth.net wrote:
> Hello,
> 
> I'm running:
> 
> 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
> 
> on a 64 bit Win7 system.
> 
> I have just run into an odd bug, which I have boiled down into the program
> below (which started as a mod to tiff2ps).
> 
> If you compile this program:
> 
> =========================CUT HERE=============
> [...]
> =========================End code=============
> 
> and run it with this data:
> 
> 00.tif  00.eps
> 01.tif  01.eps
> 02.tif  02.eps
> 
> It will run forever.
> 
> 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

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

Attachment: pgp8ayl0gGWQ4.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]