Roman Rakus 02b541
			     BASH PATCH REPORT
Roman Rakus 02b541
			     =================
Roman Rakus 02b541
Roman Rakus 02b541
Bash-Release:	4.1
Roman Rakus 02b541
Patch-ID:	bash41-006
Roman Rakus 02b541
Roman Rakus 02b541
Bug-Reported-by:	Mike Frysinger <vapier@gentoo.org>
Roman Rakus 02b541
Bug-Reference-ID:	<201003210155.56618.vapier@gentoo.org>
Roman Rakus 02b541
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2010-03/msg00063.html
Roman Rakus 02b541
Roman Rakus 02b541
Bug-Description:
Roman Rakus 02b541
Roman Rakus 02b541
Bash did not correctly print/reproduce here documents attached to commands
Roman Rakus 02b541
inside compound commands such as for and while.  This affected the
Roman Rakus 02b541
execution of such commands inside a shell function when the function
Roman Rakus 02b541
definition is saved and later restored using `.' or `eval'.
Roman Rakus 02b541
Roman Rakus 02b541
Patch (apply with `patch -p0'):
Roman Rakus 02b541
Roman Rakus 02b541
*** ../bash-4.1-patched/print_cmd.c	2009-09-16 15:32:26.000000000 -0400
Roman Rakus 02b541
--- print_cmd.c	2010-03-22 21:15:30.000000000 -0400
Roman Rakus 02b541
***************
Roman Rakus 02b541
*** 114,117 ****
Roman Rakus 02b541
--- 114,123 ----
Roman Rakus 02b541
  #define CHECK_XTRACE_FP	xtrace_fp = (xtrace_fp ? xtrace_fp : stderr)
Roman Rakus 02b541
  
Roman Rakus 02b541
+ #define PRINT_DEFERRED_HEREDOCS(x) \
Roman Rakus 02b541
+   do { \
Roman Rakus 02b541
+     if (deferred_heredocs) \
Roman Rakus 02b541
+       print_deferred_heredocs (x); \
Roman Rakus 02b541
+   } while (0)
Roman Rakus 02b541
+ 
Roman Rakus 02b541
  /* Non-zero means the stuff being printed is inside of a function def. */
Roman Rakus 02b541
  static int inside_function_def;
Roman Rakus 02b541
***************
Roman Rakus 02b541
*** 561,571 ****
Roman Rakus 02b541
  {
Roman Rakus 02b541
    print_for_command_head (for_command);
Roman Rakus 02b541
- 
Roman Rakus 02b541
    cprintf (";");
Roman Rakus 02b541
    newline ("do\n");
Roman Rakus 02b541
    indentation += indentation_amount;
Roman Rakus 02b541
    make_command_string_internal (for_command->action);
Roman Rakus 02b541
    semicolon ();
Roman Rakus 02b541
    indentation -= indentation_amount;
Roman Rakus 02b541
    newline ("done");
Roman Rakus 02b541
  }
Roman Rakus 02b541
--- 566,578 ----
Roman Rakus 02b541
  {
Roman Rakus 02b541
    print_for_command_head (for_command);
Roman Rakus 02b541
    cprintf (";");
Roman Rakus 02b541
    newline ("do\n");
Roman Rakus 02b541
+ 
Roman Rakus 02b541
    indentation += indentation_amount;
Roman Rakus 02b541
    make_command_string_internal (for_command->action);
Roman Rakus 02b541
+   PRINT_DEFERRED_HEREDOCS ("");
Roman Rakus 02b541
    semicolon ();
Roman Rakus 02b541
    indentation -= indentation_amount;
Roman Rakus 02b541
+ 
Roman Rakus 02b541
    newline ("done");
Roman Rakus 02b541
  }
Roman Rakus 02b541
*** ../bash-4.1-patched/patchlevel.h	2009-10-01 16:39:22.000000000 -0400
Roman Rakus 02b541
--- patchlevel.h	2010-01-14 09:38:08.000000000 -0500
Roman Rakus 02b541
***************
Roman Rakus 02b541
*** 26,30 ****
Roman Rakus 02b541
     looks for to find the patch level (for the sccs version string). */
Roman Rakus 02b541
  
Roman Rakus 02b541
! #define PATCHLEVEL 5
Roman Rakus 02b541
  
Roman Rakus 02b541
  #endif /* _PATCHLEVEL_H_ */
Roman Rakus 02b541
--- 26,30 ----
Roman Rakus 02b541
     looks for to find the patch level (for the sccs version string). */
Roman Rakus 02b541
  
Roman Rakus 02b541
! #define PATCHLEVEL 6
Roman Rakus 02b541
  
Roman Rakus 02b541
  #endif /* _PATCHLEVEL_H_ */