]>
Commit | Line | Data |
---|---|---|
24acfa14 MT |
1 | BASH PATCH REPORT |
2 | ================= | |
3 | ||
4 | Bash-Release: 3.2 | |
5 | Patch-ID: bash32-004 | |
6 | ||
7 | Bug-Reported-by: Stuart Shelton <srcshelton@gmail.com> | |
8 | Bug-Reference-ID: <619141e40610261203y6cda5aa6i23cb24c7aeba996e@mail.gmail.com> | |
9 | Bug-Reference-URL: | |
10 | ||
11 | Bug-Description: | |
12 | ||
13 | A bug in the parameter pattern substitution implementation treated a pattern | |
14 | whose first character was `/' (after expansion) as specifying global | |
15 | replacement. | |
16 | ||
17 | Patch: | |
18 | ||
19 | *** ../bash-3.2/subst.c Tue Sep 19 08:35:09 2006 | |
20 | --- subst.c Thu Oct 26 09:17:50 2006 | |
21 | *************** | |
22 | *** 5707,5712 **** | |
23 | --- 5707,5717 ---- | |
24 | vtype &= ~VT_STARSUB; | |
25 | ||
26 | mflags = 0; | |
27 | + if (patsub && *patsub == '/') | |
28 | + { | |
29 | + mflags |= MATCH_GLOBREP; | |
30 | + patsub++; | |
31 | + } | |
32 | ||
33 | /* Malloc this because expand_string_if_necessary or one of the expansion | |
34 | functions in its call chain may free it on a substitution error. */ | |
35 | *************** | |
36 | *** 5741,5753 **** | |
37 | } | |
38 | ||
39 | /* ksh93 doesn't allow the match specifier to be a part of the expanded | |
40 | ! pattern. This is an extension. */ | |
41 | p = pat; | |
42 | ! if (pat && pat[0] == '/') | |
43 | ! { | |
44 | ! mflags |= MATCH_GLOBREP|MATCH_ANY; | |
45 | ! p++; | |
46 | ! } | |
47 | else if (pat && pat[0] == '#') | |
48 | { | |
49 | mflags |= MATCH_BEG; | |
50 | --- 5746,5757 ---- | |
51 | } | |
52 | ||
53 | /* ksh93 doesn't allow the match specifier to be a part of the expanded | |
54 | ! pattern. This is an extension. Make sure we don't anchor the pattern | |
55 | ! at the beginning or end of the string if we're doing global replacement, | |
56 | ! though. */ | |
57 | p = pat; | |
58 | ! if (mflags & MATCH_GLOBREP) | |
59 | ! mflags |= MATCH_ANY; | |
60 | else if (pat && pat[0] == '#') | |
61 | { | |
62 | mflags |= MATCH_BEG; | |
63 | *** ../bash-3.2/tests/new-exp.right Thu Aug 10 12:00:00 2006 | |
64 | --- tests/new-exp.right Sun Oct 29 16:03:36 2006 | |
65 | *************** | |
66 | *** 430,436 **** | |
67 | Case06---1---A B C::--- | |
68 | Case07---3---A:B:C--- | |
69 | Case08---3---A:B:C--- | |
70 | ! ./new-exp.tests: line 506: /${$(($#-1))}: bad substitution | |
71 | argv[1] = <a> | |
72 | argv[2] = <b> | |
73 | argv[3] = <c> | |
74 | --- 430,436 ---- | |
75 | Case06---1---A B C::--- | |
76 | Case07---3---A:B:C--- | |
77 | Case08---3---A:B:C--- | |
78 | ! ./new-exp.tests: line 506: ${$(($#-1))}: bad substitution | |
79 | argv[1] = <a> | |
80 | argv[2] = <b> | |
81 | argv[3] = <c> | |
82 | *** ../bash-3.2/patchlevel.h Thu Apr 13 08:31:04 2006 | |
83 | --- patchlevel.h Mon Oct 16 14:22:54 2006 | |
84 | *************** | |
85 | *** 26,30 **** | |
86 | looks for to find the patch level (for the sccs version string). */ | |
87 | ||
88 | ! #define PATCHLEVEL 3 | |
89 | ||
90 | #endif /* _PATCHLEVEL_H_ */ | |
91 | --- 26,30 ---- | |
92 | looks for to find the patch level (for the sccs version string). */ | |
93 | ||
94 | ! #define PATCHLEVEL 4 | |
95 | ||
96 | #endif /* _PATCHLEVEL_H_ */ |