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