This is just a report for someone who will hit the same problem in a future.
I spent a lot of time to investigate why "uv install" fails within docker while installing package from git. Problem manifestation was:
error: Failed to download and build: `gunicorn @ git+https://github.com/StarfishStorage/gunicorn.git@a5bf38eea1f7642ac092e4a1639e2ccf0f4cf93b`
02:24:37 Caused by: Git operation failed
02:24:37 Caused by: process didn't exit successfully: `git clone --local /root/.cache/uv/git-v0/db/a172a1434ad2fe00 /root/.cache/uv/git-v0/checkouts/a172a1434ad2fe00/a5bf38ee` (exit status: 128)
02:24:37 --- stderr
02:24:37 Cloning into '/root/.cache/uv/git-v0/checkouts/a172a1434ad2fe00/a5bf38ee'...
02:24:37 fatal: hardlink different from source at '/root/.cache/uv/git-v0/checkouts/a172a1434ad2fe00/a5bf38ee/.git/objects/pack/pack-f885b85a815c5038c511818577ead54db50e3281.idx'
Creating hardlink succeeded but because underlying filesystem is overlayfs, then creating hardlink dest_path that points to src_path may cause that src_path will change it's inode (because it will appear in different fs layer). Therefore git rejects such hardlink because it requires to have the same attributes:
https://github.com/git/git/blob/master/builtin/clone.c#L405
IMHO, it is small bug in "git", it could be solved by refreshing stat value iter->st after creating hardlink.
Retrying that "close" also fix the issue, because once created hardlink cause that hardlinked file appear in new fs layer and later creating hardlink does not change inode.
It could be solved by uv option export UV_CACHE_DIR=/new/cache/dir, but it also has consequences.
My choice was to remove /root/.cache/uv/git-v0 directory after docker image is created. In that way only git cache will not be used and all other uv cache will be still functional.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With