On 5/23/12 10:47 PM, gregrwm wrote:
> Machine Type: x86_64-redhat-linux-gnu
>
> Bash Version: 4.1
> Patch Level: 2
> Release Status: release
>
> Description:
> expansion anomaly with quoted and concatenated positional parameters
This wasn't actually that hard to fix. The attached patch should apply
fairly cleanly to bash-4.2.28.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/
*** ../bash-20120518/subst.c 2012-05-07 16:06:35.000000000 -0400
--- subst.c 2012-05-27 21:56:19.000000000 -0400
***************
*** 7929,7933 ****
/* State flags */
int had_quoted_null;
! int has_dollar_at;
int tflag;
int pflags; /* flags passed to param_expand */
--- 7940,7944 ----
/* State flags */
int had_quoted_null;
! int has_dollar_at, temp_has_dollar_at;
int tflag;
int pflags; /* flags passed to param_expand */
***************
*** 8134,8138 ****
*expanded_something = 1;
! has_dollar_at = 0;
pflags = (word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0;
if (word->flags & W_NOSPLIT2)
--- 8145,8149 ----
*expanded_something = 1;
! temp_has_dollar_at = 0;
pflags = (word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0;
if (word->flags & W_NOSPLIT2)
***************
*** 8141,8146 ****
pflags |= PF_ASSIGNRHS;
tword = param_expand (string, &sindex, quoted, expanded_something,
! &has_dollar_at, "ed_dollar_at,
&had_quoted_null, pflags);
if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal)
--- 8152,8158 ----
pflags |= PF_ASSIGNRHS;
tword = param_expand (string, &sindex, quoted, expanded_something,
! &temp_has_dollar_at, "ed_dollar_at,
&had_quoted_null, pflags);
+ has_dollar_at += temp_has_dollar_at;
if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal)
***************
*** 8284,8290 ****
temp = (char *)NULL;
! has_dollar_at = 0;
/* Need to get W_HASQUOTEDNULL flag through this function. */
! list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &has_dollar_at, (int *)NULL);
if (list == &expand_word_error || list == &expand_word_fatal)
--- 8296,8303 ----
temp = (char *)NULL;
! temp_has_dollar_at = 0; /* XXX */
/* Need to get W_HASQUOTEDNULL flag through this function. */
! list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &temp_has_dollar_at, (int *)NULL);
! has_dollar_at += temp_has_dollar_at;
if (list == &expand_word_error || list == &expand_word_fatal)