1
1

Fix misleading error message with missing #! interpreter

This change fixes the misleading error message. I added a conditional to
determine whether the error is due to a missing file or a bad interpreter.
If it is the latter, a new, more precise error message will be displayed.

Fixes #4528

Signed-off-by: Maxwell Coil <mcoil@nd.edu>
Этот коммит содержится в:
Maxwell Coil 2019-11-10 14:58:55 -05:00
родитель 7e07346524
Коммит 9b73f6ac83

Просмотреть файл

@ -454,11 +454,22 @@ static int do_child(orte_odls_spawn_caddy_t *cd, int write_fd)
/* Exec the new executable */
execve(cd->cmd, cd->argv, cd->env);
getcwd(dir, sizeof(dir));
/* If we get here, an error has occurred. */
(void) getcwd(dir, sizeof(dir));
struct stat stats;
char* msg;
/* If errno is ENOENT, that indicates either cd->cmd does not exist, or
* cd->cmd is a script, but has a bad interpreter specified. */
if (ENOENT == errno && 0 == stat(cd->app->app, &stats)) {
asprintf(&msg, "%s has a bad interpreter on the first line.",
cd->app->app);
} else {
msg = strdup(strerror(errno));
}
send_error_show_help(write_fd, 1,
"help-orte-odls-default.txt", "execve error",
orte_process_info.nodename, dir, cd->app->app, strerror(errno));
/* Does not return */
orte_process_info.nodename, dir, cd->app->app, msg);
free(msg);
}