source: scripts/patches/bash-3.0-fixes-1.patch@ ec723bb

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since ec723bb was 7f65c0e, checked in by Jim Gifford <clfs@…>, 19 years ago

r625@server (orig r623): jim | 2005-10-31 12:43:24 -0800
Final Move

  • Property mode set to 100644
File size: 20.7 KB
RevLine 
[617118d]1Submitted By: Jim Gifford (patches at jg555 dot com)
2Date: 2004-09-29
3Initial Package Version: 3.0
4Origin: Various
5Upstream Status: Already Applied
6Description: This is all the patches that were release by
7 Chet for Bash 3.0. These will appear in the
8 next release. The original patches are at
9 ftp://ftp.cwru.edu/pub/bash/bash-3.0-patches
10
11
12diff -Naur bash-3.0.orig/array.c bash-3.0/array.c
13--- bash-3.0.orig/array.c 2004-05-06 12:24:13.000000000 +0000
14+++ bash-3.0/array.c 2004-09-29 16:37:42.025614472 +0000
15@@ -451,7 +451,7 @@
16 */
17 array_dispose_element(new);
18 free(element_value(ae));
19- ae->value = savestring(v);
20+ ae->value = v ? savestring(v) : (char *)NULL;
21 return(0);
22 } else if (element_index(ae) > i) {
23 ADD_BEFORE(ae, new);
24diff -Naur bash-3.0.orig/arrayfunc.c bash-3.0/arrayfunc.c
25--- bash-3.0.orig/arrayfunc.c 2003-12-19 05:03:09.000000000 +0000
26+++ bash-3.0/arrayfunc.c 2004-09-29 16:37:41.925629672 +0000
27@@ -611,7 +611,7 @@
28 var = find_variable (t);
29
30 free (t);
31- return var;
32+ return (var == 0 || invisible_p (var)) ? (SHELL_VAR *)0 : var;
33 }
34
35 /* Return a string containing the elements in the array and subscript
36diff -Naur bash-3.0.orig/bashline.c bash-3.0/bashline.c
37--- bash-3.0.orig/bashline.c 2004-07-06 03:22:12.000000000 +0000
38+++ bash-3.0/bashline.c 2004-09-29 16:38:00.851752464 +0000
39@@ -100,6 +100,7 @@
40 #endif
41
42 /* Helper functions for Readline. */
43+static int bash_directory_expansion __P((char **));
44 static int bash_directory_completion_hook __P((char **));
45 static int filename_completion_ignore __P((char **));
46 static int bash_push_line __P((void));
47@@ -292,7 +293,7 @@
48 /* See if we have anything to do. */
49 at = strchr (rl_completer_word_break_characters, '@');
50 if ((at == 0 && on_or_off == 0) || (at != 0 && on_or_off != 0))
51- return;
52+ return old_value;
53
54 /* We have something to do. Do it. */
55 nval = (char *)xmalloc (strlen (rl_completer_word_break_characters) + 1 + on_or_off);
56@@ -1406,10 +1407,19 @@
57 filename. */
58 if (*hint_text == '~')
59 {
60- int l, tl, vl;
61+ int l, tl, vl, dl;
62+ char *rd;
63 vl = strlen (val);
64 tl = strlen (hint_text);
65+#if 0
66 l = vl - hint_len; /* # of chars added */
67+#else
68+ rd = savestring (filename_hint);
69+ bash_directory_expansion (&rd);
70+ dl = strlen (rd);
71+ l = vl - dl; /* # of chars added */
72+ free (rd);
73+#endif
74 temp = (char *)xmalloc (l + 2 + tl);
75 strcpy (temp, hint_text);
76 strcpy (temp + tl, val + vl - l);
77@@ -2187,6 +2197,27 @@
78 return 0;
79 }
80
81+/* Simulate the expansions that will be performed by
82+ rl_filename_completion_function. This must be called with the address of
83+ a pointer to malloc'd memory. */
84+static int
85+bash_directory_expansion (dirname)
86+ char **dirname;
87+{
88+ char *d;
89+
90+ d = savestring (*dirname);
91+
92+ if (rl_directory_rewrite_hook)
93+ (*rl_directory_rewrite_hook) (&d);
94+
95+ if (rl_directory_completion_hook && (*rl_directory_completion_hook) (&d))
96+ {
97+ free (*dirname);
98+ *dirname = d;
99+ }
100+}
101+
102 /* Handle symbolic link references and other directory name
103 expansions while hacking completion. */
104 static int
105@@ -2513,7 +2544,7 @@
106 static char **matches = (char **)NULL;
107 static int ind;
108 int glen;
109- char *ret;
110+ char *ret, *ttext;
111
112 if (state == 0)
113 {
114@@ -2523,17 +2554,22 @@
115 FREE (globorig);
116 FREE (globtext);
117
118+ ttext = bash_tilde_expand (text, 0);
119+
120 if (rl_explicit_arg)
121 {
122- globorig = savestring (text);
123- glen = strlen (text);
124+ globorig = savestring (ttext);
125+ glen = strlen (ttext);
126 globtext = (char *)xmalloc (glen + 2);
127- strcpy (globtext, text);
128+ strcpy (globtext, ttext);
129 globtext[glen] = '*';
130 globtext[glen+1] = '\0';
131 }
132 else
133- globtext = globorig = savestring (text);
134+ globtext = globorig = savestring (ttext);
135+
136+ if (ttext != text)
137+ free (ttext);
138
139 matches = shell_glob_filename (globtext);
140 if (GLOB_FAILED (matches))
141diff -Naur bash-3.0.orig/braces.c bash-3.0/braces.c
142--- bash-3.0.orig/braces.c 2003-12-04 16:09:52.000000000 +0000
143+++ bash-3.0/braces.c 2004-09-29 16:37:49.259514752 +0000
144@@ -340,8 +340,8 @@
145
146 if (lhs_t == ST_CHAR)
147 {
148- lhs_v = lhs[0];
149- rhs_v = rhs[0];
150+ lhs_v = (unsigned char)lhs[0];
151+ rhs_v = (unsigned char)rhs[0];
152 }
153 else
154 {
155@@ -402,6 +402,7 @@
156 {
157 pass_next = 1;
158 i++;
159+ level++;
160 continue;
161 }
162 #endif
163diff -Naur bash-3.0.orig/builtins/trap.def bash-3.0/builtins/trap.def
164--- bash-3.0.orig/builtins/trap.def 2004-05-28 02:26:19.000000000 +0000
165+++ bash-3.0/builtins/trap.def 2004-09-29 16:37:44.468243136 +0000
166@@ -23,7 +23,7 @@
167
168 $BUILTIN trap
169 $FUNCTION trap_builtin
170-$SHORT_DOC trap [-lp] [[arg] signal_spec ...]
171+$SHORT_DOC trap [-lp] [arg signal_spec ...]
172 The command ARG is to be read and executed when the shell receives
173 signal(s) SIGNAL_SPEC. If ARG is absent (and a single SIGNAL_SPEC
174 is supplied) or `-', each specified signal is reset to its original
175@@ -87,7 +87,7 @@
176 trap_builtin (list)
177 WORD_LIST *list;
178 {
179- int list_signal_names, display, result, opt;
180+ int list_signal_names, display, result, opt, first_signal;
181
182 list_signal_names = display = 0;
183 result = EXECUTION_SUCCESS;
184@@ -118,14 +118,19 @@
185 else
186 {
187 char *first_arg;
188- int operation, sig;
189+ int operation, sig, first_signal;
190
191 operation = SET;
192 first_arg = list->word->word;
193+ first_signal = first_arg && *first_arg && all_digits (first_arg) && signal_object_p (first_arg, opt);
194+
195+ /* Backwards compatibility */
196+ if (first_signal)
197+ operation = REVERT;
198 /* When in posix mode, the historical behavior of looking for a
199 missing first argument is disabled. To revert to the original
200 signal handling disposition, use `-' as the first argument. */
201- if (posixly_correct == 0 && first_arg && *first_arg &&
202+ else if (posixly_correct == 0 && first_arg && *first_arg &&
203 (*first_arg != '-' || first_arg[1]) &&
204 signal_object_p (first_arg, opt) && list->next == 0)
205 operation = REVERT;
206diff -Naur bash-3.0.orig/doc/bashref.texi bash-3.0/doc/bashref.texi
207--- bash-3.0.orig/doc/bashref.texi 2004-06-26 18:26:07.000000000 +0000
208+++ bash-3.0/doc/bashref.texi 2004-09-29 16:37:44.521235080 +0000
209@@ -5953,7 +5953,8 @@
210 @item
211 The @code{trap} builtin doesn't check the first argument for a possible
212 signal specification and revert the signal handling to the original
213-disposition if it is. If users want to reset the handler for a given
214+disposition if it is, unless that argument consists solely of digits and
215+is a valid signal number. If users want to reset the handler for a given
216 signal to the original disposition, they should use @samp{-} as the
217 first argument.
218
219diff -Naur bash-3.0.orig/include/shmbutil.h bash-3.0/include/shmbutil.h
220--- bash-3.0.orig/include/shmbutil.h 2004-04-19 13:59:42.000000000 +0000
221+++ bash-3.0/include/shmbutil.h 2004-09-29 16:37:45.498086576 +0000
222@@ -31,6 +31,8 @@
223 extern size_t xmbsrtowcs __P((wchar_t *, const char **, size_t, mbstate_t *));
224 extern size_t xdupmbstowcs __P((wchar_t **, char ***, const char *));
225
226+extern size_t mbstrlen __P((const char *));
227+
228 extern char *xstrchr __P((const char *, int));
229
230 #ifndef MB_INVALIDCH
231@@ -38,6 +40,9 @@
232 #define MB_NULLWCH(x) ((x) == 0)
233 #endif
234
235+#define MBSLEN(s) (((s) && (s)[0]) ? ((s)[1] ? mbstrlen (s) : 1) : 0)
236+#define MB_STRLEN(s) ((MB_CUR_MAX > 1) ? MBSLEN (s) : STRLEN (s))
237+
238 #else /* !HANDLE_MULTIBYTE */
239
240 #undef MB_LEN_MAX
241@@ -54,6 +59,8 @@
242 #define MB_NULLWCH(x) (0)
243 #endif
244
245+#define MB_STRLEN(s) (STRLEN(s))
246+
247 #endif /* !HANDLE_MULTIBYTE */
248
249 /* Declare and initialize a multibyte state. Call must be terminated
250diff -Naur bash-3.0.orig/jobs.c bash-3.0/jobs.c
251--- bash-3.0.orig/jobs.c 2004-04-23 20:28:25.000000000 +0000
252+++ bash-3.0/jobs.c 2004-09-29 16:37:59.332983352 +0000
253@@ -1778,8 +1778,13 @@
254 if (pipefail_opt)
255 {
256 fail = 0;
257- for (p = jobs[job]->pipe; p->next != jobs[job]->pipe; p = p->next)
258- if (p->status != EXECUTION_SUCCESS) fail = p->status;
259+ p = jobs[job]->pipe;
260+ do
261+ {
262+ if (p->status != EXECUTION_SUCCESS) fail = p->status;
263+ p = p->next;
264+ }
265+ while (p != jobs[job]->pipe);
266 return fail;
267 }
268
269diff -Naur bash-3.0.orig/lib/readline/display.c bash-3.0/lib/readline/display.c
270--- bash-3.0.orig/lib/readline/display.c 2004-05-28 02:57:51.000000000 +0000
271+++ bash-3.0/lib/readline/display.c 2004-09-29 16:37:47.413795344 +0000
272@@ -201,7 +201,7 @@
273 int *lp, *lip, *niflp, *vlp;
274 {
275 char *r, *ret, *p;
276- int l, rl, last, ignoring, ninvis, invfl, ind, pind, physchars;
277+ int l, rl, last, ignoring, ninvis, invfl, invflset, ind, pind, physchars;
278
279 /* Short-circuit if we can. */
280 if ((MB_CUR_MAX <= 1 || rl_byte_oriented) && strchr (pmt, RL_PROMPT_START_IGNORE) == 0)
281@@ -222,6 +222,7 @@
282 r = ret = (char *)xmalloc (l + 1);
283
284 invfl = 0; /* invisible chars in first line of prompt */
285+ invflset = 0; /* we only want to set invfl once */
286
287 for (rl = ignoring = last = ninvis = physchars = 0, p = pmt; p && *p; p++)
288 {
289@@ -249,7 +250,10 @@
290 while (l--)
291 *r++ = *p++;
292 if (!ignoring)
293- rl += ind - pind;
294+ {
295+ rl += ind - pind;
296+ physchars += _rl_col_width (pmt, pind, ind);
297+ }
298 else
299 ninvis += ind - pind;
300 p--; /* compensate for later increment */
301@@ -259,16 +263,19 @@
302 {
303 *r++ = *p;
304 if (!ignoring)
305- rl++; /* visible length byte counter */
306+ {
307+ rl++; /* visible length byte counter */
308+ physchars++;
309+ }
310 else
311 ninvis++; /* invisible chars byte counter */
312 }
313
314- if (rl >= _rl_screenwidth)
315- invfl = ninvis;
316-
317- if (ignoring == 0)
318- physchars++;
319+ if (invflset == 0 && rl >= _rl_screenwidth)
320+ {
321+ invfl = ninvis;
322+ invflset = 1;
323+ }
324 }
325 }
326
327@@ -351,14 +358,14 @@
328 local_prompt = expand_prompt (p, &prompt_visible_length,
329 &prompt_last_invisible,
330 (int *)NULL,
331- (int *)NULL);
332+ &prompt_physical_chars);
333 c = *t; *t = '\0';
334 /* The portion of the prompt string up to and including the
335 final newline is now null-terminated. */
336 local_prompt_prefix = expand_prompt (prompt, &prompt_prefix_length,
337 (int *)NULL,
338 &prompt_invis_chars_first_line,
339- &prompt_physical_chars);
340+ (int *)NULL);
341 *t = c;
342 return (prompt_prefix_length);
343 }
344@@ -417,7 +424,7 @@
345 register int in, out, c, linenum, cursor_linenum;
346 register char *line;
347 int c_pos, inv_botlin, lb_botlin, lb_linenum;
348- int newlines, lpos, temp, modmark;
349+ int newlines, lpos, temp, modmark, n0, num;
350 char *prompt_this_line;
351 #if defined (HANDLE_MULTIBYTE)
352 wchar_t wc;
353@@ -573,6 +580,7 @@
354
355 #if defined (HANDLE_MULTIBYTE)
356 memset (_rl_wrapped_line, 0, vis_lbsize);
357+ num = 0;
358 #endif
359
360 /* prompt_invis_chars_first_line is the number of invisible characters in
361@@ -591,13 +599,32 @@
362 probably too much work for the benefit gained. How many people have
363 prompts that exceed two physical lines?
364 Additional logic fix from Edward Catmur <ed@catmur.co.uk> */
365+#if defined (HANDLE_MULTIBYTE)
366+ n0 = num;
367+ temp = local_prompt ? strlen (local_prompt) : 0;
368+ while (num < temp)
369+ {
370+ if (_rl_col_width (local_prompt, n0, num) > _rl_screenwidth)
371+ {
372+ num = _rl_find_prev_mbchar (local_prompt, num, MB_FIND_ANY);
373+ break;
374+ }
375+ num++;
376+ }
377+ temp = num +
378+#else
379 temp = ((newlines + 1) * _rl_screenwidth) +
380+#endif /* !HANDLE_MULTIBYTE */
381 ((local_prompt_prefix == 0) ? ((newlines == 0) ? prompt_invis_chars_first_line
382 : ((newlines == 1) ? wrap_offset : 0))
383 : ((newlines == 0) ? wrap_offset :0));
384
385 inv_lbreaks[++newlines] = temp;
386+#if defined (HANDLE_MULTIBYTE)
387+ lpos -= _rl_col_width (local_prompt, n0, num);
388+#else
389 lpos -= _rl_screenwidth;
390+#endif
391 }
392
393 prompt_last_screen_line = newlines;
394diff -Naur bash-3.0.orig/lib/readline/mbutil.c bash-3.0/lib/readline/mbutil.c
395--- bash-3.0.orig/lib/readline/mbutil.c 2004-01-14 14:44:52.000000000 +0000
396+++ bash-3.0/lib/readline/mbutil.c 2004-09-29 16:37:57.838210592 +0000
397@@ -126,11 +126,11 @@
398 if (find_non_zero)
399 {
400 tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
401- while (wcwidth (wc) == 0)
402+ while (tmp > 0 && wcwidth (wc) == 0)
403 {
404 point += tmp;
405 tmp = mbrtowc (&wc, string + point, strlen (string + point), &ps);
406- if (tmp == (size_t)(0) || tmp == (size_t)(-1) || tmp == (size_t)(-2))
407+ if (MB_NULLWCH (tmp) || MB_INVALIDCH (tmp))
408 break;
409 }
410 }
411diff -Naur bash-3.0.orig/lib/readline/misc.c bash-3.0/lib/readline/misc.c
412--- bash-3.0.orig/lib/readline/misc.c 2004-07-07 12:56:32.000000000 +0000
413+++ bash-3.0/lib/readline/misc.c 2004-09-29 16:37:46.397949776 +0000
414@@ -276,12 +276,6 @@
415 _rl_saved_line_for_history->line = savestring (rl_line_buffer);
416 _rl_saved_line_for_history->data = (char *)rl_undo_list;
417 }
418- else if (STREQ (rl_line_buffer, _rl_saved_line_for_history->line) == 0)
419- {
420- free (_rl_saved_line_for_history->line);
421- _rl_saved_line_for_history->line = savestring (rl_line_buffer);
422- _rl_saved_line_for_history->data = (char *)rl_undo_list; /* XXX possible memleak */
423- }
424
425 return 0;
426 }
427diff -Naur bash-3.0.orig/lib/readline/vi_mode.c bash-3.0/lib/readline/vi_mode.c
428--- bash-3.0.orig/lib/readline/vi_mode.c 2004-07-13 18:08:27.000000000 +0000
429+++ bash-3.0/lib/readline/vi_mode.c 2004-09-29 16:37:54.073782872 +0000
430@@ -272,10 +272,12 @@
431 switch (key)
432 {
433 case '?':
434+ _rl_free_saved_history_line ();
435 rl_noninc_forward_search (count, key);
436 break;
437
438 case '/':
439+ _rl_free_saved_history_line ();
440 rl_noninc_reverse_search (count, key);
441 break;
442
443@@ -690,7 +692,7 @@
444 {
445 wchar_t wc;
446 char mb[MB_LEN_MAX+1];
447- int mblen;
448+ int mblen, p;
449 mbstate_t ps;
450
451 memset (&ps, 0, sizeof (mbstate_t));
452@@ -713,11 +715,14 @@
453 /* Vi is kind of strange here. */
454 if (wc)
455 {
456+ p = rl_point;
457 mblen = wcrtomb (mb, wc, &ps);
458 if (mblen >= 0)
459 mb[mblen] = '\0';
460 rl_begin_undo_group ();
461- rl_delete (1, 0);
462+ rl_vi_delete (1, 0);
463+ if (rl_point < p) /* Did we retreat at EOL? */
464+ rl_point++; /* XXX - should we advance more than 1 for mbchar? */
465 rl_insert_text (mb);
466 rl_end_undo_group ();
467 rl_vi_check ();
468@@ -1310,12 +1315,16 @@
469 rl_vi_delete (1, c);
470 #if defined (HANDLE_MULTIBYTE)
471 if (MB_CUR_MAX > 1 && rl_byte_oriented == 0)
472- while (_rl_insert_char (1, c))
473- {
474- RL_SETSTATE (RL_STATE_MOREINPUT);
475- c = rl_read_key ();
476- RL_UNSETSTATE (RL_STATE_MOREINPUT);
477- }
478+ {
479+ if (rl_point < p) /* Did we retreat at EOL? */
480+ rl_point++;
481+ while (_rl_insert_char (1, c))
482+ {
483+ RL_SETSTATE (RL_STATE_MOREINPUT);
484+ c = rl_read_key ();
485+ RL_UNSETSTATE (RL_STATE_MOREINPUT);
486+ }
487+ }
488 else
489 #endif
490 {
491diff -Naur bash-3.0.orig/patchlevel.h bash-3.0/patchlevel.h
492--- bash-3.0.orig/patchlevel.h 2001-08-22 12:05:39.000000000 +0000
493+++ bash-3.0/patchlevel.h 2004-09-29 16:38:00.855751856 +0000
494@@ -25,6 +25,6 @@
495 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
496 looks for to find the patch level (for the sccs version string). */
497
498-#define PATCHLEVEL 0
499+#define PATCHLEVEL 13
500
501 #endif /* _PATCHLEVEL_H_ */
502diff -Naur bash-3.0.orig/pcomplete.c bash-3.0/pcomplete.c
503--- bash-3.0.orig/pcomplete.c 2004-01-08 15:36:17.000000000 +0000
504+++ bash-3.0/pcomplete.c 2004-09-29 16:37:42.019615384 +0000
505@@ -863,6 +863,8 @@
506 if (array_p (v) == 0)
507 v = convert_var_to_array (v);
508 v = assign_array_var_from_word_list (v, lwords);
509+
510+ VUNSETATTR (v, att_invisible);
511 return v;
512 }
513 #endif /* ARRAY_VARS */
514@@ -1022,6 +1024,8 @@
515 if (array_p (v) == 0)
516 v = convert_var_to_array (v);
517
518+ VUNSETATTR (v, att_invisible);
519+
520 a = array_cell (v);
521 if (a == 0 || array_empty (a))
522 sl = (STRINGLIST *)NULL;
523diff -Naur bash-3.0.orig/subst.c bash-3.0/subst.c
524--- bash-3.0.orig/subst.c 2004-07-04 17:56:13.000000000 +0000
525+++ bash-3.0/subst.c 2004-09-29 16:37:51.904112712 +0000
526@@ -4691,6 +4691,26 @@
527 legal_identifier (name + 1)); /* ${#PS1} */
528 }
529
530+#if defined (HANDLE_MULTIBYTE)
531+size_t
532+mbstrlen (s)
533+ const char *s;
534+{
535+ size_t clen, nc;
536+ mbstate_t mbs;
537+
538+ nc = 0;
539+ memset (&mbs, 0, sizeof (mbs));
540+ while ((clen = mbrlen(s, MB_CUR_MAX, &mbs)) != 0 && (MB_INVALIDCH(clen) == 0))
541+ {
542+ s += clen;
543+ nc++;
544+ }
545+ return nc;
546+}
547+#endif
548+
549+
550 /* Handle the parameter brace expansion that requires us to return the
551 length of a parameter. */
552 static intmax_t
553@@ -4746,14 +4766,14 @@
554 if (legal_number (name + 1, &arg_index)) /* ${#1} */
555 {
556 t = get_dollar_var_value (arg_index);
557- number = STRLEN (t);
558+ number = MB_STRLEN (t);
559 FREE (t);
560 }
561 #if defined (ARRAY_VARS)
562- else if ((var = find_variable (name + 1)) && array_p (var))
563+ else if ((var = find_variable (name + 1)) && (invisible_p (var) == 0) && array_p (var))
564 {
565 t = array_reference (array_cell (var), 0);
566- number = STRLEN (t);
567+ number = MB_STRLEN (t);
568 }
569 #endif
570 else /* ${#PS1} */
571@@ -4766,7 +4786,7 @@
572 if (list)
573 dispose_words (list);
574
575- number = STRLEN (t);
576+ number = MB_STRLEN (t);
577 FREE (t);
578 }
579 }
580@@ -4871,7 +4891,7 @@
581 {
582 case VT_VARIABLE:
583 case VT_ARRAYMEMBER:
584- len = strlen (value);
585+ len = MB_STRLEN (value);
586 break;
587 case VT_POSPARMS:
588 len = number_of_args () + 1;
589@@ -4891,7 +4911,7 @@
590 if (*e1p < 0) /* negative offsets count from end */
591 *e1p += len;
592
593- if (*e1p >= len || *e1p < 0)
594+ if (*e1p > len || *e1p < 0)
595 return (-1);
596
597 #if defined (ARRAY_VARS)
598@@ -4982,7 +5002,7 @@
599 else
600 return -1;
601 }
602- else if ((v = find_variable (varname)) && array_p (v))
603+ else if ((v = find_variable (varname)) && (invisible_p (v) == 0) && array_p (v))
604 {
605 vtype = VT_ARRAYMEMBER;
606 *varp = v;
607diff -Naur bash-3.0.orig/tests/dbg-support.tests bash-3.0/tests/dbg-support.tests
608--- bash-3.0.orig/tests/dbg-support.tests 2003-03-25 20:33:03.000000000 +0000
609+++ bash-3.0/tests/dbg-support.tests 2004-09-29 16:37:42.030613712 +0000
610@@ -62,8 +62,8 @@
611 trap 'print_debug_trap $LINENO' DEBUG
612 trap 'print_return_trap $LINENO' RETURN
613
614-# Funcname is now an array. Vanilla Bash 2.05 doesn't have FUNCNAME array.
615-echo "FUNCNAME" ${FUNCNAME[0]}
616+# Funcname is now an array, but you still can't see it outside a function
617+echo "FUNCNAME" ${FUNCNAME[0]:-main}
618
619 # We should trace into the below.
620 # Start easy with a simple function.
621diff -Naur bash-3.0.orig/tests/errors.right bash-3.0/tests/errors.right
622--- bash-3.0.orig/tests/errors.right 2004-05-28 02:26:03.000000000 +0000
623+++ bash-3.0/tests/errors.right 2004-09-29 16:37:44.528234016 +0000
624@@ -85,7 +85,7 @@
625 ./errors.tests: line 213: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0")
626 ./errors.tests: line 216: trap: NOSIG: invalid signal specification
627 ./errors.tests: line 219: trap: -s: invalid option
628-trap: usage: trap [-lp] [[arg] signal_spec ...]
629+trap: usage: trap [-lp] [arg signal_spec ...]
630 ./errors.tests: line 225: return: can only `return' from a function or sourced script
631 ./errors.tests: line 229: break: 0: loop count out of range
632 ./errors.tests: line 233: continue: 0: loop count out of range
633diff -Naur bash-3.0.orig/variables.c bash-3.0/variables.c
634--- bash-3.0.orig/variables.c 2004-07-04 17:57:26.000000000 +0000
635+++ bash-3.0/variables.c 2004-09-29 16:37:42.009616904 +0000
636@@ -1419,11 +1419,11 @@
637 v = init_dynamic_array_var ("GROUPS", get_groupset, null_array_assign, att_noassign);
638
639 # if defined (DEBUGGER)
640- v = init_dynamic_array_var ("BASH_ARGC", get_self, null_array_assign, (att_invisible|att_noassign));
641- v = init_dynamic_array_var ("BASH_ARGV", get_self, null_array_assign, (att_invisible|att_noassign));
642+ v = init_dynamic_array_var ("BASH_ARGC", get_self, null_array_assign, att_noassign);
643+ v = init_dynamic_array_var ("BASH_ARGV", get_self, null_array_assign, att_noassign);
644 # endif /* DEBUGGER */
645- v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, (att_invisible|att_noassign));
646- v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, (att_invisible|att_noassign));
647+ v = init_dynamic_array_var ("BASH_SOURCE", get_self, null_array_assign, att_noassign);
648+ v = init_dynamic_array_var ("BASH_LINENO", get_self, null_array_assign, att_noassign);
649 #endif
650
651 v = init_funcname_var ();
652@@ -1599,7 +1599,10 @@
653 /* local foo; local foo; is a no-op. */
654 old_var = find_variable (name);
655 if (old_var && local_p (old_var) && old_var->context == variable_context)
656- return (old_var);
657+ {
658+ VUNSETATTR (old_var, att_invisible);
659+ return (old_var);
660+ }
661
662 was_tmpvar = old_var && tempvar_p (old_var);
663 if (was_tmpvar)
Note: See TracBrowser for help on using the repository browser.