From eab83d361274b5474d30f34dab02b1b4c26a064e Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Thu, 22 Feb 2024 08:19:22 +0100 Subject: [PATCH] Fix resolving config symlink to the actual config file --- osc/conf.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osc/conf.py b/osc/conf.py index a581b1aa..f77d183d 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -1606,14 +1606,14 @@ def get_configParser(conffile=None, force_read=False): def write_config(fname, cp): """write new configfile in a safe way""" - if os.path.exists(fname) and not os.path.isfile(fname): - # only write to a regular file - return - # config file is behind a symlink # resolve the symlink and continue writing the config as usual if os.path.islink(fname): - fname = os.readlink(fname) + fname = os.path.realpath(fname) + + if os.path.exists(fname) and not os.path.isfile(fname): + # only write to a regular file + return # create directories to the config file (if they don't exist already) fdir = os.path.dirname(fname)