commit bash-20081211 snapshot

This commit is contained in:
Chet Ramey
2011-12-07 09:33:45 -05:00
parent 01c9eb9c80
commit c92a890b21
15 changed files with 110 additions and 25 deletions
+23
View File
@@ -7216,3 +7216,26 @@ lib/readline/display.c
we just wrote some invisible characters. Rest of fix for bug
reported in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=265182
[TENTATIVE]
12/11
-----
sig.c
- reset the execution context before running the exit trap in
termsig_handler
general.c
- set and unset terminate_immediately like interrupt_immediately in
bash_tilde_expand
builtins/read.def
- change terminate_immediately to a counter instead of a flag, as
interrupt_immediately is used
lib/readline/display.c
- slight change to fix from 11/27 to deal with prompts longer than a
screen line where the invisible characters all appear after the
line wrap. Fixes bug reported by Andreas Schwab <schwab@suse.de>
builtins/{echo,printf}.def
- increment terminate_immediately at entry; decrement before returning.
Fix for bug reported by Ralf.Wildenhues@gmx.de
+24 -1
View File
@@ -7198,7 +7198,7 @@ lib/readline/display.c
draw the entire prompt string. More of the partial fix for bug
reported by Mike Frysinger <vapier@gentoo.org>
- fix update_line to adjust _rl_last_c_pos by wrap_offset when adding
characters beginning before the first invisible character in the
characters beginning before the last invisible character in the
prompt. New code is same as previously existed in a different code
path. Rest of fix for bug from Mike Frysinger <vapier@gentoo.org>
- fix assignment of newline breaks (inv_lbreaks) to correctly account
@@ -7216,3 +7216,26 @@ lib/readline/display.c
we just wrote some invisible characters. Rest of fix for bug
reported in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=265182
[TENTATIVE]
12/11
-----
sig.c
- reset the execution context before running the exit trap in
termsig_handler
execute_cmd.c
- increment terminate_immediately at entry to execute_builtin; decrement
it before returning [TENTATIVE]
general.c
- set and unset terminate_immediately like interrupt_immediately in
bash_tilde_expand
builtins/read.def
- change terminate_immediately to a counter instead of a flag, as
interrupt_immediately is used
lib/readline/display.c
- slight change to fix from 11/27 to deal with prompts longer than a
screen line where the invisible characters all appear after the
line wrap. Fixes bug reported by Andreas Schwab <schwab@suse.de>
+3
View File
@@ -159,6 +159,7 @@ just_echo:
clearerr (stdout); /* clear error before writing and testing success */
terminate_immediately++;
while (list)
{
i = len = 0;
@@ -191,5 +192,7 @@ just_echo:
if (display_return)
putchar ('\n');
terminate_immediately--;
return (sh_chkwrite (EXECUTION_SUCCESS));
}
+19 -12
View File
@@ -5,19 +5,18 @@ Copyright (C) 1987-2008 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with Bash; see the file COPYING. If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
$PRODUCES echo.c
#include <config.h>
@@ -49,7 +48,7 @@ Options:
`echo' interprets the following backslash-escaped characters:
\a alert (bell)
\b backspace
\c suppress trailing newline
\c suppress further output
\e escape character
\f form feed
\n new line
@@ -61,16 +60,24 @@ Options:
0 to 3 octal digits
\xHH the eight-bit character whose value is HH (hexadecimal). HH
can be one or two hex digits
Exit Status:
Returns success unless a write error occurs.
$END
$BUILTIN echo
$FUNCTION echo_builtin
$DEPENDS_ON !V9_ECHO
$SHORT_DOC echo [-n] [arg ...]
Write arguments to the standard output.
Display the ARGs on the standard output followed by a newline.
Options:
-n do not append a newline
Exit Status:
Returns success unless a write error occurs.
$END
#if defined (V9_ECHO)
+3
View File
@@ -152,6 +152,7 @@ extern int errno;
} \
else if (vbuf) \
vbuf[0] = 0; \
terminate_immediately--; \
fflush (stdout); \
if (ferror (stdout)) \
{ \
@@ -270,6 +271,8 @@ printf_builtin (list)
/* If the format string is empty after preprocessing, return immediately. */
if (format == 0 || *format == 0)
return (EXECUTION_SUCCESS);
terminate_immediately++;
/* Basic algorithm is to scan the format string for conversion
specifications -- once one is found, find out if the field
+4 -1
View File
@@ -152,6 +152,7 @@ extern int errno;
} \
else if (vbuf) \
vbuf[0] = 0; \
terminate_immediately--;
fflush (stdout); \
if (ferror (stdout)) \
{ \
@@ -270,6 +271,8 @@ printf_builtin (list)
/* If the format string is empty after preprocessing, return immediately. */
if (format == 0 || *format == 0)
return (EXECUTION_SUCCESS);
terminate_immediately++;
/* Basic algorithm is to scan the format string for conversion
specifications -- once one is found, find out if the field
@@ -588,7 +591,7 @@ printstr (fmt, string, len, fieldwidth, precision)
#else
if (string == 0 || len == 0)
#endif
return;
return 0;
#if 0
s = fmt;
+2 -2
View File
@@ -441,7 +441,7 @@ read_builtin (list)
of the unwind-protect stack after the realloc() works right. */
add_unwind_protect (xfree, input_string);
interrupt_immediately++;
terminate_immediately = 1;
terminate_immediately++;
unbuffered_read = (nchars > 0) || (delim != '\n') || input_is_pipe;
@@ -602,7 +602,7 @@ add_char:
zsyncfd (fd);
interrupt_immediately--;
terminate_immediately = 0;
terminate_immediately--;
discard_unwind_frame ("read_builtin");
retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS;
+11
View File
@@ -2018,6 +2018,7 @@ execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
UNBLOCK_CHILD (oset);
#endif
QUIT;
return (exec_result);
}
@@ -3706,6 +3707,11 @@ execute_builtin (builtin, words, flags, subshell)
int old_e_flag, result, eval_unwind;
int isbltinenv;
#if 0
/* XXX -- added 12/11 */
terminate_immediately++;
#endif
old_e_flag = exit_immediately_on_error;
/* The eval builtin calls parse_and_execute, which does not know about
the setting of flags, and always calls the execution functions with
@@ -3772,6 +3778,11 @@ execute_builtin (builtin, words, flags, subshell)
discard_unwind_frame ("eval_builtin");
}
#if 0
/* XXX -- added 12/11 */
terminate_immediately--;
#endif
return (result);
}
+9 -3
View File
@@ -2018,6 +2018,7 @@ execute_pipeline (command, asynchronous, pipe_in, pipe_out, fds_to_close)
UNBLOCK_CHILD (oset);
#endif
QUIT;
return (exec_result);
}
@@ -3706,6 +3707,9 @@ execute_builtin (builtin, words, flags, subshell)
int old_e_flag, result, eval_unwind;
int isbltinenv;
/* XXX -- added 12/11 */
/* terminate_immediately++; */
old_e_flag = exit_immediately_on_error;
/* The eval builtin calls parse_and_execute, which does not know about
the setting of flags, and always calls the execution functions with
@@ -3772,6 +3776,9 @@ execute_builtin (builtin, words, flags, subshell)
discard_unwind_frame ("eval_builtin");
}
/* XXX -- added 12/11 */
/* terminate_immediately--; */
return (result);
}
@@ -4549,7 +4556,6 @@ shell_execve (command, args, env)
char *command;
char **args, **env;
{
struct stat finfo;
int larray, i, fd;
char sample[80];
int sample_len;
@@ -4564,7 +4570,7 @@ shell_execve (command, args, env)
Maybe it is something we can hack ourselves. */
if (i != ENOEXEC)
{
if ((stat (command, &finfo) == 0) && (S_ISDIR (finfo.st_mode)))
if (file_isdir (command))
internal_error (_("%s: is a directory"), command);
else if (executable_file (command) == 0)
{
@@ -4698,7 +4704,7 @@ execute_intern_function (name, function)
{
if (posixly_correct && interactive_shell == 0)
{
last_command_exit_value = EX_USAGE;
last_command_exit_value = EX_BADUSAGE;
jump_to_top_level (ERREXIT);
}
return (EXECUTION_FAILURE);
+4 -2
View File
@@ -949,11 +949,12 @@ bash_tilde_expand (s, assign_p)
const char *s;
int assign_p;
{
int old_immed, r;
int old_immed, old_term, r;
char *ret;
old_immed = interrupt_immediately;
interrupt_immediately = 1;
old_term = terminate_immediately;
interrupt_immediately = terminate_immediately = 1;
tilde_additional_prefixes = assign_p == 0 ? (char **)0
: (assign_p == 2 ? bash_tilde_prefixes2 : bash_tilde_prefixes);
@@ -963,6 +964,7 @@ bash_tilde_expand (s, assign_p)
r = (*s == '~') ? unquoted_tilde_word (s) : 1;
ret = r ? tilde_expand (s) : savestring (s);
interrupt_immediately = old_immed;
terminate_immediately = old_term;
return (ret);
}
+1 -1
View File
@@ -1907,7 +1907,7 @@ _rl_move_cursor_relative (new, data)
if ((new > prompt_last_invisible) || /* XXX - don't use woff here */
(prompt_physical_chars > _rl_screenwidth &&
_rl_last_v_pos == prompt_last_screen_line &&
wrap_offset != woff &&
wrap_offset >= woff &&
new > (prompt_last_invisible-(_rl_screenwidth*_rl_last_v_pos)-wrap_offset)))
/* XXX last comparison might need to be >= */
{
+1 -1
View File
@@ -1628,7 +1628,7 @@ update_line (old, new, current_line, omax, nmax, inv_botlin)
insert_some_chars (nfd, lendiff, col_lendiff);
_rl_last_c_pos += col_lendiff;
}
#if 1
#if 0 /* XXX - for now */
else if ((MB_CUR_MAX > 1 && rl_byte_oriented == 0) && _rl_last_c_pos == 0 && wrap_offset && (nfd-new) <= prompt_last_invisible && col_lendiff < prompt_visible_length && visible_wrap_offset >= current_invis_chars)
{
_rl_output_some_chars (nfd, lendiff);
+1 -1
View File
@@ -1124,7 +1124,7 @@ If @var{clear_undo} is non-zero, the undo list associated with the
current line is cleared.
@end deftypefun
@deftypefun int rl_extend_line_buffer (int len)
@deftypefun void rl_extend_line_buffer (int len)
Ensure that @code{rl_line_buffer} has enough space to hold @var{len}
characters, possibly reallocating it if necessary.
@end deftypefun
+1 -1
View File
@@ -1434,7 +1434,7 @@ call @code{rl_resize_terminal()} or @code{rl_set_screen_size()} to force
Readline to update its idea of the terminal size when a @code{SIGWINCH}
is received.
@deftypefun rl_echo_signal_char (int sig)
@deftypefun void rl_echo_signal_char (int sig)
If an application wishes to install its own signal handlers, but still
have readline display characters that generate signals, calling this
function with @var{sig} set to @code{SIGINT}, @code{SIGQUIT}, or
+4
View File
@@ -449,6 +449,7 @@ termsig_sighandler (sig)
{
terminating_signal = sig;
/* XXX - should this also trigger when interrupt_immediately is set? */
if (terminate_immediately)
{
terminate_immediately = 0;
@@ -491,6 +492,9 @@ termsig_handler (sig)
unlink_fifo_list ();
#endif /* PROCESS_SUBSTITUTION */
/* Reset execution context */
loop_level = continuing = breaking = executing_list = return_catch_flag = 0;
run_exit_trap ();
set_signal_handler (sig, SIG_DFL);
kill (getpid (), sig);