Re: git bugs

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ben Lynn <benlynn@...>
Cc: Daniel Barkalow <barkalow@...>, <git@...>
Subject: Re: git bugs
Date: Tuesday, June 10, 2008 - 4:06 pm

On Tue, 10 Jun 2008, Ben Lynn wrote:

It's worth pointing out that even in the absense of races, you can 
obviously screw things up if you really work at it, and *want* to. We 
cannot guarantee that we see all file changes from the stat() information, 
and we don't even save the whole stat info (ie we only save the low 32 
bits).

The ctime check is there to help make it harder for people to play games 
by setting the mtime back in time after having changed things, but we may 
at some point be forced to remove it because it triggers with things like 
beagle that use inode attributes to save indexing information (and thus 
change ctime).

And different systems have different approaches to what happens when a 
file gets modified through a writable mmap(). Exactly what is the mtime 
going to be? 

So I think git does a really good job at matching the stat() information, 
and the suggested patch makes it even stricter, but I think we should not 
even try to make it handle "malicious" changes. I bet you can work at 
making it miss some update if you really *really* try.

And I think there is one known race: the index mtime itself is not 
race-free. Remember: it may take more than a second to write the index 
file! So I can imagine that if you can set it up so that you change the 
file as the index is written out, and the index write is delayed 
sufficiently, the racy timestamp logic can fail just because the timestamp 
on the index file ends up being later.

This is more easily shown by doing a 'touch' on the index file afterwards, 
of course.

And yes, we should have written the timestamp to the file itself, instead 
of reading it from the filesystem.

			Linus
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git bugs, Ben Lynn, (Tue Jun 10, 4:41 am)
Re: git bugs, Shawn O. Pearce, (Wed Jun 11, 11:17 pm)
Re: git bugs, Johannes Schindelin, (Thu Jun 12, 3:12 am)
Re: git bugs, Ben Lynn, (Thu Jun 12, 2:46 am)
Re: git bugs, Linus Torvalds, (Tue Jun 10, 1:44 pm)
Re: git bugs, Jeff King, (Fri Jun 13, 6:10 am)
Re: git bugs, Junio C Hamano, (Fri Jun 13, 7:09 pm)
Re: git bugs, Jeff King, (Sat Jun 14, 2:25 am)
Re: git bugs, Junio C Hamano, (Thu Jun 12, 4:06 pm)
Re: git bugs, Ben Lynn, (Tue Jun 10, 2:45 pm)
Re: git bugs, Linus Torvalds, (Tue Jun 10, 4:06 pm)
Re: git bugs, Ben Lynn, (Tue Jun 10, 7:09 pm)
Re: git bugs, Junio C Hamano, (Tue Jun 10, 7:38 pm)
Re: git bugs, Ben Lynn, (Tue Jun 10, 8:02 pm)
Re: git bugs, Linus Torvalds, (Tue Jun 10, 9:36 pm)
Re: git bugs, Ben Lynn, (Tue Jun 10, 10:04 pm)
Re: git bugs, Linus Torvalds, (Tue Jun 10, 10:12 pm)
Re: git bugs, Ben Lynn, (Tue Jun 10, 10:31 pm)
Re: git bugs, Linus Torvalds, (Tue Jun 10, 10:39 pm)
Re: git bugs, Ben Lynn, (Wed Jun 11, 1:58 am)
Re: git bugs, Linus Torvalds, (Wed Jun 11, 10:52 am)
Re: git bugs, Ben Lynn, (Wed Jun 11, 2:18 am)
Re: git bugs, Linus Torvalds, (Wed Jun 11, 10:54 am)
Re: git bugs, Ben Lynn, (Wed Jun 11, 1:52 pm)
Re: git bugs, Linus Torvalds, (Wed Jun 11, 2:10 pm)
Re: git bugs, Ben Lynn, (Wed Jun 11, 2:48 pm)
Re: git bugs, Linus Torvalds, (Wed Jun 11, 2:53 pm)
Re: git bugs, Junio C Hamano, (Wed Jun 11, 5:50 pm)
Re: git bugs, Ben Lynn, (Wed Jun 11, 4:57 pm)
Re: git bugs, Junio C Hamano, (Tue Jun 10, 8:20 pm)
Re: git bugs, Ben Lynn, (Tue Jun 10, 8:24 pm)
Re: git bugs, Stephen R. van den Berg, (Wed Jun 11, 8:46 am)
Re: git bugs, Ben Lynn, (Thu Jun 12, 2:51 am)
Re: git bugs, Ben Lynn, (Tue Jun 10, 8:53 pm)
Re: git bugs, Daniel Barkalow, (Tue Jun 10, 12:58 pm)