On Thu, Feb 20, 2014 at 9:54 PM, john skaller <[email protected]
> wrote:

>
> On 21/02/2014, at 11:22 AM, Mike Shal wrote:
> >
> > Ahh, thanks - I can reproduce it with Sublime Text 3. So somehow when it
> saves the file, it's not updating the ctime (only the mtime). We need to
> check the ctime because 'chmod' only affects the ctime. And I thought all
> other operations that affect mtime also update ctime (eg: 'touch', 'vim',
> etc all modify both ctime+mtime).
> >
> > I guess we need to check both times somehow on OSX? I'd prefer not to
> have to add another field to the database, but maybe there's a way to do it
> (like using max(ctime, mtime) as the timestamp or something). I'll have to
> fiddle around a bit...
>
>      st_ctime         Time when file status was last changed (inode data
> modification).  Changed by the
>                       chmod(2), chown(2), link(2), mknod(2), rename(2),
> unlink(2), utimes(2) and
>                       write(2) system calls.
>
>
> Note: no mention is made of mmap().
> Mmap man page says nothing either.
>
>
> https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man2/mmap.2.html
>
> However Posix does:
>
> http://pubs.opengroup.org/onlinepubs/009695399/functions/mmap.html
>
> The st_ctime and st_mtime fields of a file that is mapped with MAP_SHARED
> and PROT_WRITE shall be marked for update at some point in the interval
> between a write reference to the mapped region and the next call to msync()
> with MS_ASYNC or MS_SYNC for that portion of the file by any process. If
> there is no such call and if the underlying file is modified as a result of
> a write reference, then these fields shall be marked for update at some
> time after the write reference.
>
>
> So maybe Apple's mmap functions aren't Posix compliant?
>
>
I'm not sure if mmap is a problem or not - I ran the editor through dtruss,
and I didn't see mmap explicitly called when the file was being saved (I do
see madvise, though). I did see it call exchangedata(), which Sublime uses
instead of rename() to swap the contents of the tmp file into the real
file. The exchangedata call appears to be what is responsible for changing
the mtimes without changing ctimes, so I added t4164 to check for this.

spamwax, can you try the latest master and see if it is working properly
now?

Thanks,
-Mike

-- 
-- 
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to