Tomas Janousek 5a0cfd
			     BASH PATCH REPORT
Tomas Janousek 5a0cfd
			     =================
Tomas Janousek 5a0cfd
Tomas Janousek 5a0cfd
Bash-Release: 3.2
Tomas Janousek 5a0cfd
Patch-ID: bash32-022
Tomas Janousek 5a0cfd
Tomas Janousek 5a0cfd
Bug-Reported-by:	Chet Ramey <chet.ramey@cwru.edu>
Tomas Janousek 5a0cfd
Bug-Reference-ID:
Tomas Janousek 5a0cfd
Bug-Reference-URL:
Tomas Janousek 5a0cfd
Tomas Janousek 5a0cfd
Bug-Description:
Tomas Janousek 5a0cfd
Tomas Janousek 5a0cfd
POSIX specifies that the `read' builtin invoked from an interative shell
Tomas Janousek 5a0cfd
must prompt with $PS2 when a line is continued using a backslash while
Tomas Janousek 5a0cfd
reading from a terminal.
Tomas Janousek 5a0cfd
Tomas Janousek 5a0cfd
Patch:
Tomas Janousek 5a0cfd
Tomas Janousek 5a0cfd
*** ../bash-3.2-patched/builtins/read.def	Tue Sep 19 08:45:48 2006
Tomas Janousek 5a0cfd
--- builtins/read.def	Thu May 24 16:03:30 2007
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 128,133 ****
Tomas Janousek 5a0cfd
  {
Tomas Janousek 5a0cfd
    register char *varname;
Tomas Janousek 5a0cfd
!   int size, i, nr, pass_next, saw_escape, eof, opt, retval, code;
Tomas Janousek 5a0cfd
!   int input_is_tty, input_is_pipe, unbuffered_read;
Tomas Janousek 5a0cfd
    int raw, edit, nchars, silent, have_timeout, fd;
Tomas Janousek 5a0cfd
    unsigned int tmout;
Tomas Janousek 5a0cfd
--- 131,136 ----
Tomas Janousek 5a0cfd
  {
Tomas Janousek 5a0cfd
    register char *varname;
Tomas Janousek 5a0cfd
!   int size, i, nr, pass_next, saw_escape, eof, opt, retval, code, print_ps2;
Tomas Janousek 5a0cfd
!   int input_is_tty, input_is_pipe, unbuffered_read, skip_ctlesc, skip_ctlnul;
Tomas Janousek 5a0cfd
    int raw, edit, nchars, silent, have_timeout, fd;
Tomas Janousek 5a0cfd
    unsigned int tmout;
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 135,139 ****
Tomas Janousek 5a0cfd
    char c;
Tomas Janousek 5a0cfd
    char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname;
Tomas Janousek 5a0cfd
!   char *e, *t, *t1;
Tomas Janousek 5a0cfd
    struct stat tsb;
Tomas Janousek 5a0cfd
    SHELL_VAR *var;
Tomas Janousek 5a0cfd
--- 138,142 ----
Tomas Janousek 5a0cfd
    char c;
Tomas Janousek 5a0cfd
    char *input_string, *orig_input_string, *ifs_chars, *prompt, *arrayname;
Tomas Janousek 5a0cfd
!   char *e, *t, *t1, *ps2;
Tomas Janousek 5a0cfd
    struct stat tsb;
Tomas Janousek 5a0cfd
    SHELL_VAR *var;
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 149,152 ****
Tomas Janousek 5a0cfd
--- 152,156 ----
Tomas Janousek 5a0cfd
    USE_VAR(i);
Tomas Janousek 5a0cfd
    USE_VAR(pass_next);
Tomas Janousek 5a0cfd
+   USE_VAR(print_ps2);
Tomas Janousek 5a0cfd
    USE_VAR(saw_escape);
Tomas Janousek 5a0cfd
    USE_VAR(input_is_pipe);
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 164,167 ****
Tomas Janousek 5a0cfd
--- 168,172 ----
Tomas Janousek 5a0cfd
  #endif
Tomas Janousek 5a0cfd
    USE_VAR(list);
Tomas Janousek 5a0cfd
+   USE_VAR(ps2);
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
    i = 0;		/* Index into the string that we are reading. */
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 387,391 ****
Tomas Janousek 5a0cfd
  #endif
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
!   for (eof = retval = 0;;)
Tomas Janousek 5a0cfd
      {
Tomas Janousek 5a0cfd
  #if defined (READLINE)
Tomas Janousek 5a0cfd
--- 394,399 ----
Tomas Janousek 5a0cfd
  #endif
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
!   ps2 = 0;
Tomas Janousek 5a0cfd
!   for (print_ps2 = eof = retval = 0;;)
Tomas Janousek 5a0cfd
      {
Tomas Janousek 5a0cfd
  #if defined (READLINE)
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 413,416 ****
Tomas Janousek 5a0cfd
--- 421,433 ----
Tomas Janousek 5a0cfd
  #endif
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
+       if (print_ps2)
Tomas Janousek 5a0cfd
+ 	{
Tomas Janousek 5a0cfd
+ 	  if (ps2 == 0)
Tomas Janousek 5a0cfd
+ 	    ps2 = get_string_value ("PS2");
Tomas Janousek 5a0cfd
+ 	  fprintf (stderr, "%s", ps2 ? ps2 : "");
Tomas Janousek 5a0cfd
+ 	  fflush (stderr);
Tomas Janousek 5a0cfd
+ 	  print_ps2 = 0;
Tomas Janousek 5a0cfd
+ 	}
Tomas Janousek 5a0cfd
+ 
Tomas Janousek 5a0cfd
        if (unbuffered_read)
Tomas Janousek 5a0cfd
  	retval = zread (fd, &c, 1);
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 441,445 ****
Tomas Janousek 5a0cfd
  	  pass_next = 0;
Tomas Janousek 5a0cfd
  	  if (c == '\n')
Tomas Janousek 5a0cfd
! 	    i--;		/* back up over the CTLESC */
Tomas Janousek 5a0cfd
  	  else
Tomas Janousek 5a0cfd
  	    goto add_char;
Tomas Janousek 5a0cfd
--- 458,466 ----
Tomas Janousek 5a0cfd
  	  pass_next = 0;
Tomas Janousek 5a0cfd
  	  if (c == '\n')
Tomas Janousek 5a0cfd
! 	    {
Tomas Janousek 5a0cfd
! 	      i--;		/* back up over the CTLESC */
Tomas Janousek 5a0cfd
! 	      if (interactive && input_is_tty && raw == 0)
Tomas Janousek 5a0cfd
! 		print_ps2 = 1;
Tomas Janousek 5a0cfd
! 	    }
Tomas Janousek 5a0cfd
  	  else
Tomas Janousek 5a0cfd
  	    goto add_char;
Tomas Janousek 5a0cfd
*** ../bash-3.2/patchlevel.h	Thu Apr 13 08:31:04 2006
Tomas Janousek 5a0cfd
--- patchlevel.h	Mon Oct 16 14:22:54 2006
Tomas Janousek 5a0cfd
***************
Tomas Janousek 5a0cfd
*** 26,30 ****
Tomas Janousek 5a0cfd
     looks for to find the patch level (for the sccs version string). */
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
! #define PATCHLEVEL 21
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
  #endif /* _PATCHLEVEL_H_ */
Tomas Janousek 5a0cfd
--- 26,30 ----
Tomas Janousek 5a0cfd
     looks for to find the patch level (for the sccs version string). */
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
! #define PATCHLEVEL 22
Tomas Janousek 5a0cfd
  
Tomas Janousek 5a0cfd
  #endif /* _PATCHLEVEL_H_ */