Thread (26 messages) 26 messages, 4 authors, 2019-03-08

Re: [PATCH v3 2/2] setup: don't fail if commondir reference is deleted.

From: Michal Suchánek <hidden>
Date: 2019-02-21 11:19:54

On Wed, 20 Feb 2019 13:35:57 -0500
Eric Sunshine [off-list ref] wrote:
On Wed, Feb 20, 2019 at 12:16 PM Michal Suchánek [off-list ref] wrote:
quoted
On Wed, 20 Feb 2019 11:55:46 -0500
Eric Sunshine [off-list ref] wrote:  
quoted
quoted
Following this change, that particular validation no longer takes
place. But, more importantly, what does it mean to fall back to
"default" for this particular worktree? I'm having trouble
understanding how the new behavior can be correct or desirable. (Am I
missing something obvious?)  
If the file can be missing altogether and it is not an error how it is
incorrect or undesirable to ignore zero size file?  
Because the _presence_ of that file indicates a linked worktree,
whereas it's absence indicates the main worktree. If the file is
present but empty, then that is an abnormal condition, i.e. some form
of corruption.

The difference is significant, and that's why I'm asking if the new
behavior is correct or desirable. If you start interpreting this
abnormal condition as a non-error, then get_common_dir_noenv() will be
reporting that this is the main worktree when in fact it is (a somehow
corrupted) linked worktree. Such false reporting could trigger
undesirable and outright wrong behavior in callers.
This is not an issue introduced with this patch, however. The worktree
is not initialized atomically. First the worktree directory is created
and then it is populated with content including the commondir reference.

Because there is no big repository lock that everyone takes to access
a repository other running git processes can see the wotktree without
the commondir file. 

The way this is mitigated in users of get_worktrees() is an assumption
that the first worktree is the main worktree.

If this is sufficient is not something this patchset aims to address.
It merely addresses get_worktrees() aborting due to hitting specific
stage in the initialization of a worktree.

Thanks

Michal
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help