Directory ctimes

Jeremy Allison jallison at whistle.com
Wed Feb 11 19:17:45 GMT 1998


Jim Hague wrote:

> 
> Unix time semantics here don't exactly match Win32, so Samba reports the
> ctime as the creation time, which is fair enough. Unfortunately, when an
> object file is written (and I think they are deleted and recreated if they
> exist) the directory ctime is altered. The directory ctime is thence always
> the time of the last object file write, so the dependency rule means NMAKE
> will always rebuild everything :-(
> 

This is a really interesting post, as I've been working on the VC++5.x
problem for 1.9.18p3.

One of the things added for p2 was, when returning a create
time, to looks at the ctime, mtime and atime and
return the oldest (as that's the best representation
we can get for create time). I don't think that'll fix
the problem however, as creating a file will update
the ctime and mtime, and each directory scan will update
the atime.

> Replacing NMAKE isn't an option for us, so I am proposing to add an option
> to smb.conf to determine how directory creation times are reported. This
> could be:
> 
> 1. ctime, as at present (default).
> 2. earliest ctime of the files in the directory, or ctime if empty.
>    (Prob. too expensive).
> 3. 1/1/70 or some other specified time.
> 

Finding the earliest time of the files in the directory
could be *very* expensive, for a directory with many files.

> Before I lurch off into this, has anybody else already dealt with this? Or
> worked around it somehow? If not, any comments on further options and
> possible nasty side-effects?

One of the other issues is getting around the hideous
'file changed' bug - which seems to be triggered by
code in VC++ working around a Win95 server bug. As
Samba doesn't have ChangeNotify (yet) then VC++
constantly polls the filetimes for all open files
and expects a Win95 response (after all, what other
servers are there but Win95 and NT ? :-).

I'm adding an option for p3, "win95 bug compatibility"
which causes Samba to return mtime for atime, and
swap the byte order of a date in one return call
(as Win95 does) - this seems to make the problem
much better (although it does still occasionally
occur).

Let me know how you get on with this. I'm open
to good ideas. This problem should go away when
Samba does NT SMB's - as we'll support ChangeNotify.

Cheers,

	Jeremy Allison,
	Samba Team.

-- 
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------


More information about the samba mailing list