On Apr 20 15:14, Eric Blake wrote:
> Corinna Vinschen <corinna-cygwin <at> cygwin.com> writes:
> 
> > > > I'd prefer a testcase in C.
> > > 
> > > So would I.  I'm not even sure whether perl was using flock or
> > > lockf/fcntl.  Do you still need me to try and write a STC, or at least
> > > test how perl behaves with your first patch?
> > 
> > I checked in a patch which hopefully solves both problems.  The lock.pl
> > testcase now works, at least.  Can you test if the original scenario
> > works now as well?  If not, I'd really need another testcase.
> 
> Nope; with snapshot 20090418 I'm still seeing the 'make -j2' failures.  I'll 

Too bad.

> see if I can come up with a C program that can be run as two processes to 
> simulate the failure as a simpler test case.  I did verify via strace that 
> perl 
> is using flock(fd, LOCK_EX).

Yes, I saw this already while debugging the lock.pl testcase.

Whatever it is, it must be more complicated than this:

    #include <stdio.h>
    #include <sys/file.h>

    int
    main ()
    {
      int fd = open ("flock.c", O_RDWR);
      if (fd >= 0)
        {
          printf ("About to call flock\n");
          if (!flock (fd, LOCK_EX))
            {
              printf ("flock succeeded.  Waiting...\n");
              getchar ();
              close (fd);
            }
          else
            perror ("flock");
        }
      return 0;
    }

Because this testcase works fine.  I hope it's not trying to do this:

  parent opens file
  fork
    child calls flock()
    exit
  fork
    second child relies on the lock.

because this is exactly the scenario which doesn't work with flock
right now.  I have it on my TODO list, but so far I'm at a loss as
to how to implement it.


Corinna

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

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to