Subject: RE: Automake 1.4l released
From: Bernard Dautrevaux <[email-masked]>
To: "'Tim Van Holder'" <[email-masked]>, Charles Wilson <[email-masked]>
Cc: [email-masked], "[email-masked]'" <[email-masked]>
Date: Tue, 14 Aug 2001 11:13:48 +0200

> -----Original Message-----
> From: Tim Van Holder [mailto:[email-masked]]
> Sent: Monday, August 13, 2001 10:44 PM
> To: Charles Wilson
> Cc: [email-masked]
> Subject: Re: Automake 1.4l released
> 
> 
> > > So IMHO, cygwin should recognize the "unusual" behaviour 
> of NTFS, and
> > > perhaps internally do 'chmod +w; touch; chmod -w' when 
> changing the
> > > timestamp of a read-only file.
> > 
> > Omygod.  You have NO idea how much overhead the necessary 
> checks would
> > add -- it would slow down file access on cygwin to a crawl.
> 
> Come on - does adding the code below to the utime() function 
> add that much
> overhead?  Getting the attributes should amount to a single 
> system call;
> the same goes for setting them, and that is only needed if 
> the file isn't
> writeable (if the overhead is noticeable, it might be 
> necessary to check
> for NTFS-ness of the target, but I suspect always doing the 
> chmod would
> be less overhead).
> 
>   curr_attr = GetFileAttr ("file");
>   if (!WRITABLE(curr_attr))
>     SetFileAttr ("file", WRITEABLE_ATTR);
>   ...
>   if (!WRITABLE(curr_attr))
>     SetFileAttr ("file", curr_attr);
>     
> (note: function names are mock-ups, but you get the idea)

I'd rather, still using mock-up function names :-) :

	result = TouchFile("file")
	if (result < 0 && errno == EACCESS) {
	   curr_attr = GetFileAttr ("file");
	   if (!WRITABLE(curr_attr)) {
		if (SetFileAttr ("file", WRITEABLE_ATTR)) 
		   result = -1;
	      else {
		   result = TouchFile("file");
	         SetFileAttr ("file", curr_attr);
		}
	   }
	}
	return result;
		
This way I don't see which overhead we will have under CygWin (or any OS
where we will do the same): just one more test if all works OK and some more
work to have it work when it fails erroneously...

> 
> Anyway, this is really something that should be talked over on the
> cygwin mailing list (maybe you could make it a PR?) - 

Agreed; I forward this to cygwin ML, but keep it also on automake as it is
important for the distcheck users to know what happens.

> my point was
> merely that I consider the cygwin/NTFS behaviour unusual, as a file's
> readonly attribute generally applies to the file, not the metadata
> kept by the file system for that file.

I should agree here; ANY case where cygwin is different from traditional
UNIX practice is disturbing.

Regards,

		Bernard

--------------------------------------------
Bernard Dautrevaux
Microprocess Ingenierie
97 bis, rue de Colombes
92400 COURBEVOIE
FRANCE
Tel:	+33 (0) 1 47 68 80 80
Fax:	+33 (0) 1 47 88 97 85
e-mail:	[email-masked]
		[email-masked]
-------------------------------------------- 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/