Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Non-atomic" config file behavior on Windows #5403

Open
darkfeline opened this issue Feb 6, 2025 · 1 comment
Open

"Non-atomic" config file behavior on Windows #5403

darkfeline opened this issue Feb 6, 2025 · 1 comment

Comments

@darkfeline
Copy link

Git for Windows encounters fatal errors that do not happen on Linux when reading and writing the Git config in parallel processes.

This can be relatively easily reproduced by running in parallel (e.g., in two separate terminal/PowerShell windows):

for (;;) {git rev-parse HEAD}
for (;;) {git config --local user.name foo}

The rev-parse "thread" will spew messages like:

f100762176b7b085e81cafe261a049d809772ace
f100762176b7b085e81cafe261a049d809772ace
f100762176b7b085e81cafe261a049d809772ace
warning: unable to access '.git/config': Permission denied
fatal: unknown error occurred while reading the configuration files
f100762176b7b085e81cafe261a049d809772ace

This affects any command that reads the Git config (which is all/most of them); rev-parse is just a convenient stand-in.

There is work to make lockfile renames (and thus config edits) more atomic in https://lore.kernel.org/all/[email protected]/T/

However, the above issue can still be reproduced with an RC build of 28.0.

Based on where the unknown error occurred while reading the configuration files occurs in the code, I speculate that the "atomic rename" of config.lock to config is allowing subsequent readers to read an incomplete version of the config file.

(Previously discussed in #5369, but I have a clear reproduction now. Please let me know if you can/can't reproduce it also, either on Windows or Linux)

@darkfeline
Copy link
Author

After some more understanding, I think this would better belong on the upstream Git project, so I have sent a message to the Git mailing list. I'm not sure if it still makes sense here, as I do see some other issues discussing what appear to be upstream Git concerns, so feel free to close.

I will update both threads with any noteworthy updates if this stays open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant