07a490
			     BASH PATCH REPORT
07a490
			     =================
07a490
07a490
Bash-Release:	4.2
07a490
Patch-ID:	bash42-036
07a490
07a490
Bug-Reported-by:	gregrwm <backuppc-users@whitleymott.net>
07a490
Bug-Reference-ID:	<CAD+dB9B4JG+qUwZBQUwiQmVt0j6NDn=DDTxr9R+nkA8DL4KLJA@mail.gmail.com>
07a490
Bug-Reference-URL:	http://lists.gnu.org/archive/html/bug-bash/2012-05/msg00108.html
07a490
07a490
Bug-Description:
07a490
07a490
Bash-4.2 produces incorrect word splitting results when expanding
07a490
double-quoted $@ in the same string as and adjacent to other variable
07a490
expansions.  The $@ should be split, the other expansions should not.
07a490
07a490
Patch (apply with `patch -p0'):
07a490
07a490
*** ../bash-4.2-patched/subst.c	2012-05-02 12:02:33.000000000 -0400
07a490
--- subst.c	2012-07-08 21:19:32.000000000 -0400
07a490
***************
07a490
*** 7923,7927 ****
07a490
    /* State flags */
07a490
    int had_quoted_null;
07a490
!   int has_dollar_at;
07a490
    int tflag;
07a490
    int pflags;			/* flags passed to param_expand */
07a490
--- 7923,7927 ----
07a490
    /* State flags */
07a490
    int had_quoted_null;
07a490
!   int has_dollar_at, temp_has_dollar_at;
07a490
    int tflag;
07a490
    int pflags;			/* flags passed to param_expand */
07a490
***************
07a490
*** 8128,8138 ****
07a490
  	    *expanded_something = 1;
07a490
  
07a490
! 	  has_dollar_at = 0;
07a490
  	  pflags = (word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0;
07a490
  	  if (word->flags & W_NOSPLIT2)
07a490
  	    pflags |= PF_NOSPLIT2;
07a490
  	  tword = param_expand (string, &sindex, quoted, expanded_something,
07a490
! 			       &has_dollar_at, &quoted_dollar_at,
07a490
  			       &had_quoted_null, pflags);
07a490
  
07a490
  	  if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal)
07a490
--- 8128,8139 ----
07a490
  	    *expanded_something = 1;
07a490
  
07a490
! 	  temp_has_dollar_at = 0;
07a490
  	  pflags = (word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0;
07a490
  	  if (word->flags & W_NOSPLIT2)
07a490
  	    pflags |= PF_NOSPLIT2;
07a490
  	  tword = param_expand (string, &sindex, quoted, expanded_something,
07a490
! 			       &temp_has_dollar_at, &quoted_dollar_at,
07a490
  			       &had_quoted_null, pflags);
07a490
+ 	  has_dollar_at += temp_has_dollar_at;
07a490
  
07a490
  	  if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal)
07a490
***************
07a490
*** 8275,8281 ****
07a490
  	      temp = (char *)NULL;
07a490
  
07a490
! 	      has_dollar_at = 0;
07a490
  	      /* Need to get W_HASQUOTEDNULL flag through this function. */
07a490
! 	      list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &has_dollar_at, (int *)NULL);
07a490
  
07a490
  	      if (list == &expand_word_error || list == &expand_word_fatal)
07a490
--- 8276,8283 ----
07a490
  	      temp = (char *)NULL;
07a490
  
07a490
! 	      temp_has_dollar_at = 0;	/* XXX */
07a490
  	      /* Need to get W_HASQUOTEDNULL flag through this function. */
07a490
! 	      list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &temp_has_dollar_at, (int *)NULL);
07a490
! 	      has_dollar_at += temp_has_dollar_at;
07a490
  
07a490
  	      if (list == &expand_word_error || list == &expand_word_fatal)
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 35
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 36
07a490
  
07a490
  #endif /* _PATCHLEVEL_H_ */