From 253f6f6ca5c747c74bb08af1faa19991449ca0d9 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Fri, 26 Apr 2024 10:18:39 +0200 Subject: [PATCH 1/2] Fix conf.get_config() to correctly handle overrides when env variables are set --- osc/conf.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osc/conf.py b/osc/conf.py index 31c5c9ecb..06e93d130 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -1974,6 +1974,9 @@ def get_config(override_conffile=None, # priority: env, overrides, config if env_key in os.environ: value = os.environ[env_key] + # remove any matching records from overrides because they are checked for emptiness later + overrides.pop(name, None) + overrides.pop(ini_key, None) elif name in overrides: value = overrides.pop(name) elif ini_key in overrides: From 2bf7e7177742790f0439cad7e0e76e7038eb9a25 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Fri, 26 Apr 2024 10:30:54 +0200 Subject: [PATCH 2/2] Fix conf.get_config() to ignore file type bits when comparing oscrc perms --- osc/conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osc/conf.py b/osc/conf.py index 06e93d130..d53867e69 100644 --- a/osc/conf.py +++ b/osc/conf.py @@ -1869,7 +1869,8 @@ def get_config(override_conffile=None, # make sure oscrc is not world readable, it may contain a password conffile_stat = os.stat(conffile) - if conffile_stat.st_mode != 0o600: + # applying 0o7777 mask because we want to ignore the file type bits + if conffile_stat.st_mode & 0o7777 != 0o600: try: os.chmod(conffile, 0o600) except OSError as e: