From b5b5e7be29d6283b91c1603960f2b8acbbeac027 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Mon, 27 Jan 2020 17:42:51 +0100 Subject: [PATCH] objectstore: also ignore EEXIST when committing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the tree is committed to the objects directory of the object- store, it is done via rename(3). The two possible errors that can be raised in case that a non-empty tree with the same name already exist is [EEXIST] or [ENOTEMPTY]. The latter was already ignored but the former was not. At least on btrfs former will be raised File "/home/gicmo/Code/src/osbuild/osbuild/objectstore.py", os.rename(tree.root, output_tree) FileExistsError: [Errno 17] File exists: 'store/tmpyyi3yvie/tree' -> 'store/objects/…' --- osbuild/objectstore.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osbuild/objectstore.py b/osbuild/objectstore.py index 3bb50b44..23809855 100644 --- a/osbuild/objectstore.py +++ b/osbuild/objectstore.py @@ -144,7 +144,7 @@ class ObjectStore: output_tree = f"{self.objects}/{treesum_hash}" # if a tree with the same treesum already exist, use that - with suppress_oserror(errno.ENOTEMPTY): + with suppress_oserror(errno.ENOTEMPTY, errno.EEXIST): os.rename(tree.path, output_tree) tree.path = output_tree