diff --git a/changelog/unreleased/issue-5342 b/changelog/unreleased/issue-5342 new file mode 100644 index 000000000..e9887fda2 --- /dev/null +++ b/changelog/unreleased/issue-5342 @@ -0,0 +1,7 @@ +Bugfix: Ignore "chmod not supported" errors when writing files + +Restic 0.18.0 introduced a bug that caused "chmod xxx: operation not supported" +errors to appear when writing to a local file repository that did not support +chmod (like CIFS or WebDAV mounted via FUSE). Restic now ignores those errors. + +https://github.com/restic/restic/issues/5342 diff --git a/internal/backend/local/local_unix.go b/internal/backend/local/local_unix.go index e52587456..b885ae1a3 100644 --- a/internal/backend/local/local_unix.go +++ b/internal/backend/local/local_unix.go @@ -43,5 +43,12 @@ func isMacENOTTY(err error) bool { // set file to readonly func setFileReadonly(f string, mode os.FileMode) error { - return os.Chmod(f, mode&^0222) + err := os.Chmod(f, mode&^0222) + + // ignore the error if the FS does not support setting this mode (e.g. CIFS with gvfs on Linux) + if err != nil && errors.Is(err, errors.ErrUnsupported) { + return nil + } + + return err }