commit bash-20130712 snapshot

This commit is contained in:
Chet Ramey
2013-08-05 09:54:58 -04:00
parent ef5b315f17
commit fc34b3a446
16 changed files with 8901 additions and 24 deletions
+49
View File
@@ -5030,3 +5030,52 @@ lib/sh/casemod.c
- sh_modcase: make sure argument passed to is_basic is <= UCHAR_MAX,
since cval can convert something to a wchar_t greater than UCHAR_MAX.
Fixes bug reported by Tomasz Tomasik <scx.mail@gmail.com>
7/8
---
lib/readline/history.c
- add_history_time: if history_length == 0, referencing history_length
- 1 will result in an array bounds error, so make history_length be
at least 1 before going on. Fixes bug reported by Geng Sheng Liu
<gsliu.tju@gmail.com>
builtins/setattr.def
- show_func_attributes: display definition (if NODEFS argument is 0) and
attributes for a particular function; used by `declare -fp name'
builtins/declare.def
- declare_internal: call show_func_attributes if -f supplied with -p.
Fixes inconsistency observed by Linda Walsh <bash@tlinx.org>
builtins/common.h
- new extern declaration for show_func_attributes
builtins/read.def
- read_builtin: check the first supplied variable name for validity
before attempting to read any input, since we know we will have to
at least use that one. Don't check any other names yet. Suggested
by jidanni@jidanni.org
7/10
----
redir.c
- do_redirection_internal: when closing a file descriptor with
r_close_this ([n]<&-) count close errors as redirection errors if
errno ends up as EIO or ENOSPC. Originally reported back in April
2012 by Andrey Zaitsev <jstcdr@gmail.com>
7/11
----
redir.c
- do_redirection_internal: before calling check_bash_input, make sure
that we don't call check_bash_input for an asynchronous process that
is replacing stdin with something else. The seek backwards affects
the parent process as well, since parents and children share the
file pointer. Fixes problem originally reported in March 2013 by
Martin Jackson <mjackson220.list@gmail.com>
7/13
----
doc/{bash.1,bashref.texi}
- slight change to add a description of `shopt -o' suggested by Bruce
Korb <bruce.korb@gmail.com>
+50
View File
@@ -5023,3 +5023,53 @@ subst.c
are trying to manipulate an indirect variable reference like
${!b%%foo}. This makes a difference if !b references an array
variable. Bug report from Dan Douglas <ormaaj@gmail.com>
7/6
---
lib/sh/casemod.c
- sh_modcase: make sure argument passed to is_basic is <= UCHAR_MAX,
since cval can convert something to a wchar_t greater than UCHAR_MAX.
Fixes bug reported by Tomasz Tomasik <scx.mail@gmail.com>
7/8
---
lib/readline/history.c
- add_history_time: if history_length == 0, referencing history_length
- 1 will result in an array bounds error, so make history_length be
at least 1 before going on. Fixes bug reported by Geng Sheng Liu
<gsliu.tju@gmail.com>
builtins/setattr.def
- show_func_attributes: display definition (if NODEFS argument is 0) and
attributes for a particular function; used by `declare -fp name'
builtins/declare.def
- declare_internal: call show_func_attributes if -f supplied with -p.
Fixes inconsistency observed by Linda Walsh <bash@tlinx.org>
builtins/common.h
- new extern declaration for show_func_attributes
builtins/read.def
- read_builtin: check the first supplied variable name for validity
before attempting to read any input, since we know we will have to
at least use that one. Don't check any other names yet. Suggested
by jidanni@jidanni.org
7/10
----
redir.c
- do_redirection_internal: when closing a file descriptor with
r_close_this ([n]<&-) count close errors as redirection errors if
errno ends up as EIO or ENOSPC. Originally reported back in April
2012 by Andrey Zaitsev <jstcdr@gmail.com>
7/11
----
redir.c
- do_redirection_internal: before calling check_bash_input, make sure
that we don't call check_bash_input for an asynchronous process that
is replacing stdin with something else. The seek backwards affects
the parent process as well, since parents and children share the
file pointer. Fixes problem originally reported in March 2013 by
Martin Jackson <mjackson220.list@gmail.com>
+1
View File
@@ -155,6 +155,7 @@ extern int set_or_show_attributes __P((WORD_LIST *, int, int));
extern int show_all_var_attributes __P((int, int));
extern int show_var_attributes __P((SHELL_VAR *, int, int));
extern int show_name_attributes __P((char *, int));
extern int show_func_attributes __P((char *, int));
extern void set_var_attribute __P((char *, int, int));
/* Functions from pushd.def */
+4 -1
View File
@@ -264,7 +264,10 @@ declare_internal (list, local_var)
{
for (any_failed = 0; list; list = list->next)
{
pflag = show_name_attributes (list->word->word, nodefs);
if (flags_on & att_function)
pflag = show_func_attributes (list->word->word, nodefs);
else
pflag = show_name_attributes (list->word->word, nodefs);
if (pflag)
{
sh_notfound (list->word->word);
+12
View File
@@ -329,6 +329,18 @@ read_builtin (list)
return (input_avail (fd) ? EXECUTION_SUCCESS : EXECUTION_FAILURE);
#endif
/* Convenience: check early whether or not the first of possibly several
variable names is a valid identifier, and bail early if so. */
#if defined (ARRAY_VARS)
if (list && legal_identifier (list->word->word) == 0 && valid_array_reference (list->word->word) == 0)
#else
if (list && legal_identifier (list->word->word) == 0)
#endif
{
sh_invalidid (list->word->word);
return (EXECUTION_FAILURE);
}
/* If we're asked to ignore the delimiter, make sure we do. */
if (ignore_delim)
delim = -1;
+18
View File
@@ -466,6 +466,24 @@ show_name_attributes (name, nodefs)
return (1);
}
int
show_func_attributes (name, nodefs)
char *name;
int nodefs;
{
SHELL_VAR *var;
var = find_function (name);
if (var)
{
show_var_attributes (var, READONLY_OR_EXPORT, nodefs);
return (0);
}
else
return (1);
}
void
set_var_attribute (name, attribute, undo)
char *name;
+10 -4
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
.\" Last Change: Thu Jun 27 10:36:53 EDT 2013
.\" Last Change: Sat Jul 13 13:32:19 EDT 2013
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2013 June 27" "GNU Bash 4.3"
.TH BASH 1 "2013 July 13" "GNU Bash 4.3"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -7402,7 +7402,8 @@ option will display the attributes and values of each
.IR name .
When
.B \-p
is used with \fIname\fP arguments, additional options are ignored.
is used with \fIname\fP arguments, additional options,
other than \fB\-f\fP and \fB\-F\fP, are ignored.
When
.B \-p
is supplied without \fIname\fP arguments, it will display the attributes
@@ -9119,7 +9120,12 @@ is greater than
or less than zero; otherwise 0.
.TP
\fBshopt\fP [\fB\-pqsu\fP] [\fB\-o\fP] [\fIoptname\fP ...]
Toggle the values of variables controlling optional shell behavior.
Toggle the values of settings controlling optional shell behavior.
The settings can be either those listed below, or, if the
.B \-o
option is used, those available with the
.B \-o
option to the \fBset\fP builtin command.
With no options, or with the
.B \-p
option, a list of all settable options is displayed, with
+11 -5
View File
@@ -5,12 +5,12 @@
.\" Case Western Reserve University
.\" chet@po.cwru.edu
.\"
.\" Last Change: Thu Jun 27 10:36:53 EDT 2013
.\" Last Change: Mon Jul 8 19:30:46 EDT 2013
.\"
.\" bash_builtins, strip all but Built-Ins section
.if \n(zZ=1 .ig zZ
.if \n(zY=1 .ig zY
.TH BASH 1 "2013 June 27" "GNU Bash 4.3"
.TH BASH 1 "2013 July 8" "GNU Bash 4.3"
.\"
.\" There's some problem with having a `@'
.\" in a tagged paragraph with the BSD man macros.
@@ -7402,7 +7402,8 @@ option will display the attributes and values of each
.IR name .
When
.B \-p
is used with \fIname\fP arguments, additional options are ignored.
is used with \fIname\fP arguments, additional options,
other than \fB\-f\fP and \fB\-F\fP, are ignored.
When
.B \-p
is supplied without \fIname\fP arguments, it will display the attributes
@@ -9119,7 +9120,12 @@ is greater than
or less than zero; otherwise 0.
.TP
\fBshopt\fP [\fB\-pqsu\fP] [\fB\-o\fP] [\fIoptname\fP ...]
Toggle the values of variables controlling optional shell behavior.
Toggle the values of settings controlling optional shell behavior.
The settings can be either those listed below, or, if the
.B \-o
option is used, those available with the
.B \-o
option to the \fBset\fP builtin command.
With no options, or with the
.B \-p
option, a list of all settable options is displayed, with
@@ -10072,7 +10078,7 @@ subsequently reset. The exit status is true unless a
is readonly.
.TP
\fBwait\fP [\fB\--n\fP] [\fIn ...\fP]
Wait for each specified process and return its termination status.
Wait for each specified child process and return its termination status.
Each
.I n
may be a process
+6 -3
View File
@@ -3900,8 +3900,8 @@ are given, then display the values of variables instead.
The @option{-p} option will display the attributes and values of each
@var{name}.
When @option{-p} is used with @var{name} arguments, additional options
are ignored.
When @option{-p} is used with @var{name} arguments, additional options,
other than @option{-f} and @option{-F}, are ignored.
When @option{-p} is supplied without @var{name} arguments, @code{declare}
will display the attributes and values of all variables having the
@@ -4825,7 +4825,10 @@ This builtin allows you to change additional shell optional behavior.
shopt [-pqsu] [-o] [@var{optname} @dots{}]
@end example
Toggle the values of variables controlling optional shell behavior.
Toggle the values of settings controlling optional shell behavior.
The settings can be either those listed below, or, if the
@option{-o} option is used, those available with the @option{-o}
option to the @code{set} builtin command (@pxref{The Set Builtin}).
With no options, or with the @option{-p} option, a list of all settable
options is displayed, with an indication of whether or not each is set.
The @option{-p} option causes output to be displayed in a form that
+8715
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -2,9 +2,9 @@
Copyright (C) 1988-2013 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Sat Jun 29 17:48:07 EDT 2013
@set LASTCHANGE Sat Jul 13 13:32:05 EDT 2013
@set EDITION 4.3
@set VERSION 4.3
@set UPDATED 29 June 2013
@set UPDATED-MONTH June 2013
@set UPDATED 13 July 2013
@set UPDATED-MONTH July 2013
+10
View File
@@ -0,0 +1,10 @@
@ignore
Copyright (C) 1988-2013 Free Software Foundation, Inc.
@end ignore
@set LASTCHANGE Mon Jul 8 19:31:30 EDT 2013
@set EDITION 4.3
@set VERSION 4.3
@set UPDATED 8 July 2013
@set UPDATED-MONTH July 2013
+1 -1
View File
@@ -308,7 +308,7 @@ save_bash_input (fd, new_fd)
the buffered stream. Make sure the file descriptor used to save bash
input is set close-on-exec. Returns 0 on success, -1 on failure. This
works only if fd is > 0 -- if fd == 0 and bash is reading input from
fd 0, save_bash_input is used instead, to cooperate with input
fd 0, sync_buffered_stream is used instead, to cooperate with input
redirection (look at redir.c:add_undo_redirect()). */
int
check_bash_input (fd)
+1 -1
View File
@@ -318,7 +318,7 @@ add_history_time (string)
{
HIST_ENTRY *hs;
if (string == 0)
if (string == 0 || history_length < 1)
return;
hs = the_history[history_length - 1];
FREE (hs->timestamp);
-1
View File
@@ -5886,7 +5886,6 @@ parse_compound_assignment (retlenp)
{
WORD_LIST *wl, *rl;
int tok, orig_line_number, orig_token_size, orig_last_token, assignok;
int peekc;
char *saved_token, *ret;
saved_token = token;
+10 -5
View File
@@ -873,7 +873,9 @@ do_redirection_internal (redirect, flags)
}
#if defined (BUFFERED_INPUT)
check_bash_input (redirector);
/* inhibit call to sync_buffered_stream() for async processes */
if (redirector != 0 || (subshell_environment & SUBSHELL_ASYNC) == 0)
check_bash_input (redirector);
#endif
/* Make sure there is no pending output before we change the state
@@ -1055,7 +1057,9 @@ do_redirection_internal (redirect, flags)
}
}
#if defined (BUFFERED_INPUT)
check_bash_input (redirector);
/* inhibit call to sync_buffered_stream() for async processes */
if (redirector != 0 || (subshell_environment & SUBSHELL_ASYNC) == 0)
check_bash_input (redirector);
#endif
if (redirect->rflags & REDIR_VARASSIGN)
{
@@ -1138,15 +1142,16 @@ do_redirection_internal (redirect, flags)
xtrace_fdchk (redirector);
#if defined (BUFFERED_INPUT)
check_bash_input (redirector);
/* inhibit call to sync_buffered_stream() for async processes */
if (redirector != 0 || (subshell_environment & SUBSHELL_ASYNC) == 0)
check_bash_input (redirector);
r = close_buffered_fd (redirector);
#else /* !BUFFERED_INPUT */
r = close (redirector);
#endif /* !BUFFERED_INPUT */
#if 0 /* bash-4.3 */
if (r < 0 && (flags & RX_INTERNAL) && (errno == EIO || errno == ENOSPC))
REDIRECTION_ERROR (r, errno, -1);
#endif
}
break;