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
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
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>
clearerr (stdout); /* clear error before writing and testing success */
+ terminate_immediately++;
while (list)
{
i = len = 0;
if (display_return)
putchar ('\n');
+
+ terminate_immediately--;
return (sh_chkwrite (EXECUTION_SUCCESS));
}
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>
`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
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)
} \
else if (vbuf) \
vbuf[0] = 0; \
+ terminate_immediately--; \
fflush (stdout); \
if (ferror (stdout)) \
{ \
/* 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
} \
else if (vbuf) \
vbuf[0] = 0; \
+ terminate_immediately--;
fflush (stdout); \
if (ferror (stdout)) \
{ \
/* 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
#else
if (string == 0 || len == 0)
#endif
- return;
+ return 0;
#if 0
s = fmt;
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;
zsyncfd (fd);
interrupt_immediately--;
- terminate_immediately = 0;
+ terminate_immediately--;
discard_unwind_frame ("read_builtin");
retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS;
UNBLOCK_CHILD (oset);
#endif
+ QUIT;
return (exec_result);
}
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
discard_unwind_frame ("eval_builtin");
}
+#if 0
+ /* XXX -- added 12/11 */
+ terminate_immediately--;
+#endif
+
return (result);
}
UNBLOCK_CHILD (oset);
#endif
+ QUIT;
return (exec_result);
}
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
discard_unwind_frame ("eval_builtin");
}
+ /* XXX -- added 12/11 */
+/* terminate_immediately--; */
+
return (result);
}
char *command;
char **args, **env;
{
- struct stat finfo;
int larray, i, fd;
char sample[80];
int sample_len;
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)
{
{
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);
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);
r = (*s == '~') ? unquoted_tilde_word (s) : 1;
ret = r ? tilde_expand (s) : savestring (s);
interrupt_immediately = old_immed;
+ terminate_immediately = old_term;
return (ret);
}
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 >= */
{
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);
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
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
{
terminating_signal = sig;
+ /* XXX - should this also trigger when interrupt_immediately is set? */
if (terminate_immediately)
{
terminate_immediately = 0;
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);