summaryrefslogtreecommitdiffstats
path: root/source/a/bash/bash-4.3-patches/bash43-023
blob: d1e4e9d7c74bc4e1628db03bf54f1137e6bcc258 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
			     BASH PATCH REPORT
			     =================

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

Bug-Reported-by:	Tim Friske <me@timfriske.com>
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_ */