commit bash-20140314 snapshot

This commit is contained in:
Chet Ramey
2014-03-21 14:15:01 -04:00
parent f7958d04bb
commit 939d190e0e
17 changed files with 1785 additions and 20 deletions
+59
View File
@@ -5910,3 +5910,62 @@ parse.y
posix mode if dolbrace_state == DOLBRACE_QUOTE2 (pattern
substitution). Fixes bug reported by David Sines
<dave.gma@googlemail.com>
3/10
----
lib/readline/readline.c
- _rl_dispatch_callback: treat a return value of -1 as the end of
a command dispatch sequence if the current context doesn't
indicate that we're reading a multi-key sequence
((cxt->flags & KSEQ_SUBSEQ) == 0). Turn off the multikey flag
and free the context chain in this case. Fixes one bug reported
by Felix Yan <felixonmars@gmail.com> to bug-readline list
- _rl_dispatch_callback: treat a return value of > 0 the same as 0
and return from the function, since only values < 0 cause us to
simulate recursion. Rest of fix for bug tracked down by
Anatol Pomozov <anatol.pomozov@gmail.com>
3/11
----
execute_cmd.c
- execute_in_subshell: if a longjmp occurs, set result to
EXECUTION_FAILURE only if last_command_exit_value == EXECUTION_SUCCESS;
use value of last_command_exit_value otherwise. Fixes cosmetic
issue reported by Dennis Lambe Jr. <malsyned@malsyned.net>
doc/bash.1
- shell-kill-word and shell-backward-kill-word should be documented
as unbound by default. Report from Oliver Hartley
<ohartley@talktalk.net>
trap.c
- run_pending_traps: save value of $? before running trap commands in
trap_saved_exit_value, like run_exit_trap
- _run_trap_internal: save value of $? before running trap commands in
trap_saved_exit_value, like run_exit_trap
builtins/common.c
- get_exitstat: when running `return' in a trap action, and it is not
supplied an argument, use the saved exit status in
trap_saved_exit_value. Fixes Posix problem reported by
Eduardo A. Bustamante López <dualbus@gmail.com>
3/13
----
lib/sh/shquote.c
- sh_contains_quotes: new function, returns true if a given string
contains any of the shell quote characters (single quote, double
quote, or backslash)
externs.h
- sh_contains_quotes: new extern declaration
pcomplete.c
- pcomp_filename_completion_function: more changes for the benefit of
bash-completion: if the argument is not the same as the original
argument passed to the programmable completion code (pcomp_curtxt),
and we are being run by compgen as part of a completion, dequote the
argument as bash-completion expects. Fix for the complete-word-
with-quoted-special-chars problem with bash-completion
+6 -1
View File
@@ -70,6 +70,7 @@ extern int errno;
extern int indirection_level, subshell_environment;
extern int line_number;
extern int last_command_exit_value;
extern int trap_saved_exit_value;
extern int running_trap;
extern int posixly_correct;
extern char *this_command_name, *shell_name;
@@ -494,7 +495,11 @@ get_exitstat (list)
list = list->next;
if (list == 0)
return (last_command_exit_value);
{
if (this_shell_builtin == return_builtin && running_trap)
return (trap_saved_exit_value);
return (last_command_exit_value);
}
arg = list->word->word;
if (arg == 0 || legal_number (arg, &sval) == 0)
+7 -5
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet.ramey@case.edu
.\"
.\" Last Change: Sun Feb 2 16:21:40 EST 2014
.\" Last Change: Wed Mar 12 09:29:03 EDT 2014
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2014 February 2" "GNU Bash 4.3"
.TH BASH 1 "2014 March 12" "GNU Bash 4.3"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -976,7 +976,9 @@ The \fIbody\fP of the function is the compound command
.I compound\-command
(see \fBCompound Commands\fP above).
That command is usually a \fIlist\fP of commands between { and }, but
may be any command listed under \fBCompound Commands\fP above.
may be any command listed under \fBCompound Commands\fP above,
with one exception: If the \fBfunction\fP reserved word is used, but the
parentheses are not supplied, the braces are required.
\fIcompound\-command\fP is executed whenever \fIname\fP is specified as the
name of a simple command.
When in \fIposix mode\fP, \fIname\fP may not be the name of one of the
@@ -5907,12 +5909,12 @@ Word boundaries are the same as those used by \fBforward\-word\fP.
Kill the word behind point.
Word boundaries are the same as those used by \fBbackward\-word\fP.
.TP
.B shell\-kill\-word (M\-d)
.B shell\-kill\-word
Kill from point to the end of the current word, or if between
words, to the end of the next word.
Word boundaries are the same as those used by \fBshell\-forward\-word\fP.
.TP
.B shell\-backward\-kill\-word (M\-Rubout)
.B shell\-backward\-kill\-word
Kill the word behind point.
Word boundaries are the same as those used by \fBshell\-backward\-word\fP.
.TP
+3 -1
View File
@@ -1346,7 +1346,9 @@ word is supplied, the parentheses are optional.
The @var{body} of the function is the compound command
@var{compound-command} (@pxref{Compound Commands}).
That command is usually a @var{list} enclosed between @{ and @}, but
may be any compound command listed above.
may be any compound command listed above,
with one exception: If the @code{function} reserved word is used, but the
parentheses are not supplied, the braces are required.
@var{compound-command} is executed whenever @var{name} is specified as the
name of a command.
When the shell is in @sc{posix} mode (@pxref{Bash POSIX Mode}),
+3 -3
View File
@@ -2,9 +2,9 @@
Copyright (C) 1988-2014 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Sun Feb 2 16:22:00 EST 2014
@set LASTCHANGE Wed Mar 12 09:28:39 EDT 2014
@set EDITION 4.3
@set VERSION 4.3
@set UPDATED 2 February 2014
@set UPDATED-MONTH February 2014
@set UPDATED 12 March 2014
@set UPDATED-MONTH March 2014
+2 -2
View File
@@ -218,7 +218,7 @@ int return_catch_value;
procenv_t return_catch;
/* The value returned by the last synchronous command. */
int last_command_exit_value;
volatile int last_command_exit_value;
/* Whether or not the last command (corresponding to last_command_exit_value)
was terminated by a signal, and, if so, which one. */
@@ -1567,7 +1567,7 @@ execute_in_subshell (command, asynchronous, pipe_in, pipe_out, fds_to_close)
if (result == EXITPROG)
invert = 0, return_code = last_command_exit_value;
else if (result)
return_code = EXECUTION_FAILURE;
return_code = (last_command_exit_value == EXECUTION_SUCCESS) ? EXECUTION_FAILURE : last_command_exit_value;
else if (function_value)
return_code = return_catch_value;
else
+1
View File
@@ -324,6 +324,7 @@ extern char *sh_un_double_quote __P((char *));
extern char *sh_backslash_quote __P((char *, const char *, int));
extern char *sh_backslash_quote_for_double_quotes __P((char *));
extern int sh_contains_shell_metas __P((char *));
extern int sh_contains_quotes __P((char *));
/* declarations for functions defined in lib/sh/spell.c */
extern int spname __P((char *, char *));
+1 -1
View File
@@ -282,7 +282,7 @@ At the very least, it should be aware that it can be passed a
negative argument.
A command function should return 0 if its action completes successfully,
and a non-zero value if some error occurs.
and a value greater than zero if some error occurs.
This is the convention obeyed by all of the builtin Readline bindable
command functions.
+3
View File
@@ -185,6 +185,7 @@ rl_gather_tyi ()
#endif
chars_avail = 0;
input = 0;
tty = fileno (rl_instream);
#if defined (HAVE_SELECT)
@@ -204,6 +205,8 @@ rl_gather_tyi ()
result = ioctl (tty, FIONREAD, &chars_avail);
if (result == -1 && errno == EIO)
return -1;
if (result == -1)
chars_avail = 0;
#endif
#if defined (O_NDELAY)
+1 -1
View File
@@ -117,7 +117,7 @@ rl_insert_close (count, invoking_key)
/* Emacs might message or ring the bell here, but I don't. */
if (match_point < 0)
return -1;
return 1;
FD_ZERO (&readfds);
FD_SET (fileno (rl_instream), &readfds);
+3 -2
View File
@@ -744,7 +744,8 @@ _rl_dispatch_callback (cxt)
r = _rl_subseq_result (r, cxt->oldmap, cxt->okey, (cxt->flags & KSEQ_SUBSEQ));
RL_CHECK_SIGNALS ();
if (r == 0) /* success! */
/* We only treat values < 0 specially to simulate recursion. */
if (r >= 0 || (r == -1 && (cxt->flags & KSEQ_SUBSEQ) == 0)) /* success! or failure! */
{
_rl_keyseq_chain_dispose ();
RL_UNSETSTATE (RL_STATE_MULTIKEY);
@@ -946,7 +947,7 @@ _rl_dispatch_subseq (key, map, got_subseq)
}
else
{
_rl_abort_internal ();
_rl_abort_internal (); /* XXX */
return -1;
}
break;
+2 -2
View File
@@ -411,7 +411,7 @@ rl_noninc_forward_search_again (count, key)
if (!noninc_search_string)
{
rl_ding ();
return (-1);
return (1);
}
r = noninc_dosearch (noninc_search_string, 1);
return (r != 1);
@@ -428,7 +428,7 @@ rl_noninc_reverse_search_again (count, key)
if (!noninc_search_string)
{
rl_ding ();
return (-1);
return (1);
}
r = noninc_dosearch (noninc_search_string, -1);
return (r != 1);
+2
View File
@@ -107,6 +107,8 @@ _rl_abort_internal ()
while (rl_executing_macro)
_rl_pop_executing_macro ();
RL_UNSETSTATE (RL_STATE_MULTIKEY); /* XXX */
rl_last_func = (rl_command_func_t *)NULL;
#if defined (HAVE_POSIX_SIGSETJMP)
siglongjmp (_rl_top_level, 1);
+14
View File
@@ -311,3 +311,17 @@ sh_contains_shell_metas (string)
return (0);
}
int
sh_contains_quotes (string)
char *string;
{
char *s;
for (s = string; s && *s; s++)
{
if (*s == '\'' || *s == '"' || *s == '\\')
return 1;
}
return 0;
}
+17 -1
View File
@@ -762,7 +762,23 @@ pcomp_filename_completion_function (text, state)
pcomp_curtxt && *pcomp_curtxt == 0 &&
text && (*text == '\'' || *text == '"') && text[1] == text[0] && text[2] == 0 &&
rl_filename_dequoting_function)
dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character);
dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character);
/* Another mismatched assumption by bash-completion. If compgen is being
run as part of bash-completion, and the argument to compgen is not
the same as the word originally passed to the programmable completion
code, dequote the argument if it has quote characters. It's an
attempt to detect when bash-completion is quoting its filename
argument before calling compgen. */
/* We could check whether gen_shell_function_matches is in the call
stack by checking whether the gen-shell-function-matches tag is in
the unwind-protect stack, but there's no function to do that yet.
We could simply check whether we're executing in a function by
checking variable_context, and may end up doing that. */
else if (iscompgen && iscompleting && rl_filename_dequoting_function &&
pcomp_curtxt && text &&
STREQ (pcomp_curtxt, text) == 0 &&
sh_contains_quotes (text)) /* guess */
dfn = (*rl_filename_dequoting_function) ((char *)text, rl_completion_quote_character);
else
dfn = savestring (text);
}
+1659
View File
File diff suppressed because it is too large Load Diff
+2 -1
View File
@@ -304,7 +304,7 @@ run_pending_traps ()
catch_flag = trapped_signal_received = 0;
/* Preserve $? when running trap. */
old_exit_value = last_command_exit_value;
trap_saved_exit_value = old_exit_value = last_command_exit_value;
#if defined (ARRAY_VARS)
ps = save_pipestatus_array ();
#endif
@@ -894,6 +894,7 @@ _run_trap_internal (sig, tag)
#endif
trap_exit_value = function_code = 0;
trap_saved_exit_value = last_command_exit_value;
/* Run the trap only if SIG is trapped and not ignored, and we are not
currently executing in the trap handler. */
if ((sigmodes[sig] & SIG_TRAPPED) && ((sigmodes[sig] & SIG_IGNORED) == 0) &&