From 6a9398a97b4348778976ce8947aef7831bfc682b Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Sun, 24 Jul 2022 15:36:23 +0300 Subject: [PATCH] Fix failure to create config in current dir This uses exception based protection from parallel execution https://github.com/openSUSE/osc/pull/1077#discussion_r928976845 --- osc/conf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osc/conf.py b/osc/conf.py index c6fba94c..32991a7e 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -827,9 +827,10 @@ def write_config(fname, cp): fname = os.readlink(fname) # create directories to the config file (if they don't exist already) - if not os.path.exists(os.path.dirname(fname)): + fdir = os.path.dirname(fname) + if fdir: try: - os.makedirs(os.path.dirname(fname), mode=0o700) + os.makedirs(fdir, mode=0o700) except OSError as e: if e.errno != errno.EEXIST: raise