X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Mon, 20 Apr 2009 17:34:42 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: [1.7] flock change breaks autotools 'make -j2'
Message-ID: <20090420153442.GB8722@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <loom.20090416T201917-225@post.gmane.org> <20090417100148.GD5200@calimero.vinschen.de> <49E87CFA.9070709@byu.net> <20090417133103.GG8722@calimero.vinschen.de> <loom.20090420T150238-584@post.gmane.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <loom.20090420T150238-584@post.gmane.org>
User-Agent: Mutt/1.5.19 (2009-02-20)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

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/

