mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-22 05:17:59 +02:00
commit bash-20041202 snapshot
This commit is contained in:
@@ -10644,3 +10644,33 @@ execute_cmd.c
|
||||
trap.c
|
||||
- change reset_or_restore_signal_handlers so that the RETURN trap is
|
||||
not inherited by command substitution when DEBUGGER is not defined
|
||||
|
||||
11/30
|
||||
-----
|
||||
lib/readline/misc.c
|
||||
- fix memory leaks in _rl_free_history_entry and rl_maybe_replace_line
|
||||
caused by not freeing `timestamp' member of history entry
|
||||
- make sure timestamp is initialized to NULL in rl_maybe_save_line
|
||||
|
||||
12/1
|
||||
----
|
||||
execute_cmd.c
|
||||
- fix execute_function so a function calling `return' will run the
|
||||
RETURN trap, if one's defined
|
||||
|
||||
doc/{bash.1,bashref.texi}
|
||||
- fix description of RETURN trap in various places to indicate that it's
|
||||
only inherited by shell functions if function tracing is on globally
|
||||
or has been enabled for that function
|
||||
- fix documentation to indicate that the DEBUG and RETURN traps are
|
||||
inherited under the same conditions
|
||||
|
||||
execute_cmd.c
|
||||
- a function does not inherit the RETURN trap if a DEBUG trap is
|
||||
currently running
|
||||
|
||||
12/2
|
||||
----
|
||||
lib/glob/xmbsrtowcs.c
|
||||
- change xmbsrtowcs to handle the one case where malloc can fail
|
||||
(though it should not matter) -- don't try to free a null pointer
|
||||
|
||||
+14
-9
@@ -6,12 +6,12 @@
|
||||
.\" Case Western Reserve University
|
||||
.\" chet@po.CWRU.Edu
|
||||
.\"
|
||||
.\" Last Change: Mon Nov 22 11:06:21 EST 2004
|
||||
.\" Last Change: Wed Dec 1 15:39:20 EST 2004
|
||||
.\"
|
||||
.\" bash_builtins, strip all but Built-Ins section
|
||||
.if \n(zZ=1 .ig zZ
|
||||
.if \n(zY=1 .ig zY
|
||||
.TH BASH 1 "2004 Nov 22" "GNU Bash-3.1-devel"
|
||||
.TH BASH 1 "2004 Dec 1" "GNU Bash-3.1-devel"
|
||||
.\"
|
||||
.\" There's some problem with having a `@'
|
||||
.\" in a tagged paragraph with the BSD man macros.
|
||||
@@ -3320,19 +3320,21 @@ environment are identical between a function and its caller
|
||||
with the exception that the
|
||||
.SM
|
||||
.B DEBUG
|
||||
trap (see the description of the
|
||||
and
|
||||
.B RETURN
|
||||
traps (see the description of the
|
||||
.B trap
|
||||
builtin under
|
||||
.SM
|
||||
.B SHELL BUILTIN COMMANDS
|
||||
below) is not inherited unless the function has been given the
|
||||
below) are not inherited unless the function has been given the
|
||||
\fBtrace\fP attribute (see the description of the
|
||||
.SM
|
||||
.B declare
|
||||
builtin below) or the
|
||||
\fB\-o functrace\fP shell option has been enabled with
|
||||
the \fBset\fP builtin
|
||||
(in which case all functions inherit the \fBDEBUG\fP trap).
|
||||
(in which case all functions inherit the \fBDEBUG\fP and \fBRETURN\fP traps).
|
||||
.PP
|
||||
Variables local to the function may be declared with the
|
||||
.B local
|
||||
@@ -6424,7 +6426,8 @@ by subsequent assignment statements or unset.
|
||||
.TP
|
||||
.B \-t
|
||||
Give each \fIname\fP the \fItrace\fP attribute.
|
||||
Traced functions inherit the \fBDEBUG\fP trap from the calling shell.
|
||||
Traced functions inherit the \fBDEBUG\fP and \fBRETURN\fP traps from
|
||||
the calling shell.
|
||||
The trace attribute has no special meaning for variables.
|
||||
.TP
|
||||
.B \-x
|
||||
@@ -7773,9 +7776,11 @@ follows the logical chain of directories when performing commands
|
||||
which change the current directory.
|
||||
.TP 8
|
||||
.B \-T
|
||||
If set, any trap on \fBDEBUG\fP is inherited by shell functions, command
|
||||
substitutions, and commands executed in a subshell environment.
|
||||
The \fBDEBUG\fP trap is normally not inherited in such cases.
|
||||
If set, any traps on \fBDEBUG\fP and \fBRETURN\fP are inherited by shell
|
||||
functions, command substitutions, and commands executed in a
|
||||
subshell environment.
|
||||
The \fBDEBUG\fP and \fBRETURN\fP traps are normally not inherited
|
||||
in such cases.
|
||||
.TP 8
|
||||
.B \-\-
|
||||
If no arguments follow this option, then the positional parameters are
|
||||
|
||||
+13
-8
@@ -1118,12 +1118,12 @@ The first element of the @env{FUNCNAME} variable is set to the
|
||||
name of the function while the function is executing.
|
||||
All other aspects of the shell execution
|
||||
environment are identical between a function and its caller
|
||||
with the exception that the @env{DEBUG} trap
|
||||
below) is not inherited unless the function has been given the
|
||||
with the exception that the @env{DEBUG} and @env{RETURN} traps
|
||||
are not inherited unless the function has been given the
|
||||
@code{trace} attribute using the @code{declare} builtin or
|
||||
the @code{-o functrace} option has been enabled with
|
||||
the @code{set} builtin,
|
||||
(in which case all functions inherit the @code{DEBUG} trap).
|
||||
(in which case all functions inherit the @env{DEBUG} and @env{RETURN} traps).
|
||||
@xref{Bourne Shell Builtins}, for the description of the
|
||||
@code{trap} builtin.
|
||||
|
||||
@@ -3283,7 +3283,8 @@ by subsequent assignment statements or unset.
|
||||
|
||||
@item -t
|
||||
Give each @var{name} the @code{trace} attribute.
|
||||
Traced functions inherit the @code{DEBUG} trap from the calling shell.
|
||||
Traced functions inherit the @code{DEBUG} and @code{RETURN} traps from
|
||||
the calling shell.
|
||||
The trace attribute has no special meaning for variables.
|
||||
|
||||
@item -x
|
||||
@@ -4126,9 +4127,11 @@ $ cd ..; pwd
|
||||
@end example
|
||||
|
||||
@item -T
|
||||
If set, any trap on @code{DEBUG} is inherited by shell functions, command
|
||||
substitutions, and commands executed in a subshell environment.
|
||||
The @code{DEBUG} trap is normally not inherited in such cases.
|
||||
If set, any trap on @code{DEBUG} and @code{RETURN} are inherited by
|
||||
shell functions, command substitutions, and commands executed
|
||||
in a subshell environment.
|
||||
The @code{DEBUG} and @code{RETURN} traps are normally not inherited
|
||||
in such cases.
|
||||
|
||||
@item --
|
||||
If no arguments follow this option, then the positional parameters are
|
||||
@@ -7184,7 +7187,9 @@ The @code{trap} builtin (@pxref{Bourne Shell Builtins}) allows a
|
||||
Commands specified with an @code{RETURN} trap are executed before
|
||||
execution resumes after a shell function or a shell script executed with
|
||||
@code{.} or @code{source} returns.
|
||||
The @code{RETURN} trap is not inherited by shell functions.
|
||||
The @code{RETURN} trap is not inherited by shell functions unless the
|
||||
function has been given the @code{trace} attribute or the
|
||||
@code{functrace} option has been enabled using the @code{shopt} builtin.
|
||||
|
||||
@item
|
||||
The Bash @code{type} builtin is more extensive and gives more information
|
||||
|
||||
+3
-3
@@ -2,9 +2,9 @@
|
||||
Copyright (C) 1988-2004 Free Software Foundation, Inc.
|
||||
@end ignore
|
||||
|
||||
@set LASTCHANGE Wed Nov 24 14:11:51 EST 2004
|
||||
@set LASTCHANGE Wed Dec 1 15:39:35 EST 2004
|
||||
|
||||
@set EDITION 3.1-devel
|
||||
@set VERSION 3.1-devel
|
||||
@set UPDATED 24 November 2004
|
||||
@set UPDATED-MONTH November 2004
|
||||
@set UPDATED 1 December 2004
|
||||
@set UPDATED-MONTH December 2004
|
||||
|
||||
+7
-20
@@ -2741,35 +2741,20 @@ execute_simple_command (simple_command, pipe_in, pipe_out, async, fds_to_close)
|
||||
|
||||
if (dofork)
|
||||
{
|
||||
#if 0
|
||||
/* XXX memory leak if expand_words() error causes a jump_to_top_level */
|
||||
command_line = savestring (the_printed_command);
|
||||
#endif
|
||||
|
||||
/* Do this now, because execute_disk_command will do it anyway in the
|
||||
vast majority of cases. */
|
||||
maybe_make_export_env ();
|
||||
|
||||
#if 0
|
||||
if (make_child (command_line, async) == 0)
|
||||
#else
|
||||
if (make_child (savestring (the_printed_command), async) == 0)
|
||||
#endif
|
||||
{
|
||||
already_forked = 1;
|
||||
simple_command->flags |= CMD_NO_FORK;
|
||||
|
||||
#if 0
|
||||
subshell_environment = (pipe_in != NO_PIPE || pipe_out != NO_PIPE)
|
||||
? (SUBSHELL_PIPE|SUBSHELL_FORK)
|
||||
: (SUBSHELL_ASYNC|SUBSHELL_FORK);
|
||||
#else
|
||||
subshell_environment = SUBSHELL_FORK;
|
||||
if (pipe_in != NO_PIPE || pipe_out != NO_PIPE)
|
||||
subshell_environment |= SUBSHELL_PIPE;
|
||||
if (async)
|
||||
subshell_environment |= SUBSHELL_ASYNC;
|
||||
#endif
|
||||
|
||||
/* We need to do this before piping to handle some really
|
||||
pathological cases where one of the pipe file descriptors
|
||||
@@ -3187,7 +3172,13 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
|
||||
restore_default_signal (ERROR_TRAP);
|
||||
}
|
||||
|
||||
/* Shell functions inherit the RETURN trap if function tracing is on
|
||||
globally or on individually for this function. */
|
||||
#if 0
|
||||
if (return_trap && ((trace_p (var) == 0) && function_trace_mode == 0))
|
||||
#else
|
||||
if (return_trap && (signal_in_progress (DEBUG_TRAP) || ((trace_p (var) == 0) && function_trace_mode == 0)))
|
||||
#endif
|
||||
{
|
||||
if (subshell == 0)
|
||||
{
|
||||
@@ -3242,14 +3233,10 @@ execute_function (var, words, flags, fds_to_close, async, subshell)
|
||||
if (return_val)
|
||||
{
|
||||
result = return_catch_value;
|
||||
#if 0
|
||||
/* Run the RETURN trap in the function's context. XXX - have to talk
|
||||
to Rocky about why his bashdb code doesn't have `return' run the
|
||||
RETURN trap. */
|
||||
/* Run the RETURN trap in the function's context. */
|
||||
save_current = currently_executing_command;
|
||||
run_return_trap ();
|
||||
currently_executing_command = save_current;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+12
-7
@@ -1,6 +1,6 @@
|
||||
/* xmbsrtowcs.c -- replacement function for mbsrtowcs */
|
||||
|
||||
/* Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2002-2004 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -54,7 +54,7 @@ xmbsrtowcs (dest, src, len, pstate)
|
||||
ps = &local_state;
|
||||
}
|
||||
|
||||
n = strlen(*src);
|
||||
n = strlen (*src);
|
||||
|
||||
if (dest == NULL)
|
||||
{
|
||||
@@ -62,19 +62,22 @@ xmbsrtowcs (dest, src, len, pstate)
|
||||
const char *mbs;
|
||||
mbstate_t psbuf;
|
||||
|
||||
/* It doesn't matter if malloc fails here, since mbsrtowcs should do
|
||||
the right thing with a NULL first argument. */
|
||||
wsbuf = (wchar_t *) malloc ((n + 1) * sizeof(wchar_t));
|
||||
mbs = *src;
|
||||
psbuf = *ps;
|
||||
|
||||
wclength = mbsrtowcs (wsbuf, &mbs, n, &psbuf);
|
||||
|
||||
free (wsbuf);
|
||||
if (wsbuf)
|
||||
free (wsbuf);
|
||||
return wclength;
|
||||
}
|
||||
|
||||
for (wclength = 0; wclength < len; wclength++, dest++)
|
||||
{
|
||||
if(mbsinit(ps))
|
||||
if (mbsinit(ps))
|
||||
{
|
||||
if (**src == '\0')
|
||||
{
|
||||
@@ -166,10 +169,11 @@ xdupmbstowcs (destp, indicesp, src)
|
||||
|
||||
p = src;
|
||||
wcnum = 0;
|
||||
do {
|
||||
do
|
||||
{
|
||||
size_t mblength; /* Byte length of one multibyte character. */
|
||||
|
||||
if(mbsinit (&state))
|
||||
if (mbsinit (&state))
|
||||
{
|
||||
if (*p == '\0')
|
||||
{
|
||||
@@ -230,7 +234,8 @@ xdupmbstowcs (destp, indicesp, src)
|
||||
wsbuf[wcnum - 1] = wc;
|
||||
indices[wcnum - 1] = (char *)p;
|
||||
p += mblength;
|
||||
} while (MB_NULLWCH (wc) == 0);
|
||||
}
|
||||
while (MB_NULLWCH (wc) == 0);
|
||||
|
||||
/* Return the length of the wide character string, not including `\0'. */
|
||||
*destp = wsbuf;
|
||||
|
||||
+6
-2
@@ -225,8 +225,10 @@ _rl_free_history_entry (entry)
|
||||
{
|
||||
if (entry == 0)
|
||||
return;
|
||||
if (entry->line)
|
||||
free (entry->line);
|
||||
|
||||
FREE (entry->line);
|
||||
FREE (entry->timestamp);
|
||||
|
||||
free (entry);
|
||||
}
|
||||
|
||||
@@ -242,6 +244,7 @@ rl_maybe_replace_line ()
|
||||
{
|
||||
temp = replace_history_entry (where_history (), rl_line_buffer, (histdata_t)rl_undo_list);
|
||||
free (temp->line);
|
||||
FREE (temp->timestamp);
|
||||
free (temp);
|
||||
}
|
||||
return 0;
|
||||
@@ -274,6 +277,7 @@ rl_maybe_save_line ()
|
||||
{
|
||||
_rl_saved_line_for_history = (HIST_ENTRY *)xmalloc (sizeof (HIST_ENTRY));
|
||||
_rl_saved_line_for_history->line = savestring (rl_line_buffer);
|
||||
_rl_saved_line_for_history->timestamp = (char *)NULL;
|
||||
_rl_saved_line_for_history->data = (char *)rl_undo_list;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
|
||||
@@ -807,6 +807,11 @@ run_return_trap ()
|
||||
{
|
||||
int old_exit_value;
|
||||
|
||||
#if 0
|
||||
if ((sigmodes[DEBUG_TRAP] & SIG_TRAPPED) && (sigmodes[DEBUG_TRAP] & SIG_INPROGRESS))
|
||||
return;
|
||||
#endif
|
||||
|
||||
if ((sigmodes[RETURN_TRAP] & SIG_TRAPPED) && ((sigmodes[RETURN_TRAP] & SIG_IGNORED) == 0) && (sigmodes[RETURN_TRAP] & SIG_INPROGRESS) == 0)
|
||||
{
|
||||
old_exit_value = last_command_exit_value;
|
||||
|
||||
Reference in New Issue
Block a user