www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/04/20/11:35:04

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Mon, 20 Apr 2009 17:34:42 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: [1.7] flock change breaks autotools 'make -j2'
Message-ID: <20090420153442.GB8722@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <loom DOT 20090416T201917-225 AT post DOT gmane DOT org> <20090417100148 DOT GD5200 AT calimero DOT vinschen DOT de> <49E87CFA DOT 9070709 AT byu DOT net> <20090417133103 DOT GG8722 AT calimero DOT vinschen DOT de> <loom DOT 20090420T150238-584 AT post DOT gmane DOT org>
MIME-Version: 1.0
In-Reply-To: <loom.20090420T150238-584@post.gmane.org>
User-Agent: Mutt/1.5.19 (2009-02-20)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

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/

- Raw text -


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