Julian Foad wrote on Sat, Feb 19, 2022 at 14:00:46 +0000:
> Thanks, Daniel. I'll take a look at this some time in the next few days 
> unless someone beats me to it.
> 
> Daniel Shahaf wrote:
> > [...] What race condition is that?  The change to authz happened before the
> >sync, not between the sync and the main operation.
> 
> Yes, it's not directly related to this; it's just that seeing this problem 
> set me to wondering whether another class of race condition could occur 
> between the sync and the main operation. User modifies a file in that window 
> and... an operation like diff would error out in a harmless way, but maybe 
> some operations might break in a non-trivial way, e.g. leaving the wc locked 
> or worse?

Can another process modify wc.db during the sync, or between the sync
and the main operation?  For instance, is it possible for pid Alice to
hydrate iota, then for pid Bob to hydrate iota (no-op), do
something-or-other, and dehydrate iota, and then for Alice to proceed
and find iota not hydrated?  Looking at, say, the changes to
svn_client_cat3() on the branch, there doesn't seem to be anything
stopping another process from doing whatever they want right after the
first svn_client__textbase_sync() call returns?

The pristines themselves are outside SQLite, so there's the
transactionality question between "is in fact present in .svn/pristine/"
and "The PRISTINE::HYDRATED column is set to TRUE".  This has been
a question ever since wc-ng was first implemented.  Are we re-using the
existing solution?  I see textbase_hydrate() calls 
svn_wc__db_pristine_install(),
but I'm not sure off the top of my head whether that suffices.  E.g., what
if svn is «kill -9»'d as soon as hydrate_callback() returns?  Will the
downloaded file be either removed or installed (as opposed to just lost
track of)?

(The file will be re-downloaded, I think; that's fine for an MVP.)

> I suppose such scenarios must be equivalent to what can already happen (in 
> svn 1.14) if a pristine is deleted without svn's knowledge.

That was my first guess too, but that «svn cat iota@BASE» operation
doesn't say "Couldn't find iota's pristine"; instead, it infers that
«iota» is a local add.

Cheers,

Daniel

Reply via email to