mirror of
https://github.com/octoleo/restic.git
synced 2024-11-25 22:27:35 +00:00
bugfix: omit ENOTDATA for extended attributes
Signed-off-by: hoyho <luohaihao@gmail.com>
This commit is contained in:
parent
96a912b65a
commit
9df52327cc
8
changelog/unreleased/issue-1800
Normal file
8
changelog/unreleased/issue-1800
Normal file
@ -0,0 +1,8 @@
|
||||
Bugfix: Ignore 'no data available' error during backup
|
||||
|
||||
restic failed to backup files on some filesystems, for example certain configurations
|
||||
of CIFS on Linux, which return a "no data available" error when reading extended
|
||||
attributes. These errors are now ignored.
|
||||
|
||||
https://github.com/restic/restic/issues/1800
|
||||
https://github.com/restic/restic/pull/3034
|
@ -16,7 +16,8 @@ import (
|
||||
// Getxattr retrieves extended attribute data associated with path.
|
||||
func Getxattr(path, name string) ([]byte, error) {
|
||||
b, e := xattr.Get(path, name)
|
||||
if err, ok := e.(*xattr.Error); ok && err.Err == syscall.ENOTSUP {
|
||||
if err, ok := e.(*xattr.Error); ok &&
|
||||
(err.Err == syscall.ENOTSUP || err.Err == xattr.ENOATTR) {
|
||||
return nil, nil
|
||||
}
|
||||
return b, errors.Wrap(e, "Getxattr")
|
||||
@ -26,7 +27,8 @@ func Getxattr(path, name string) ([]byte, error) {
|
||||
// given path in the file system.
|
||||
func Listxattr(path string) ([]string, error) {
|
||||
s, e := xattr.List(path)
|
||||
if err, ok := e.(*xattr.Error); ok && err.Err == syscall.ENOTSUP {
|
||||
if err, ok := e.(*xattr.Error); ok &&
|
||||
(err.Err == syscall.ENOTSUP || err.Err == xattr.ENOATTR) {
|
||||
return nil, nil
|
||||
}
|
||||
return s, errors.Wrap(e, "Listxattr")
|
||||
@ -35,7 +37,8 @@ func Listxattr(path string) ([]string, error) {
|
||||
// Setxattr associates name and data together as an attribute of path.
|
||||
func Setxattr(path, name string, data []byte) error {
|
||||
e := xattr.Set(path, name, data)
|
||||
if err, ok := e.(*xattr.Error); ok && err.Err == syscall.ENOTSUP {
|
||||
if err, ok := e.(*xattr.Error); ok &&
|
||||
(err.Err == syscall.ENOTSUP || err.Err == xattr.ENOATTR) {
|
||||
return nil
|
||||
}
|
||||
return errors.Wrap(e, "Setxattr")
|
||||
|
Loading…
Reference in New Issue
Block a user