From 66119cfc34d33cc1de7f760c636f7c1f3e74e70e Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Fri, 6 Jun 2014 13:57:23 -0400 Subject: [PATCH] commit bash-20140530 snapshot --- CWRU/CWRU.chlog | 8 ++++++++ doc/bash.1 | 2 +- doc/bashref.texi | 2 +- execute_cmd.c | 5 +++-- lib/readline/input.c | 2 +- patchlevel.h | 2 +- 6 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog index 6a202fb30..9c1cae94f 100644 --- a/CWRU/CWRU.chlog +++ b/CWRU/CWRU.chlog @@ -6291,3 +6291,11 @@ arrayfunc.c - bind_array_var_internal: make sure ENTRY no longer has invisible attribute before returning. Fixes bug reported by Geir Hauge + + 5/22 + ---- +execute_cmd.c + - shell_execve: if execve fails and we return 127 or 126, make sure to + set last_command_exit_value if a call to file_error or report_error + causes the shell to exit. This ensures that the shell exits with + the right value. diff --git a/doc/bash.1 b/doc/bash.1 index b96c6a461..023cd9d39 100644 --- a/doc/bash.1 +++ b/doc/bash.1 @@ -6909,7 +6909,7 @@ or was started without job control. .TP \fBbind\fP [\fB\-m\fP \fIkeymap\fP] \fIkeyseq\fP:\fIfunction\-name\fP .TP -\fBbind\fP \fIreadline\-command\fP +\fBbind\fP [\fB\-m\fP \fIkeymap\fP] \fIkeyseq\fP:\fIreadline\-command\fP .PD Display current .B readline diff --git a/doc/bashref.texi b/doc/bashref.texi index 490ad084a..d552757dc 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -3773,7 +3773,7 @@ bind [-m @var{keymap}] [-q @var{function}] [-u @var{function}] [-r @var{keyseq}] bind [-m @var{keymap}] -f @var{filename} bind [-m @var{keymap}] -x @var{keyseq:shell-command} bind [-m @var{keymap}] @var{keyseq:function-name} -bind @var{readline-command} +bind [-m @var{keymap}] @var{keyseq:readline-command} @end example Display current Readline (@pxref{Command Line Editing}) diff --git a/execute_cmd.c b/execute_cmd.c index d9dc18b79..44a8afcf9 100644 --- a/execute_cmd.c +++ b/execute_cmd.c @@ -4735,7 +4735,6 @@ execute_builtin_or_function (words, builtin, var, redirects, char *ofifo_list; #endif - #if defined (PROCESS_SUBSTITUTION) ofifo = num_fifos (); ofifo_list = copy_fifo_list (&osize); @@ -5219,6 +5218,8 @@ shell_execve (command, args, env) Maybe it is something we can hack ourselves. */ if (i != ENOEXEC) { + /* make sure this is set correctly for file_error/report_error */ + last_command_exit_value = (i == ENOENT) ? EX_NOTFOUND : EX_NOEXEC; /* XXX Posix.2 says that exit status is 126 */ if (file_isdir (command)) #if defined (EISDIR) internal_error (_("%s: %s"), command, strerror (EISDIR)); @@ -5266,7 +5267,7 @@ shell_execve (command, args, env) errno = i; file_error (command); } - return ((i == ENOENT) ? EX_NOTFOUND : EX_NOEXEC); /* XXX Posix.2 says that exit status is 126 */ + return (last_command_exit_value); } /* This file is executable. diff --git a/lib/readline/input.c b/lib/readline/input.c index 598759145..0e5b90e60 100644 --- a/lib/readline/input.c +++ b/lib/readline/input.c @@ -525,7 +525,7 @@ rl_getc (stream) #undef X_EWOULDBLOCK #undef X_EAGAIN -fprintf(stderr, "rl_getc: result = %d errno = %d\n", result, errno); +/* fprintf(stderr, "rl_getc: result = %d errno = %d\n", result, errno); */ /* If the error that we received was EINTR, then try again, this is simply an interrupted system call to read (). We allow diff --git a/patchlevel.h b/patchlevel.h index b7c2ff4c1..d669696c4 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -25,6 +25,6 @@ regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh looks for to find the patch level (for the sccs version string). */ -#define PATCHLEVEL 11 +#define PATCHLEVEL 18 #endif /* _PATCHLEVEL_H_ */ -- 2.47.2