]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Show better error when script fails with exit code 127
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 9 Feb 2025 21:11:44 +0000 (22:11 +0100)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Mon, 10 Feb 2025 09:45:26 +0000 (10:45 +0100)
Fixes #3481

mkosi/run.py

index 3cc3b01ee26ca6313c7b1185e039917c2eece040..441125679ee9275f17fc2d382b471ce28c232a28 100644 (file)
@@ -134,7 +134,16 @@ def log_process_failure(sandbox: Sequence[str], cmdline: Sequence[str], returnco
             f" was killed by {signal.Signals(-returncode).name} signal."
         )
     elif returncode == 127:
-        logging.error(f"{cmdline[0]} not found.")
+        # Anything invoked beneath /work is a script that we mount into place (so we know it exists). If one
+        # of these scripts fails with exit code 127, it's either because the script interpreter was not
+        # installed or because one of the commands in the script failed with exit code 127.
+        if cmdline[0].startswith("/work"):
+            logging.error(f"{cmdline[0]} failed with non-zero exit code 127")
+            logging.info(
+                "(Maybe a program was not found or the script interpreter (e.g. bash) is not installed?)"
+            )
+        else:
+            logging.error(f"{cmdline[0]} not found.")
     else:
         logging.error(
             f'"{shlex.join([*sandbox, *cmdline] if ARG_DEBUG.get() else cmdline)}"'