From: Daan De Meyer Date: Sun, 9 Feb 2025 21:11:44 +0000 (+0100) Subject: Show better error when script fails with exit code 127 X-Git-Tag: v26~401 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=056cb567f4ebed34fc2ae3577c3404f576283d56;p=thirdparty%2Fmkosi.git Show better error when script fails with exit code 127 Fixes #3481 --- diff --git a/mkosi/run.py b/mkosi/run.py index 3cc3b01ee..441125679 100644 --- a/mkosi/run.py +++ b/mkosi/run.py @@ -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)}"'