Patch specinvoke to report execve failure

This commit is contained in:
Rodrigo Arias 2024-10-08 16:31:07 +02:00
parent ce70726bf6
commit 7e68d432f9
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,15 @@
--- a/unix.c 2024-10-08 12:30:18.785111397 +0200
+++ b/unix.c 2024-10-08 12:32:09.580923368 +0200
@@ -165,7 +165,11 @@ pid_t invoke(copy_info_t *ui, command_in
/* We could redirect them here. This might be useful for VMS? */
*(si->command_ptr) = cmd;
si->invoke_args[0] = si->shell;
- execve(si->shell, si->invoke_args, env);
+ if (execve(si->shell, si->invoke_args, env) != 0) {
+ fprintf (stderr, "Can't execute command: %s(%d)\n",
+ STRERROR(errno), errno);
+ specinvoke_exit (1, si);
+ }
} else { /* Parent */
ui->pid = pid;
fprintf (si->outfp,

View File

@ -20,6 +20,9 @@ in stdenv.mkDerivation {
version = version; version = version;
src = tar; src = tar;
sourceRoot = "tools/src/specinvoke/"; sourceRoot = "tools/src/specinvoke/";
patches = [
./specinvoke-execve.patch
];
# Almost no bugs # Almost no bugs
preInstall = '' preInstall = ''
mkdir -p $out/bin mkdir -p $out/bin