summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2011-12-07 09:33:45 -0500
committerChet Ramey <chet.ramey@case.edu>2011-12-07 09:33:45 -0500
commitc92a890b214b96f95b459693473599c025fe750c (patch)
tree50c7992467c8a9f1fce5bd611a2326f760fc04ba
parent01c9eb9c80e9b7632c3ce9ee47b740a1903bbf3a (diff)
downloadbash-c92a890b214b96f95b459693473599c025fe750c.tar.gz
commit bash-20081211 snapshot
-rw-r--r--CWRU/CWRU.chlog23
-rw-r--r--CWRU/CWRU.chlog~25
-rw-r--r--builtins/echo.def3
-rw-r--r--builtins/echo.def~31
-rw-r--r--builtins/printf.def3
-rw-r--r--builtins/printf.def~5
-rw-r--r--builtins/read.def4
-rw-r--r--execute_cmd.c11
-rw-r--r--execute_cmd.c~12
-rw-r--r--general.c6
-rw-r--r--lib/readline/display.c2
-rw-r--r--lib/readline/display.c~2
-rw-r--r--lib/readline/doc/rltech.texi2
-rw-r--r--lib/readline/doc/rltech.texi~2
-rw-r--r--sig.c4
15 files changed, 110 insertions, 25 deletions
diff --git a/CWRU/CWRU.chlog b/CWRU/CWRU.chlog
index ab8c0ac9..2e9436f6 100644
--- a/CWRU/CWRU.chlog
+++ b/CWRU/CWRU.chlog
@@ -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
diff --git a/CWRU/CWRU.chlog~ b/CWRU/CWRU.chlog~
index 3e8b306c..ecfa6aec 100644
--- a/CWRU/CWRU.chlog~
+++ b/CWRU/CWRU.chlog~
@@ -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>
diff --git a/builtins/echo.def b/builtins/echo.def
index ecfe4380..56a78360 100644
--- a/builtins/echo.def
+++ b/builtins/echo.def
@@ -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));
}
diff --git a/builtins/echo.def~ b/builtins/echo.def~
index 9d9b35fa..ecfe4380 100644
--- a/builtins/echo.def~
+++ b/builtins/echo.def~
@@ -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)
diff --git a/builtins/printf.def b/builtins/printf.def
index c8c0c633..77fa0cc8 100644
--- a/builtins/printf.def
+++ b/builtins/printf.def
@@ -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
diff --git a/builtins/printf.def~ b/builtins/printf.def~
index b4a528fe..05a7730f 100644
--- a/builtins/printf.def~
+++ b/builtins/printf.def~
@@ -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;
diff --git a/builtins/read.def b/builtins/read.def
index 7b461c2c..9a2df07f 100644
--- a/builtins/read.def
+++ b/builtins/read.def
@@ -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;
diff --git a/execute_cmd.c b/execute_cmd.c
index ea865054..b7cd8a96 100644
--- a/execute_cmd.c
+++ b/execute_cmd.c
@@ -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);
}
diff --git a/execute_cmd.c~ b/execute_cmd.c~
index 7cf4aaad..b340e123 100644
--- a/execute_cmd.c~
+++ b/execute_cmd.c~
@@ -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);
diff --git a/general.c b/general.c
index 13fb412f..3e78b46e 100644
--- a/general.c
+++ b/general.c
@@ -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);
}
diff --git a/lib/readline/display.c b/lib/readline/display.c
index 383c0008..517c1674 100644
--- a/lib/readline/display.c
+++ b/lib/readline/display.c
@@ -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 >= */
{
diff --git a/lib/readline/display.c~ b/lib/readline/display.c~
index 6fb41074..383c0008 100644
--- a/lib/readline/display.c~
+++ b/lib/readline/display.c~
@@ -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);
diff --git a/lib/readline/doc/rltech.texi b/lib/readline/doc/rltech.texi
index 42b761b6..c98d3b9b 100644
--- a/lib/readline/doc/rltech.texi
+++ b/lib/readline/doc/rltech.texi
@@ -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
diff --git a/lib/readline/doc/rltech.texi~ b/lib/readline/doc/rltech.texi~
index da1bfcf8..42b761b6 100644
--- a/lib/readline/doc/rltech.texi~
+++ b/lib/readline/doc/rltech.texi~
@@ -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
diff --git a/sig.c b/sig.c
index 590eca7e..61f3d079 100644
--- a/sig.c
+++ b/sig.c
@@ -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);