]> git.pld-linux.org Git - packages/bash.git/blame - bash42-025
- up to 4.2.37
[packages/bash.git] / bash42-025
CommitLineData
e5ec3c9c
ER
1 BASH PATCH REPORT
2 =================
3
4Bash-Release: 4.2
5Patch-ID: bash42-025
6
7Bug-Reported-by: Bill Gradwohl <bill@ycc.com>
8Bug-Reference-ID: <CAFyvKis-UfuOWr5THBRKh=vYHDoKEEgdW8hN1RviTuYQ00Lu5A@mail.gmail.com>
9Bug-Reference-URL: http://lists.gnu.org/archive/html/help-bash/2012-03/msg00078.html
10
11Bug-Description:
12
13When used in a shell function, `declare -g -a array=(compound assignment)'
14creates a local variable instead of a global one.
15
16Patch (apply with `patch -p0'):
17
18*** ../bash-4.2-patched/command.h 2010-08-02 19:36:51.000000000 -0400
19--- command.h 2012-04-01 12:38:35.000000000 -0400
20***************
21*** 98,101 ****
22--- 98,102 ----
23 #define W_ASSIGNASSOC 0x400000 /* word looks like associative array assignment */
24 #define W_ARRAYIND 0x800000 /* word is an array index being expanded */
25+ #define W_ASSNGLOBAL 0x1000000 /* word is a global assignment to declare (declare/typeset -g) */
26
27 /* Possible values for subshell_environment */
28*** ../bash-4.2-patched/execute_cmd.c 2011-11-21 18:03:41.000000000 -0500
29--- execute_cmd.c 2012-04-01 12:42:03.000000000 -0400
30***************
31*** 3581,3585 ****
32 WORD_LIST *w;
33 struct builtin *b;
34! int assoc;
35
36 if (words == 0)
37--- 3581,3585 ----
38 WORD_LIST *w;
39 struct builtin *b;
40! int assoc, global;
41
42 if (words == 0)
43***************
44*** 3587,3591 ****
45
46 b = 0;
47! assoc = 0;
48
49 for (w = words; w; w = w->next)
50--- 3587,3591 ----
51
52 b = 0;
53! assoc = global = 0;
54
55 for (w = words; w; w = w->next)
56***************
57*** 3604,3607 ****
58--- 3604,3609 ----
59 if (assoc)
60 w->word->flags |= W_ASSIGNASSOC;
61+ if (global)
62+ w->word->flags |= W_ASSNGLOBAL;
63 #endif
64 }
65***************
66*** 3609,3613 ****
67 /* Note that we saw an associative array option to a builtin that takes
68 assignment statements. This is a bit of a kludge. */
69! else if (w->word->word[0] == '-' && strchr (w->word->word, 'A'))
70 {
71 if (b == 0)
72--- 3611,3618 ----
73 /* Note that we saw an associative array option to a builtin that takes
74 assignment statements. This is a bit of a kludge. */
75! else if (w->word->word[0] == '-' && (strchr (w->word->word+1, 'A') || strchr (w->word->word+1, 'g')))
76! #else
77! else if (w->word->word[0] == '-' && strchr (w->word->word+1, 'g'))
78! #endif
79 {
80 if (b == 0)
81***************
82*** 3619,3626 ****
83 words->word->flags |= W_ASSNBLTIN;
84 }
85! if (words->word->flags & W_ASSNBLTIN)
86 assoc = 1;
87 }
88- #endif
89 }
90
91--- 3624,3632 ----
92 words->word->flags |= W_ASSNBLTIN;
93 }
94! if ((words->word->flags & W_ASSNBLTIN) && strchr (w->word->word+1, 'A'))
95 assoc = 1;
96+ if ((words->word->flags & W_ASSNBLTIN) && strchr (w->word->word+1, 'g'))
97+ global = 1;
98 }
99 }
100
101*** ../bash-4.2-patched/subst.c 2012-03-11 17:35:13.000000000 -0400
102--- subst.c 2012-04-01 12:38:35.000000000 -0400
103***************
104*** 367,370 ****
105--- 367,375 ----
106 fprintf (stderr, "W_ASSNBLTIN%s", f ? "|" : "");
107 }
108+ if (f & W_ASSNGLOBAL)
109+ {
110+ f &= ~W_ASSNGLOBAL;
111+ fprintf (stderr, "W_ASSNGLOBAL%s", f ? "|" : "");
112+ }
113 if (f & W_COMPASSIGN)
114 {
115***************
116*** 2804,2808 ****
117 else if (assign_list)
118 {
119! if (word->flags & W_ASSIGNARG)
120 aflags |= ASS_MKLOCAL;
121 if (word->flags & W_ASSIGNASSOC)
122--- 2809,2813 ----
123 else if (assign_list)
124 {
125! if ((word->flags & W_ASSIGNARG) && (word->flags & W_ASSNGLOBAL) == 0)
126 aflags |= ASS_MKLOCAL;
127 if (word->flags & W_ASSIGNASSOC)
128
129*** ../bash-4.2-patched/patchlevel.h Sat Jun 12 20:14:48 2010
130--- patchlevel.h Thu Feb 24 21:41:34 2011
131***************
132*** 26,30 ****
133 looks for to find the patch level (for the sccs version string). */
134
135! #define PATCHLEVEL 24
136
137 #endif /* _PATCHLEVEL_H_ */
138--- 26,30 ----
139 looks for to find the patch level (for the sccs version string). */
140
141! #define PATCHLEVEL 25
142
143 #endif /* _PATCHLEVEL_H_ */
This page took 0.044941 seconds and 4 git commands to generate.