]> git.ipfire.org Git - thirdparty/bash.git/commitdiff
commit bash-20081211 snapshot
authorChet Ramey <chet.ramey@case.edu>
Wed, 7 Dec 2011 14:33:45 +0000 (09:33 -0500)
committerChet Ramey <chet.ramey@case.edu>
Wed, 7 Dec 2011 14:33:45 +0000 (09:33 -0500)
15 files changed:
CWRU/CWRU.chlog
CWRU/CWRU.chlog~
builtins/echo.def
builtins/echo.def~
builtins/printf.def
builtins/printf.def~
builtins/read.def
execute_cmd.c
execute_cmd.c~
general.c
lib/readline/display.c
lib/readline/display.c~
lib/readline/doc/rltech.texi
lib/readline/doc/rltech.texi~
sig.c

index ab8c0ac99bff50fa45a35b9a14973f21521438e1..2e9436f60f3613f396e1c4b4e3c88e63ed0991f3 100644 (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
index 3e8b306c8b7fc1b06fa022a3db3f9d2820f3dbc9..ecfa6aec6c48e3328b98d6d695eff0bfa8ee81fd 100644 (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>
index ecfe43800c30c76c12a1d79217e3ec194d528ba2..56a7836018a31c3c56026e609d90f0d0a2845ce4 100644 (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));
 }
index 9d9b35fa3db9c92cd8da46765414449b60440711..ecfe43800c30c76c12a1d79217e3ec194d528ba2 100644 (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)
index c8c0c6336cd81ca6eeda160c77abf7dbf3d6e26f..77fa0cc8208cef3e6a37aa673b6b830c946fe002 100644 (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
index b4a528fe137243f7c11902d038990d44d918bd8b..05a7730fbe3cbbeba8910826d63813f2fbfddc13 100644 (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;
index 7b461c2cd65d55ae0ac02cb59017b3331c9f8800..9a2df07fa8b16b9828f23f15d5deccd80da1edac 100644 (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;
index ea865054e147df0760e9faa8e90ec29fde5b884e..b7cd8a96fe5b346bb3b7f0d6278c663362098c42 100644 (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);
 }
 
index 7cf4aaadd3ee4123db08c8ee9326a020f79f2f4c..b340e123c879564b781dbf5320ef0c6c541c26af 100644 (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);
index 13fb412fbc4e1828495723cde2bd808038d6b292..3e78b46ec0ce76e34f77e48a734473989eafcf3d 100644 (file)
--- 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);
 }
 
index 383c00088f88a388ec69ef70729be96dac6bc935..517c1674bc5aa173736b359f346f5aadad19d75d 100644 (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 >= */
        {
index 6fb410743bf9b47ed4f7502c9a44b667b59491ff..383c00088f88a388ec69ef70729be96dac6bc935 100644 (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);
index 42b761b63f0aefec36dc4a12ea08690a3cfd03c8..c98d3b9b51221083ed753bbb4d9b5f21c0ec5a1e 100644 (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
index da1bfcf87c5a32943d0486d2a056ca65fafeea57..42b761b63f0aefec36dc4a12ea08690a3cfd03c8 100644 (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
diff --git a/sig.c b/sig.c
index 590eca7ecd456d39b51782609821283b9a9df781..61f3d079c86c6bf40562aaa3378fa3a933ede8b1 100644 (file)
--- 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);