[PATCH] shallow: verify shallow file after taking lock

2014-03-14 Thread Jeff King
Before writing the shallow file, we stat() the existing file to make sure it has not been updated since our operation began. However, we do not do so under a lock, so there is a possible race: 1. Process A takes the lock. 2. Process B calls check_shallow_file_for_update and finds no

[PATCH] shallow: verify shallow file after taking lock

2014-02-27 Thread Jeff King
Before writing the shallow file, we stat() the existing file to make sure it has not been updated since our operation began. However, we do not do so under a lock, so there is a possible race: 1. Process A takes the lock. 2. Process B calls check_shallow_file_for_update and finds no

Re: [PATCH] shallow: verify shallow file after taking lock

2014-02-27 Thread Jeff King
On Thu, Feb 27, 2014 at 04:10:12AM -0500, Jeff King wrote: I also notice that check_shallow_file_for_update returns early if !is_shallow. Is that safe? Is it possible for another process to have made us shallow since the program began? In that case, we would have to stat() the file always,

Re: [PATCH] shallow: verify shallow file after taking lock

2014-02-27 Thread Duy Nguyen
On Thu, Feb 27, 2014 at 4:22 PM, Jeff King p...@peff.net wrote: On Thu, Feb 27, 2014 at 04:10:12AM -0500, Jeff King wrote: I also notice that check_shallow_file_for_update returns early if !is_shallow. Is that safe? Is it possible for another process to have made us shallow since the program