backend/local: fix "operation not supported" when unlocking#5596
Conversation
52a631a to
1fad4de
Compare
MichaelEischer
left a comment
There was a problem hiding this comment.
We cannot remove the chmod call (see comment). Please just filter out ErrUnsupported as already done by setFileReadonly. (Feel free to create a unified helper for setting file read-only and writeable if you want)
|
Or maybe - much like we have platform specific wrappers for lots of stuff, make a |
Then I'd just turn that into a |
ac117ac to
e5c1a87
Compare
If the repo is on a mounted folder that doesn't support chmod (like SMB), it was causing an "operation not supported" error when trying to chmod 666 a file before deleting it. But it isn't generally needed before deleting a file (the folder permissions matter there, not the file permissions). So, just drop it.
Yes, that error must be checked. |
What does this PR change? What problem does it solve?
If the repo is on a mounted folder that doesn't support chmod (like SMB), it was causing an "operation not supported" error when trying to chmod 666 a file before deleting it.
But it isn't generally needed before deleting a file (the folder permissions matter there, not the file permissions). So, just drop it.
This code path I'm deleting was introduced ten years ago without comment. Is there a platform that Restic supports that does care about the file permissions before deleting? If so, I can fix this another way - by ignoring ErrUnsupported for Unix (like the other recent fix I made did)
The only remaining
chmodcall I can see that might be a problem is in ResetPermissions in file.go (which could call the file_xxx.go'schmodabstraction, but I think there we actually do want to raise an issue if we can't correctly reset permissions - it's only used when there's an access denied error already. So the fact that chmod is unsupported is relevant when explicitly trying to reset permissions.)Was the change previously discussed in an issue or on the forum?
Closes #5595
Checklist
changelog/unreleased/that describes the changes for our users (see template).