From: Zbigniew Jędrzejewski-Szmek Date: Mon, 28 Aug 2023 15:44:42 +0000 (+0300) Subject: ukify: fail if the config file was not read X-Git-Tag: v255-rc1~621^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F28999%2Fhead;p=thirdparty%2Fsystemd.git ukify: fail if the config file was not read Inspired by https://github.com/systemd/systemd/pull/28997. Noticed by Alvin Alvarado . --- diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index 10a464bb1a3..b7e21dafed7 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -1413,7 +1413,10 @@ def apply_config(namespace, filename=None): # Do not make keys lowercase cp.optionxform = lambda option: option - cp.read(filename) + # The API is not great. + read = cp.read(filename) + if not read: + raise IOError(f'Failed to read {filename}') for section_name, section in cp.items(): idx = section_name.find(':')