07a490
			     BASH PATCH REPORT
07a490
			     =================
07a490
07a490
Bash-Release:	4.2
07a490
Patch-ID:	bash42-001
07a490
07a490
Bug-Reported-by:	Juergen Daubert <jue@jue.li>
07a490
Bug-Reference-ID:	<20110214175132.GA19813@jue.netz>
07a490
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2011-02/msg00125.html
07a490
07a490
Bug-Description:
07a490
07a490
When running in Posix mode, bash does not correctly expand the right-hand
07a490
side of a double-quoted word expansion containing single quotes.
07a490
07a490
Patch (apply with `patch -p0'):
07a490
07a490
*** ../bash-4.2-patched/subst.c	2011-01-02 16:12:51.000000000 -0500
07a490
--- subst.c	2011-02-19 00:00:00.000000000 -0500
07a490
***************
07a490
*** 1380,1387 ****
07a490
  
07a490
    /* The handling of dolbrace_state needs to agree with the code in parse.y:
07a490
!      parse_matched_pair() */
07a490
!   dolbrace_state = 0;
07a490
!   if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
07a490
!     dolbrace_state = (flags & SX_POSIXEXP) ? DOLBRACE_QUOTE : DOLBRACE_PARAM;
07a490
  
07a490
    i = *sindex;
07a490
--- 1380,1389 ----
07a490
  
07a490
    /* The handling of dolbrace_state needs to agree with the code in parse.y:
07a490
!      parse_matched_pair().  The different initial value is to handle the
07a490
!      case where this function is called to parse the word in
07a490
!      ${param op word} (SX_WORD). */
07a490
!   dolbrace_state = (flags & SX_WORD) ? DOLBRACE_WORD : DOLBRACE_PARAM;
07a490
!   if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && (flags & SX_POSIXEXP))
07a490
!     dolbrace_state = DOLBRACE_QUOTE;
07a490
  
07a490
    i = *sindex;
07a490
***************
07a490
*** 7177,7181 ****
07a490
        /* Extract the contents of the ${ ... } expansion
07a490
  	 according to the Posix.2 rules. */
07a490
!       value = extract_dollar_brace_string (string, &sindex, quoted, (c == '%' || c == '#') ? SX_POSIXEXP : 0);
07a490
        if (string[sindex] == RBRACE)
07a490
  	sindex++;
07a490
--- 7181,7185 ----
07a490
        /* Extract the contents of the ${ ... } expansion
07a490
  	 according to the Posix.2 rules. */
07a490
!       value = extract_dollar_brace_string (string, &sindex, quoted, (c == '%' || c == '#' || c =='/' || c == '^' || c == ',' || c ==':') ? SX_POSIXEXP|SX_WORD : SX_WORD);
07a490
        if (string[sindex] == RBRACE)
07a490
  	sindex++;
07a490
*** ../bash-4.2-patched/subst.h	2010-12-02 20:21:29.000000000 -0500
07a490
--- subst.h	2011-02-16 21:12:09.000000000 -0500
07a490
***************
07a490
*** 57,60 ****
07a490
--- 57,61 ----
07a490
  #define SX_ARITHSUB	0x0080	/* extracting $(( ... )) (currently unused) */
07a490
  #define SX_POSIXEXP	0x0100	/* extracting new Posix pattern removal expansions in extract_dollar_brace_string */
07a490
+ #define SX_WORD		0x0200	/* extracting word in ${param op word} */
07a490
  
07a490
  /* Remove backslashes which are quoting backquotes from STRING.  Modifies
07a490
*** ../bash-4.2-patched/patchlevel.h	Sat Jun 12 20:14:48 2010
07a490
--- patchlevel.h	Thu Feb 24 21:41:34 2011
07a490
***************
07a490
*** 26,30 ****
07a490
     looks for to find the patch level (for the sccs version string). */
07a490
  
07a490
! #define PATCHLEVEL 0
07a490
  
07a490
  #endif /* _PATCHLEVEL_H_ */
07a490
--- 26,30 ----
07a490
     looks for to find the patch level (for the sccs version string). */
07a490
  
07a490
! #define PATCHLEVEL 1
07a490
  
07a490
  #endif /* _PATCHLEVEL_H_ */