From 84b4b08309a9f6f494db525144ab1c87a252de14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Borgstr=C3=B6m?= Date: Tue, 23 Nov 2010 12:55:42 +0100 Subject: [PATCH] Fix hardlink bug and added corresponding test case --- darc/archive.py | 4 +++- darc/test.py | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/darc/archive.py b/darc/archive.py index 5f0efdfd7..ffb7261e3 100644 --- a/darc/archive.py +++ b/darc/archive.py @@ -224,7 +224,9 @@ def process_file(self, path, st, cache): if st.st_nlink > 1: source = self.hard_links.get((st.st_ino, st.st_dev)) 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 else: self.hard_links[st.st_ino, st.st_dev] = safe_path diff --git a/darc/test.py b/darc/test.py index f6cbe475d..b9bdea66f 100644 --- a/darc/test.py +++ b/darc/test.py @@ -92,6 +92,8 @@ def test_basic_functionality(self): self.create_regual_file('dir2/file2', size=1024*80) x = xattr(os.path.join(self.input_path, 'file1')) 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.mkfifo(os.path.join(self.input_path, 'fifo1')) self.darc('create', self.store_path + '::test', 'input')