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