From: Georges Discry Date: Sun, 23 Apr 2023 12:51:08 +0000 (+0200) Subject: Disallow `:` with an empty target X-Git-Tag: v15~212 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c81dae93f6f10f1a985e9d0538254720e8a0a5a;p=thirdparty%2Fmkosi.git Disallow `:` with an empty target The configurations of the form `[:]` require an absolute target if given. However, `:` would be ambiguously interpreted as `` so it is now disallowed. For reference, `systemd-nspawn --bind` uses a similar form and refuses to take an empty target. --- diff --git a/mkosi/config.py b/mkosi/config.py index 575e00d31..df1389cf5 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -70,9 +70,9 @@ def parse_path(value: str, *, required: bool, absolute: bool = True, expanduser: def parse_source_target_paths(value: str) -> tuple[Path, Optional[Path]]: - src, _, target = value.partition(':') + src, sep, target = value.partition(':') src_path = parse_path(src, required=True) - if target: + if sep: target_path = parse_path(target, required=False, absolute=False, expanduser=False) if not target_path.is_absolute(): die("Target path must be absolute")