import-tar: support fifos and blk/chr devices

This commit is contained in:
Thomas Waldmann 2021-01-25 20:44:07 +01:00
parent 5a3d9db4f7
commit 5304693c55
2 changed files with 14 additions and 3 deletions

View file

@ -1789,8 +1789,19 @@ class Archiver:
status = 'h'
item = tarinfo_to_item(tarinfo, stat.S_IFREG)
item.source = tarinfo.linkname
elif tarinfo.isblk():
status = 'b'
item = tarinfo_to_item(tarinfo, stat.S_IFBLK)
item.rdev = os.makedev(tarinfo.devmajor, tarinfo.devminor)
elif tarinfo.ischr():
status = 'c'
item = tarinfo_to_item(tarinfo, stat.S_IFCHR)
item.rdev = os.makedev(tarinfo.devmajor, tarinfo.devminor)
elif tarinfo.isfifo():
status = 'f'
item = tarinfo_to_item(tarinfo, stat.S_IFIFO)
else:
# TODO: chr and blk devices, fifos? GNUTYPE_SPARSE?
# TODO: GNUTYPE_SPARSE?
self.print_warning('%s: Unsupported tar type %s', tarinfo.name, tarinfo.type)
self.print_file_status('E', tarinfo.name)
continue

View file

@ -3416,7 +3416,6 @@ id: 2 / e29442 3506da 4e1ea7 / 25f62a 5a3d41 - 02
def test_import_tar(self):
self.create_test_files()
os.unlink('input/flagfile')
os.unlink('input/fifo1') # TODO: not yet supported
self.cmd('init', '--encryption=none', self.repository_location)
self.cmd('create', self.repository_location + '::src', 'input')
self.cmd('export-tar', self.repository_location + '::src', 'simple.tar')
@ -3431,7 +3430,8 @@ input/dir2
input/dir2/file2
input/link1
input/fusexattr
input/empty""".splitlines())
input/empty
input/fifo1""".splitlines())
def test_detect_attic_repo(self):
path = make_attic_repo(self.repository_path)