mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 19:08:55 +00:00
parent
59a90943bb
commit
348e966daa
8
changelog/unreleased/issue-4016
Normal file
8
changelog/unreleased/issue-4016
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Bugfix: Support ExFAT-formatted local backends on macOS Ventura
|
||||||
|
|
||||||
|
ExFAT-formatted disks could not be used as local backends starting from macOS
|
||||||
|
Ventura. Restic commands would fail with "inappropriate ioctl for device". This
|
||||||
|
has been fixed.
|
||||||
|
|
||||||
|
https://github.com/restic/restic/issues/4016
|
||||||
|
https://github.com/restic/restic/pull/4021
|
@ -177,7 +177,7 @@ func (b *Local) Save(ctx context.Context, h restic.Handle, rd restic.RewindReade
|
|||||||
|
|
||||||
// Ignore error if filesystem does not support fsync.
|
// Ignore error if filesystem does not support fsync.
|
||||||
err = f.Sync()
|
err = f.Sync()
|
||||||
syncNotSup := errors.Is(err, syscall.ENOTSUP)
|
syncNotSup := err != nil && (errors.Is(err, syscall.ENOTSUP) || isMacENOTTY(err))
|
||||||
if err != nil && !syncNotSup {
|
if err != nil && !syncNotSup {
|
||||||
return errors.WithStack(err)
|
return errors.WithStack(err)
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ package local
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/restic/restic/internal/fs"
|
"github.com/restic/restic/internal/fs"
|
||||||
@ -19,7 +20,9 @@ func fsyncDir(dir string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = d.Sync()
|
err = d.Sync()
|
||||||
if errors.Is(err, syscall.ENOTSUP) || errors.Is(err, syscall.ENOENT) || errors.Is(err, syscall.EINVAL) {
|
if err != nil &&
|
||||||
|
(errors.Is(err, syscall.ENOTSUP) || errors.Is(err, syscall.ENOENT) ||
|
||||||
|
errors.Is(err, syscall.EINVAL) || isMacENOTTY(err)) {
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,6 +34,15 @@ func fsyncDir(dir string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The ExFAT driver on some versions of macOS can return ENOTTY,
|
||||||
|
// "inappropriate ioctl for device", for fsync.
|
||||||
|
//
|
||||||
|
// https://github.com/restic/restic/issues/4016
|
||||||
|
// https://github.com/realm/realm-core/issues/5789
|
||||||
|
func isMacENOTTY(err error) bool {
|
||||||
|
return runtime.GOOS == "darwin" && errors.Is(err, syscall.ENOTTY)
|
||||||
|
}
|
||||||
|
|
||||||
// set file to readonly
|
// set file to readonly
|
||||||
func setFileReadonly(f string, mode os.FileMode) error {
|
func setFileReadonly(f string, mode os.FileMode) error {
|
||||||
return fs.Chmod(f, mode&^0222)
|
return fs.Chmod(f, mode&^0222)
|
||||||
|
@ -7,6 +7,9 @@ import (
|
|||||||
// Can't explicitly flush directory changes on Windows.
|
// Can't explicitly flush directory changes on Windows.
|
||||||
func fsyncDir(dir string) error { return nil }
|
func fsyncDir(dir string) error { return nil }
|
||||||
|
|
||||||
|
// Windows is not macOS.
|
||||||
|
func isMacENOTTY(err error) bool { return false }
|
||||||
|
|
||||||
// We don't modify read-only on windows,
|
// We don't modify read-only on windows,
|
||||||
// since it will make us unable to delete the file,
|
// since it will make us unable to delete the file,
|
||||||
// and this isn't common practice on this platform.
|
// and this isn't common practice on this platform.
|
||||||
|
Loading…
Reference in New Issue
Block a user