From 39f48419a0dac60d162a77a685dbdc55461ac032 Mon Sep 17 00:00:00 2001 From: Marian Beermann Date: Sat, 9 Jul 2016 02:28:54 +0200 Subject: [PATCH] fuse: fix directories being shadowed when contained paths where also specified --- borg/fuse.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/borg/fuse.py b/borg/fuse.py index bb507fc54..19f8d71f2 100644 --- a/borg/fuse.py +++ b/borg/fuse.py @@ -76,6 +76,16 @@ class FuseOperations(llfuse.Operations): data = self.key.decrypt(key, chunk) unpacker.feed(data) for item in unpacker: + try: + # This can happen if an archive was created with a command line like + # $ borg create ... dir1/file dir1 + # In this case the code below will have created a default_dir inode for dir1 already. + inode = self._find_inode(item[b'path'], prefix) + except KeyError: + pass + else: + self.items[inode] = item + continue segments = prefix + os.fsencode(os.path.normpath(item[b'path'])).split(b'/') del item[b'path'] num_segments = len(segments)