From: Patrick Steinhardt <ps@pks.im>
To: Johannes Sixt <j6t@kdbg.org>
Cc: git@vger.kernel.org, Christian Reich <Zottelbart@t-online.de>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH] reftable: ignore file-in-use errors when unlink(3p) fails on Windows
Date: Sat, 25 Jan 2025 09:32:32 +0100 [thread overview]
Message-ID: <Z5ShoLCWREAsWZVh@pks.im> (raw)
In-Reply-To: <6acb9e8a-7014-4605-b8af-59c4584e9fe6@kdbg.org>
On Sat, Jan 25, 2025 at 09:19:57AM +0100, Johannes Sixt wrote:
> Am 25.01.25 um 06:41 schrieb Patrick Steinhardt:
> > While this logic might be sensible in many callsites throughout Git, it
> > is less when used in the reftable library. We only use unlink(3) there
> > to delete tables which aren't referenced anymore, and the code is very
> > aware of the limitations on Windows. As such, all calls to unlink(3p)
> > don't perform any error checking at all and are fine with the call
> > failing.
> >
> > Instead, the library provides the `reftable_stack_clean()` function,
> > which Git knows to execute in git-pack-refs(1) after compacting a stack.
> > The effect of this function is that all stale tables will eventually get
> > deleted once they aren't kept open anymore.
> >
> > So while we're fine with unlink(3p) failing, the Windows-emulation of
> > that function will still perform several sleeps and ultimately end up
> > asking the user:
>
> Why don't the changes that your commits ending at 391bceae4350
> ("compat/mingw: support POSIX semantics for atomic renames", 2024-10-27)
> help in this case, too?
The user report was explicitly about compatibility with JGit, which
still had these files open. We don't have control over third-party
clients and how exactly they open files, so it is expected that we may
still see failures with the deletion of in-use files.
> Since the reftable layer is aware of the problem, why don't we just fix
> it there and instead sweep it under the rug in the compat layer?
I didn't really have a good idea for _how_ to do that. We automatically
pull in the compat version of `unlink()` via "git-compat-util.h", and we
cannot easily change that. So the reftable library is basically unable
to handle it there, because the assumed POSIX-behavior of `unlink()` is
different. I also don't want to reimplement the "compat/" layer for
Windows, because it brings us a couple of features for free, like
wide-character handling and handling the deletion of read-only files.
Another alternative would be to provide `reftable_unlink()` in the
reftable system layer, implement it via `mingw_unlink()` with that
second argument I'm introducing and then convert all callsites of unlink
to use that function instead. But that felt unnecessarily complex to me.
I'd be happy to hear about alternative ideas that didn't came to my
mind.
Patrick
next prev parent reply other threads:[~2025-01-25 8:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-25 5:41 [PATCH] reftable: ignore file-in-use errors when unlink(3p) fails on Windows Patrick Steinhardt
2025-01-25 8:19 ` Johannes Sixt
2025-01-25 8:32 ` Patrick Steinhardt [this message]
2025-01-25 14:28 ` Johannes Sixt
2025-01-27 7:48 ` Patrick Steinhardt
2025-01-28 6:52 ` Johannes Sixt
2025-01-28 7:17 ` Patrick Steinhardt
2025-01-29 7:40 ` Johannes Sixt
2025-01-25 8:45 ` Christian Reich
2025-01-27 7:58 ` Patrick Steinhardt
2025-01-26 1:41 ` Junio C Hamano
2025-01-27 7:57 ` Patrick Steinhardt
2025-02-06 7:53 ` [PATCH v2] " Patrick Steinhardt
2025-03-14 14:18 ` Christian Reich
2025-03-14 15:00 ` Patrick Steinhardt
2025-03-15 23:17 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z5ShoLCWREAsWZVh@pks.im \
--to=ps@pks.im \
--cc=Johannes.Schindelin@gmx.de \
--cc=Zottelbart@t-online.de \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).