bash-4.2-036.patch 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. BASH PATCH REPORT
  2. =================
  3. Bash-Release: 4.2
  4. Patch-ID: bash42-036
  5. Bug-Reported-by: gregrwm <backuppc-users@whitleymott.net>
  6. Bug-Reference-ID: <CAD+dB9B4JG+qUwZBQUwiQmVt0j6NDn=DDTxr9R+nkA8DL4KLJA@mail.gmail.com>
  7. Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2012-05/msg00108.html
  8. Bug-Description:
  9. Bash-4.2 produces incorrect word splitting results when expanding
  10. double-quoted $@ in the same string as and adjacent to other variable
  11. expansions. The $@ should be split, the other expansions should not.
  12. Patch (apply with `patch -p0'):
  13. *** ../bash-4.2-patched/subst.c 2012-05-02 12:02:33.000000000 -0400
  14. --- ./subst.c 2012-07-08 21:19:32.000000000 -0400
  15. ***************
  16. *** 7923,7927 ****
  17. /* State flags */
  18. int had_quoted_null;
  19. ! int has_dollar_at;
  20. int tflag;
  21. int pflags; /* flags passed to param_expand */
  22. --- 7923,7927 ----
  23. /* State flags */
  24. int had_quoted_null;
  25. ! int has_dollar_at, temp_has_dollar_at;
  26. int tflag;
  27. int pflags; /* flags passed to param_expand */
  28. ***************
  29. *** 8128,8138 ****
  30. *expanded_something = 1;
  31. ! has_dollar_at = 0;
  32. pflags = (word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0;
  33. if (word->flags & W_NOSPLIT2)
  34. pflags |= PF_NOSPLIT2;
  35. tword = param_expand (string, &sindex, quoted, expanded_something,
  36. ! &has_dollar_at, &quoted_dollar_at,
  37. &had_quoted_null, pflags);
  38. if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal)
  39. --- 8128,8139 ----
  40. *expanded_something = 1;
  41. ! temp_has_dollar_at = 0;
  42. pflags = (word->flags & W_NOCOMSUB) ? PF_NOCOMSUB : 0;
  43. if (word->flags & W_NOSPLIT2)
  44. pflags |= PF_NOSPLIT2;
  45. tword = param_expand (string, &sindex, quoted, expanded_something,
  46. ! &temp_has_dollar_at, &quoted_dollar_at,
  47. &had_quoted_null, pflags);
  48. + has_dollar_at += temp_has_dollar_at;
  49. if (tword == &expand_wdesc_error || tword == &expand_wdesc_fatal)
  50. ***************
  51. *** 8275,8281 ****
  52. temp = (char *)NULL;
  53. ! has_dollar_at = 0;
  54. /* Need to get W_HASQUOTEDNULL flag through this function. */
  55. ! list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &has_dollar_at, (int *)NULL);
  56. if (list == &expand_word_error || list == &expand_word_fatal)
  57. --- 8276,8283 ----
  58. temp = (char *)NULL;
  59. ! temp_has_dollar_at = 0; /* XXX */
  60. /* Need to get W_HASQUOTEDNULL flag through this function. */
  61. ! list = expand_word_internal (tword, Q_DOUBLE_QUOTES, 0, &temp_has_dollar_at, (int *)NULL);
  62. ! has_dollar_at += temp_has_dollar_at;
  63. if (list == &expand_word_error || list == &expand_word_fatal)
  64. *** ../bash-4.2-patched/patchlevel.h Sat Jun 12 20:14:48 2010
  65. --- ./patchlevel.h Thu Feb 24 21:41:34 2011
  66. ***************
  67. *** 26,30 ****
  68. looks for to find the patch level (for the sccs version string). */
  69. ! #define PATCHLEVEL 35
  70. #endif /* _PATCHLEVEL_H_ */
  71. --- 26,30 ----
  72. looks for to find the patch level (for the sccs version string). */
  73. ! #define PATCHLEVEL 36
  74. #endif /* _PATCHLEVEL_H_ */