]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
sandbox: Don't allow nested mkosi sandbox invocations 3363/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 15 Jan 2025 11:06:53 +0000 (12:06 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 15 Jan 2025 11:14:45 +0000 (12:14 +0100)
Until a good usecase pops up it's probably best to disallow this since
when it happens it's most likely a user error rather than intended.

mkosi/__init__.py

index 01ffbe3c59e183fc07335177be59f477a0afa757..5435279ab50a8efa077c49bf81ae0a20c95538a4 100644 (file)
@@ -3766,6 +3766,12 @@ def in_sandbox() -> bool:
 
 
 def run_sandbox(args: Args, config: Config) -> None:
+    if in_sandbox():
+        die(
+            "mkosi sandbox cannot be invoked from within another mkosi sandbox environment",
+            hint="Exit the current sandbox environment and try again",
+        )
+
     if not args.cmdline:
         die("Please specify a command to execute in the sandbox")