Support for nodump attribute
We currently configure exclusion list using the nodump attribute, a standard file attribute on btrfs/ext* filesystem.
Excluding file using a per-file attribute is different than other supported method:
- it does not restrict file name
- it does not force to put a flag-file in a folder
- it does not require a central "gitignore" file
- it is already used by other backup tool (ie: Borg Backup).
Good idea! I would like to have it, too!
This looks perfectly reasonable as a feature. Some preliminary implementation hints:
From what I gather, you can only determine this attribute using a statx(2) call. Go's x/sys/unix has this as Statx. Statx takes an open directory and a filename as input, not a path. So if we would reimplement internal/fs.Local.Lstat using statx, we'd need to open the parent directory and reimplement os.Lstat's cross-platform way of handling file modes. We could also do both an os.Lstat and a unix.Statx, but that comes at the cost of an additional system call and a race condition. I guess the race condition isn't that bad, so the latter way may be preferable for a first shot at this.
Related to https://github.com/restic/restic/issues/4076 .