BASH PATCH REPORT
                            =================

Bash-Release:   4.3
Patch-ID:       bash43-023

Bug-Reported-by:        Tim Friske <[email protected]>
Bug-Reference-ID:       <CAM1RzOcOR9zzC2i+aeES6LtbHNHoOV+0pZEYPrqxv_QAii-RXA@mail.gmail.com>
Bug-Reference-URL:      http://lists.gnu.org/archive/html/bug-bash/2014-06/msg00056.html

Bug-Description:

Bash does not correctly parse process substitution constructs that contain
unbalanced parentheses as part of the contained command.

Patch (apply with `patch -p0'):

*** ../bash-4.3-patched/subst.h 2014-01-11 21:02:27.000000000 -0500
--- subst.h     2014-07-20 17:25:01.000000000 -0400
***************
*** 83,87 ****
    Start extracting at (SINDEX) as if we had just seen "<(".
    Make (SINDEX) get the position just after the matching ")". */
! extern char *extract_process_subst __P((char *, char *, int *));
 #endif /* PROCESS_SUBSTITUTION */

--- 83,87 ----
    Start extracting at (SINDEX) as if we had just seen "<(".
    Make (SINDEX) get the position just after the matching ")". */
! extern char *extract_process_subst __P((char *, char *, int *, int));
 #endif /* PROCESS_SUBSTITUTION */

*** ../bash-4.3-patched/subst.c 2014-05-15 08:26:45.000000000 -0400
--- subst.c     2014-07-20 17:26:44.000000000 -0400
***************
*** 1193,1202 ****
    Make (SINDEX) get the position of the matching ")". */ /*))*/
 char *
! extract_process_subst (string, starter, sindex)
      char *string;
      char *starter;
      int *sindex;
 {
   return (extract_delimited_string (string, sindex, starter, "(", ")", SX_COMMAND));
 }
 #endif /* PROCESS_SUBSTITUTION */
--- 1193,1208 ----
    Make (SINDEX) get the position of the matching ")". */ /*))*/
 char *
! extract_process_subst (string, starter, sindex, xflags)
      char *string;
      char *starter;
      int *sindex;
+      int xflags;
 {
+ #if 0
   return (extract_delimited_string (string, sindex, starter, "(", ")", SX_COMMAND));
+ #else
+   xflags |= (no_longjmp_on_fatal_error ? SX_NOLONGJMP : 0);
+   return (xparse_dolparen (string, string+*sindex, sindex, xflags));
+ #endif
 }
 #endif /* PROCESS_SUBSTITUTION */
***************
*** 1786,1790 ****
         if (string[si] == '\0')
           CQ_RETURN(si);
!         temp = extract_process_subst (string, (c == '<') ? "<(" : ">(", &si);
         free (temp);          /* no SX_ALLOC here */
         i = si;
--- 1792,1796 ----
         if (string[si] == '\0')
           CQ_RETURN(si);
!         temp = extract_process_subst (string, (c == '<') ? "<(" : ">(", &si, 0);
         free (temp);          /* no SX_ALLOC here */
         i = si;
***************
*** 8250,8254 ****
             t_index = sindex + 1; /* skip past both '<' and LPAREN */

!           temp1 = extract_process_subst (string, (c == '<') ? "<(" : ">(", &t_index); /*))*/
           sindex = t_index;

--- 8256,8260 ----
             t_index = sindex + 1; /* skip past both '<' and LPAREN */

!           temp1 = extract_process_subst (string, (c == '<') ? "<(" : ">(", &t_index, 0); /*))*/
           sindex = t_index;

*** ../bash-4.3/patchlevel.h    2012-12-29 10:47:57.000000000 -0500
--- patchlevel.h        2014-03-20 20:01:28.000000000 -0400
***************
*** 26,30 ****
    looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 22

 #endif /* _PATCHLEVEL_H_ */
--- 26,30 ----
    looks for to find the patch level (for the sccs version string). */

! #define PATCHLEVEL 23

 #endif /* _PATCHLEVEL_H_ */