mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-25 09:19:31 +00:00
Fix hardlink bug and added corresponding test case
This commit is contained in:
parent
231c06f0d5
commit
84b4b08309
2 changed files with 5 additions and 1 deletions
|
@ -224,7 +224,9 @@ def process_file(self, path, st, cache):
|
||||||
if st.st_nlink > 1:
|
if st.st_nlink > 1:
|
||||||
source = self.hard_links.get((st.st_ino, st.st_dev))
|
source = self.hard_links.get((st.st_ino, st.st_dev))
|
||||||
if (st.st_ino, st.st_dev) in self.hard_links:
|
if (st.st_ino, st.st_dev) in self.hard_links:
|
||||||
self.items.append({'path': path, 'source': source})
|
self.items.append({'mode': st.st_mode,
|
||||||
|
'path': path,
|
||||||
|
'source': source})
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self.hard_links[st.st_ino, st.st_dev] = safe_path
|
self.hard_links[st.st_ino, st.st_dev] = safe_path
|
||||||
|
|
|
@ -92,6 +92,8 @@ def test_basic_functionality(self):
|
||||||
self.create_regual_file('dir2/file2', size=1024*80)
|
self.create_regual_file('dir2/file2', size=1024*80)
|
||||||
x = xattr(os.path.join(self.input_path, 'file1'))
|
x = xattr(os.path.join(self.input_path, 'file1'))
|
||||||
x.set('user.foo', 'bar')
|
x.set('user.foo', 'bar')
|
||||||
|
os.link(os.path.join(self.input_path, 'file1'),
|
||||||
|
os.path.join(self.input_path, 'hardlink'))
|
||||||
os.symlink('somewhere', os.path.join(self.input_path, 'link1'))
|
os.symlink('somewhere', os.path.join(self.input_path, 'link1'))
|
||||||
os.mkfifo(os.path.join(self.input_path, 'fifo1'))
|
os.mkfifo(os.path.join(self.input_path, 'fifo1'))
|
||||||
self.darc('create', self.store_path + '::test', 'input')
|
self.darc('create', self.store_path + '::test', 'input')
|
||||||
|
|
Loading…
Reference in a new issue