On Fri, Oct 1, 2021 at 3:02 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > > Elijah Newren <newren@xxxxxxxxx> writes: > > > So with that out of the way, let's return to discussing the textconv > > cache. If the remerge-diff results aren't cached, isn't it unsafe to > > allow the textconv cache to persist anything while remerge-diff is > > running because it could create corruption? > > I do not think anybody involved in this thread thinks it is > practical to annotate each write_object_file() with "this is > temporary" vs "this is to persist", so it is a given that it would > be all-or-none. If we want write_object_file() called while we are > running remerge-diff to write to a temporary object store, we have > to accept any other write_object_file() called by somebody else, > like textconv cache, must become temporary. Ok, good. But is this write_object_file() specific? I think pretend_object_file() has the same problem where the textconv cache could reference a pretend_object_file() and thus write objects and/or refs that become corrupt. (In particular, if the userdiff fires on any of the new files created by the three-way content merges, then I think we hit the exact same problem) So, I think as long as there are any "temporary" objects being fed to diff, the textconv cache needs to also be considered temporary. Or am I misunderstanding something? > It may be sufficient to plug ref updates (which would cover the > finialization of notes-cache used by the textconv cache) to avoid > corruption, but that might give us a pointless and unpleasant error > message, so it may be necessary to teach the notes-cache stuff to > allow getting existing cached data while disabling it to accept > cache updates. All we need to do here is set the quarantine environment, as per Neeraj's report[1], it already handles all of this: """ Peff's test case was invoking ref updates via the cachetextconv setting. That particular code silently does nothing when a ref update is forbidden """ Looking at the code, this appears to happen because ref_transaction_prepare() doesn't print an error in the quarantine environment, but returns one. That error is passed all the way up the stack to notes_cache_write() and then to fill_textconv(). fill_textconv() is the first level in the stack that ignores the return code of what it's calling, namely notes_cache_write(), which means that things work fine. There's even a comment a few lines stating, "ignore errors, as we might be in a readonly repository". So, I think we're good as long as we ensure the quarantine environment is setup. [1] https://lore.kernel.org/git/20210929184339.GA19712@neerajsi-x1.localdomain/