windows permissions fix

Windows: Fix permission denied error when dropping files that have the
readonly attribute set.

Files coming from a special remote may have had write permission removed
from them. The directory special remote does that. And there are
probably others. So rather than fixing it on the special remote side,
made moveAnnex, on Windows, add back the write bit. This apparently
removes the readonly attribute. See Remote.Directory.removeDirGeneric
which already did the same on windows to allow removing files from the
directory special remote.

The reason that cleanObjectLoc also calls allowWrite is to handle
situations where files have already gotten into git-annex repositories on
Windows with the write bit set. Eg, an older git-annex put them there.
Or perhaps the git-annex repository was populated on some other OS.
This commit is contained in:
Joey Hess 2025-01-07 16:37:39 -04:00
parent 4faf2b7bec
commit 43b35f9493
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
6 changed files with 41 additions and 1 deletions

View file

@ -131,3 +131,5 @@ This observation comes from an effort to implement a git-remote-helper that uses
[[!tag projects/datalad]]
[[!tag projects/INM7]]
> I think this is [[fixed|done]] now.. --[[Joey]]

View file

@ -0,0 +1,12 @@
[[!comment format=mdwn
username="joey"
subject="""comment 4"""
date="2025-01-07T20:33:22Z"
content="""
I see that the directory special remote, on windows, adds back the write
permission on files before removing them. That was done way back in
[[!commit 38022f4f493588505896635703c34afa6c2e2406]].
I've applied the same fix now to the annex objects side, so this should be
fixed.
"""]]

View file

@ -498,3 +498,5 @@ say I'm a believer. :)
[[!meta author=jkniiv]]
[[!tag projects/INM7]]
> I think this is [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,12 @@
[[!comment format=mdwn
username="joey"
subject="""comment 5"""
date="2025-01-07T20:31:07Z"
content="""
I see that the directory special remote, on windows, adds back the write
permission on files before removing them. That was done way back in
[[!commit 38022f4f493588505896635703c34afa6c2e2406]].
I've applied the same fix now to the annex objects side, so this should be
fixed.
"""]]