From 23e79a03d06fdf2aca55ba6f800cced8b400dfbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Billeter?= Date: Fri, 30 Aug 2019 07:16:48 +0200 Subject: tests/testutils/repo/bzr.py: Work around race condition in bzr This works around a TOCTTOU race condition in bzr's creation of ~/.bazaar in ensure_config_dir_exists() when running tests in parallel. --- tests/testutils/repo/bzr.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/testutils/repo/bzr.py b/tests/testutils/repo/bzr.py index 7b2392f46..074712af1 100644 --- a/tests/testutils/repo/bzr.py +++ b/tests/testutils/repo/bzr.py @@ -18,6 +18,11 @@ class Bzr(Repo): self.env.update(BZR_ENV) def create(self, directory): + # Work around race condition in bzr's creation of ~/.bazaar in + # ensure_config_dir_exists() when running tests in parallel. + bazaar_config_dir = os.path.expanduser('~/.bazaar') + os.makedirs(bazaar_config_dir, exist_ok=True) + branch_dir = os.path.join(self.repo, 'trunk') subprocess.call([self.bzr, 'init-repo', self.repo], env=self.env) -- cgit v1.2.1