mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-06 11:40:31 +00:00
Merge pull request #1082 from enkore/issue/1080
List files excluded via UF_NODUMP
This commit is contained in:
commit
279fb3958f
3 changed files with 10 additions and 4 deletions
|
@ -317,6 +317,7 @@ class Archiver:
|
|||
status = None
|
||||
# Ignore if nodump flag is set
|
||||
if get_flags(path, st) & stat.UF_NODUMP:
|
||||
self.print_file_status('x', path)
|
||||
return
|
||||
if stat.S_ISREG(st.st_mode) or read_special and not stat.S_ISDIR(st.st_mode):
|
||||
if not dry_run:
|
||||
|
|
|
@ -50,9 +50,6 @@ cdef extern from "linux/fs.h":
|
|||
cdef extern from "stropts.h":
|
||||
int ioctl(int fildes, int request, ...)
|
||||
|
||||
cdef extern from "errno.h":
|
||||
int errno
|
||||
|
||||
cdef extern from "string.h":
|
||||
char *strerror(int errnum)
|
||||
|
||||
|
@ -79,7 +76,8 @@ def set_flags(path, bsd_flags, fd=None):
|
|||
fd = os.open(path, os.O_RDONLY|os.O_NONBLOCK|os.O_NOFOLLOW)
|
||||
try:
|
||||
if ioctl(fd, FS_IOC_SETFLAGS, &flags) == -1:
|
||||
raise OSError(errno, strerror(errno).decode(), path)
|
||||
if errno.errno != errno.EOPNOTSUPP:
|
||||
raise OSError(errno, strerror(errno).decode(), path)
|
||||
finally:
|
||||
if open_fd:
|
||||
os.close(fd)
|
||||
|
|
|
@ -997,14 +997,21 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|||
self.create_regular_file('file1', size=1024 * 80)
|
||||
os.utime('input/file1', (now - 5, now - 5)) # 5 seconds ago
|
||||
self.create_regular_file('file2', size=1024 * 80)
|
||||
if has_lchflags:
|
||||
self.create_regular_file('file3', size=1024 * 80)
|
||||
platform.set_flags(os.path.join(self.input_path, 'file3'), stat.UF_NODUMP)
|
||||
self.cmd('init', self.repository_location)
|
||||
output = self.cmd('create', '--list', self.repository_location + '::test', 'input')
|
||||
self.assert_in("A input/file1", output)
|
||||
self.assert_in("A input/file2", output)
|
||||
if has_lchflags:
|
||||
self.assert_in("x input/file3", output)
|
||||
# should find second file as excluded
|
||||
output = self.cmd('create', '--list', self.repository_location + '::test1', 'input', '--exclude', '*/file2')
|
||||
self.assert_in("U input/file1", output)
|
||||
self.assert_in("x input/file2", output)
|
||||
if has_lchflags:
|
||||
self.assert_in("x input/file3", output)
|
||||
|
||||
def test_create_topical(self):
|
||||
now = time.time()
|
||||
|
|
Loading…
Add table
Reference in a new issue