X-Recipient: archive-cygwin@delorie.com
X-SWARE-Spam-Status: No, hits=-1.2 required=5.0	tests=AWL,BAYES_00,SPF_HELO_PASS,TW_CG,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: Dan Grayson <dan@math.uiuc.edu>
Subject: Re: untarring symlinks with ../ fails randomly
Date: Tue, 26 Apr 2011 16:42:02 +0000 (UTC)
Lines: 52
Message-ID: <loom.20110426T183318-691@post.gmane.org>
References: <BANLkTikh9rCN2GRwY3eW20H0isffN5fMUg@mail.gmail.com> <BANLkTi=GZbtLmK-Sr06-M=5xXVFzPCi82w@mail.gmail.com> <20110424121145.GB30696@calimero.vinschen.de> <loom.20110425T165316-628@post.gmane.org> <20110426074325.GP3324@calimero.vinschen.de> <loom.20110426T170653-639@post.gmane.org> <20110426152226.GA22801@ednor.casa.cgf.cx>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.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


Christopher Faylor <cgf-use-the-mailinglist-please <at> cygwin.com> writes:

> Cygwin doesn't change the creation time gratuitously.  Sounds like BLODA 
> to me.
> http://cygwin.com/acronyms/#BLODA
> 
> cgf

Good call!  I killed Vid.exe from Logitech and reduced the probability of
failure from 25% per file to 1%.  Sadly, killing other processes doesn't seem
to bring the probability down to 0%, but I'm still trying.  If anyone else
wants to give it a try, here is a better C program for testing, that tries 1000
times.




   /* 
 gcc -Wall ctime.c -o ctime && ./ctime
   */

#include <unistd.h>
#include <assert.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <stdio.h>

#define FN "temporary-file-junk"

int main () {
     int m = 0, n = 1000, i;
     for (i=0; i<n; i++) {
	  static struct stat s1, s2;
	  unlink(FN);
	  int fd = open(FN,O_EXCL|O_CREAT|O_WRONLY,0);
	  fstat(fd,&s1);
	  close(fd);
	  stat(FN,&s2);
	  if (s1.st_ctim.tv_sec != s2.st_ctim.tv_sec || 
	      s1.st_ctim.tv_nsec != s2.st_ctim.tv_nsec) 
	       m++,
	       printf("ctime changed %3d: %lu.%09lu -> %lu.%09lu\n", 
		      i,
		      s1.st_ctim.tv_sec, s1.st_ctim.tv_nsec, 
		      s2.st_ctim.tv_sec, s2.st_ctim.tv_nsec);
	  }
     unlink(FN);
     printf("ctime change ratio: %d / %d = %.2g\n",m,n,(float)m/n);
     return 0;
     }



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

