source: patches/bash-3.1-fixes-8.patch@ cde1bf0

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

Updated to Bash -8 patch

  • Property mode set to 100644
File size: 23.0 KB
RevLine 
[cf468ea]1Submitted By: Jeremy Huntwork (jhuntwork at linuxfromscratch dot org)
2Date: 2006-04-11
[69cde8d]3Initial Package Version: 3.1
4Origin: http://ftp.gnu.org/gnu/bash/bash-3.1-patches/
[cf468ea]5Upstream Status: From Upstream
[3614cf6]6Description: Contains patches 001-017 from upstream
[69cde8d]7
[3614cf6]8diff -Naur bash-3.1.orig/arrayfunc.c bash-3.1/arrayfunc.c
9--- bash-3.1.orig/arrayfunc.c 2005-07-04 17:25:58.000000000 -0700
10+++ bash-3.1/arrayfunc.c 2006-04-19 15:59:29.000000000 -0700
11@@ -592,11 +592,7 @@
12 exp = (char *)xmalloc (len);
13 strncpy (exp, s, len - 1);
14 exp[len - 1] = '\0';
15-#if 0
16- t = expand_string_to_string (exp, 0);
17-#else
18- t = expand_string_to_string (exp, Q_DOUBLE_QUOTES);
19-#endif
20+ t = expand_arith_string (exp, 0);
21 this_command_name = (char *)NULL;
22 val = evalexp (t, &expok);
23 free (t);
[69cde8d]24diff -Naur bash-3.1.orig/doc/bash.1 bash-3.1/doc/bash.1
[3614cf6]25--- bash-3.1.orig/doc/bash.1 2005-10-12 08:40:52.000000000 -0700
26+++ bash-3.1/doc/bash.1 2006-04-19 15:58:34.000000000 -0700
[69cde8d]27@@ -6,12 +6,12 @@
28 .\" Case Western Reserve University
29 .\" chet@po.cwru.edu
30 .\"
31-.\" Last Change: Sat Aug 27 13:28:44 EDT 2005
32+.\" Last Change: Wed Dec 28 19:58:45 EST 2005
33 .\"
34 .\" bash_builtins, strip all but Built-Ins section
35 .if \n(zZ=1 .ig zZ
36 .if \n(zY=1 .ig zY
37-.TH BASH 1 "2005 Aug 27" "GNU Bash-3.1-beta1"
38+.TH BASH 1 "2005 Dec 28" "GNU Bash-3.1"
39 .\"
40 .\" There's some problem with having a `@'
41 .\" in a tagged paragraph with the BSD man macros.
42@@ -677,8 +677,8 @@
43 .B nocasematch
44 is enabled, the match is performed without regard to the case
45 of alphabetic characters.
46-The return value is 0 if the string matches or does not match
47-the pattern, respectively, and 1 otherwise.
48+The return value is 0 if the string matches (\fB==\fP) or does not match
49+(\fB!=\fP) the pattern, and 1 otherwise.
50 Any part of the pattern may be quoted to force it to be matched as a
51 string.
52 .if t .sp 0.5
53@@ -807,6 +807,12 @@
54 as for pathname expansion (see
55 .B Pathname Expansion
56 below).
57+The \fIword\fP is expanded using tilde
58+expansion, parameter and variable expansion, arithmetic substituion,
59+command substitution, process substitution and quote removal.
60+Each \fIpattern\fP examined is expanded using tilde
61+expansion, parameter and variable expansion, arithmetic substituion,
62+command substitution, and process substitution.
63 If the shell option
64 .B nocasematch
65 is enabled, the match is performed without regard to the case
66@@ -8484,7 +8490,7 @@
67 returns true if any of the arguments are found, false if
68 none are found.
69 .TP
70-\fBulimit\fP [\fB\-SHacdflmnpstuv\fP [\fIlimit\fP]]
71+\fBulimit\fP [\fB\-SHacdfilmnpqstuvx\fP [\fIlimit\fP]]
72 Provides control over the resources available to the shell and to
73 processes started by it, on systems that allow such control.
74 The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
75@@ -8523,6 +8529,9 @@
76 .B \-f
77 The maximum size of files created by the shell
78 .TP
79+.B \-i
80+The maximum number of pending signals
81+.TP
82 .B \-l
83 The maximum size that may be locked into memory
84 .TP
85@@ -8536,6 +8545,9 @@
86 .B \-p
87 The pipe size in 512-byte blocks (this may not be set)
88 .TP
89+.B \-q
90+The maximum number of bytes in POSIX message queues
91+.TP
92 .B \-s
93 The maximum stack size
94 .TP
95@@ -8547,6 +8559,9 @@
96 .TP
97 .B \-v
98 The maximum amount of virtual memory available to the shell
99+.TP
100+.B \-x
101+The maximum number of file locks
102 .PD
103 .PP
104 If
105diff -Naur bash-3.1.orig/doc/bashref.texi bash-3.1/doc/bashref.texi
[3614cf6]106--- bash-3.1.orig/doc/bashref.texi 2005-10-03 12:07:21.000000000 -0700
107+++ bash-3.1/doc/bashref.texi 2006-04-19 15:58:34.000000000 -0700
[69cde8d]108@@ -961,8 +961,8 @@
109 (see the description of @code{shopt} in @ref{Bash Builtins})
110 is enabled, the match is performed without regard to the case
111 of alphabetic characters.
112-The return value is 0 if the string matches or does not match
113-the pattern, respectively, and 1 otherwise.
114+The return value is 0 if the string matches (@samp{==}) or does not
115+match (@samp{!=})the pattern, and 1 otherwise.
116 Any part of the pattern may be quoted to force it to be matched as a
117 string.
118
119@@ -2598,7 +2598,7 @@
120 Builtin commands are necessary to implement functionality impossible
121 or inconvenient to obtain with separate utilities.
122
123-This section briefly the builtins which Bash inherits from
124+This section briefly describes the builtins which Bash inherits from
125 the Bourne Shell, as well as the builtin commands which are unique
126 to or have been extended in Bash.
127
128@@ -3833,7 +3833,7 @@
129 @item ulimit
130 @btindex ulimit
131 @example
132-ulimit [-acdflmnpstuvSH] [@var{limit}]
133+ulimit [-acdfilmnpqstuvxSH] [@var{limit}]
134 @end example
135 @code{ulimit} provides control over the resources available to processes
136 started by the shell, on systems that allow such control. If an
137@@ -3857,6 +3857,9 @@
138 @item -f
139 The maximum size of files created by the shell.
140
141+@item -i
142+The maximum number of pending signals.
143+
144 @item -l
145 The maximum size that may be locked into memory.
146
147@@ -3869,6 +3872,9 @@
148 @item -p
149 The pipe buffer size.
150
151+@item -q
152+The maximum number of bytes in POSIX message queues.
153+
154 @item -s
155 The maximum stack size.
156
157@@ -3881,6 +3887,9 @@
158 @item -v
159 The maximum amount of virtual memory available to the process.
160
161+@item -x
162+The maximum number of file locks.
163+
164 @end table
165
166 If @var{limit} is given, it is the new value of the specified resource;
167@@ -4089,8 +4098,8 @@
168 Print shell input lines as they are read.
169
170 @item -x
171-Print a trace of simple commands, \fBfor\fP commands, \fBcase\fP
172-commands, \fBselect\fP commands, and arithmetic \fBfor\fP commands
173+Print a trace of simple commands, @code{for} commands, @code{case}
174+commands, @code{select} commands, and arithmetic @code{for} commands
175 and their arguments or associated word lists after they are
176 expanded and before they are executed. The value of the @env{PS4}
177 variable is expanded and the resultant value is printed before
178diff -Naur bash-3.1.orig/doc/version.texi bash-3.1/doc/version.texi
[3614cf6]179--- bash-3.1.orig/doc/version.texi 2005-09-20 11:52:56.000000000 -0700
180+++ bash-3.1/doc/version.texi 2006-04-19 15:58:34.000000000 -0700
[69cde8d]181@@ -2,9 +2,9 @@
182 Copyright (C) 1988-2005 Free Software Foundation, Inc.
183 @end ignore
184
185-@set LASTCHANGE Mon Sep 5 11:47:04 EDT 2005
186+@set LASTCHANGE Fri Dec 30 10:50:51 EST 2005
187
188-@set EDITION 3.1-beta1
189-@set VERSION 3.1-beta1
190-@set UPDATED 5 September 2005
191-@set UPDATED-MONTH September 2005
192+@set EDITION 3.1
193+@set VERSION 3.1
194+@set UPDATED 30 December 2005
195+@set UPDATED-MONTH December 2005
196diff -Naur bash-3.1.orig/jobs.c bash-3.1/jobs.c
[3614cf6]197--- bash-3.1.orig/jobs.c 2005-11-11 20:13:27.000000000 -0800
198+++ bash-3.1/jobs.c 2006-04-19 15:58:34.000000000 -0700
[69cde8d]199@@ -619,8 +619,11 @@
200 * once in the parent and once in each child. This is where
201 * the parent gives it away.
202 *
203+ * Don't give the terminal away if this shell is an asynchronous
204+ * subshell.
205+ *
206 */
207- if (job_control && newjob->pgrp)
208+ if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0)
209 give_terminal_to (newjob->pgrp, 0);
210 }
211 }
212@@ -844,9 +847,10 @@
213 realloc_jobs_list ()
214 {
215 sigset_t set, oset;
216- int nsize, i, j;
217+ int nsize, i, j, ncur, nprev;
218 JOB **nlist;
219
220+ ncur = nprev = NO_JOB;
221 nsize = ((js.j_njobs + JOB_SLOTS - 1) / JOB_SLOTS);
222 nsize *= JOB_SLOTS;
223 i = js.j_njobs % JOB_SLOTS;
224@@ -854,17 +858,51 @@
225 nsize += JOB_SLOTS;
226
227 BLOCK_CHILD (set, oset);
228- nlist = (JOB **) xmalloc (nsize * sizeof (JOB *));
229+ nlist = (js.j_jobslots == nsize) ? jobs : (JOB **) xmalloc (nsize * sizeof (JOB *));
230+
231 for (i = j = 0; i < js.j_jobslots; i++)
232 if (jobs[i])
233- nlist[j++] = jobs[i];
234+ {
235+ if (i == js.j_current)
236+ ncur = j;
237+ if (i == js.j_previous)
238+ nprev = j;
239+ nlist[j++] = jobs[i];
240+ }
241+
242+#if defined (DEBUG)
243+ itrace ("realloc_jobs_list: resize jobs list from %d to %d", js.j_jobslots, nsize);
244+ itrace ("realloc_jobs_list: j_lastj changed from %d to %d", js.j_lastj, (j > 0) ? j - 1 : 0);
245+ itrace ("realloc_jobs_list: j_njobs changed from %d to %d", js.j_njobs, (j > 0) ? j - 1 : 0);
246+#endif
247
248 js.j_firstj = 0;
249- js.j_lastj = (j > 0) ? j - 1: 0;
250+ js.j_lastj = (j > 0) ? j - 1 : 0;
251+ js.j_njobs = j;
252 js.j_jobslots = nsize;
253
254- free (jobs);
255- jobs = nlist;
256+ /* Zero out remaining slots in new jobs list */
257+ for ( ; j < nsize; j++)
258+ nlist[j] = (JOB *)NULL;
259+
260+ if (jobs != nlist)
261+ {
262+ free (jobs);
263+ jobs = nlist;
264+ }
265+
266+ if (ncur != NO_JOB)
267+ js.j_current = ncur;
268+ if (nprev != NO_JOB)
269+ js.j_previous = nprev;
270+
271+ /* Need to reset these */
272+ if (js.j_current == NO_JOB || js.j_previous == NO_JOB || js.j_current > js.j_lastj || js.j_previous > js.j_lastj)
273+ reset_current ();
274+
275+#ifdef DEBUG
276+ itrace ("realloc_jobs_list: reset js.j_current (%d) and js.j_previous (%d)", js.j_current, js.j_previous);
277+#endif
278
279 UNBLOCK_CHILD (oset);
280 }
281@@ -1655,7 +1693,7 @@
282 In this case, we don't want to give the terminal to the
283 shell's process group (we could be in the middle of a
284 pipeline, for example). */
285- if (async_p == 0 && pipeline_pgrp != shell_pgrp)
286+ if (async_p == 0 && pipeline_pgrp != shell_pgrp && ((subshell_environment&SUBSHELL_ASYNC) == 0))
287 give_terminal_to (pipeline_pgrp, 0);
288
289 #if defined (PGRP_PIPE)
290@@ -2198,7 +2236,11 @@
291 /* This is possibly a race condition -- should it go in stop_pipeline? */
292 wait_sigint_received = 0;
293 if (job_control == 0)
294- old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
295+ {
296+ old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
297+ if (old_sigint_handler == SIG_IGN)
298+ set_signal_handler (SIGINT, old_sigint_handler);
299+ }
300
301 termination_state = last_command_exit_value;
302
[cf468ea]303diff -Naur bash-3.1.orig/lib/glob/glob.c bash-3.1/lib/glob/glob.c
[3614cf6]304--- bash-3.1.orig/lib/glob/glob.c 2005-03-24 09:42:27.000000000 -0800
305+++ bash-3.1/lib/glob/glob.c 2006-04-19 15:58:34.000000000 -0700
[cf468ea]306@@ -360,6 +360,7 @@
307 count = lose = skip = 0;
308
309 firstmalloc = 0;
310+ nalloca = 0;
311
312 /* If PAT is empty, skip the loop, but return one (empty) filename. */
313 if (pat == 0 || *pat == '\0')
314@@ -546,6 +547,8 @@
315 firstmalloc = 0;
316 tmplink = lastlink;
317 }
318+ else
319+ tmplink = 0;
320 free (lastlink->name);
321 lastlink = lastlink->next;
322 FREE (tmplink);
323diff -Naur bash-3.1.orig/lib/glob/sm_loop.c bash-3.1/lib/glob/sm_loop.c
[3614cf6]324--- bash-3.1.orig/lib/glob/sm_loop.c 2005-10-16 18:21:04.000000000 -0700
325+++ bash-3.1/lib/glob/sm_loop.c 2006-04-19 15:58:34.000000000 -0700
[cf468ea]326@@ -638,12 +638,13 @@
327 CHAR *psub; /* pointer to sub-pattern */
328 CHAR *pnext; /* pointer to next sub-pattern */
329 CHAR *srest; /* pointer to rest of string */
330- int m1, m2;
331+ int m1, m2, xflags; /* xflags = flags passed to recursive matches */
332
333 #if DEBUG_MATCHING
334 fprintf(stderr, "extmatch: xc = %c\n", xc);
335 fprintf(stderr, "extmatch: s = %s; se = %s\n", s, se);
336 fprintf(stderr, "extmatch: p = %s; pe = %s\n", p, pe);
337+fprintf(stderr, "extmatch: flags = %d\n", flags);
338 #endif
339
340 prest = PATSCAN (p + (*p == L('(')), pe, 0); /* ) */
341@@ -677,8 +678,12 @@
342 string matches the rest of the pattern. Also handle
343 multiple matches of the pattern. */
344 if (m1)
345- m2 = (GMATCH (srest, se, prest, pe, flags) == 0) ||
346- (s != srest && GMATCH (srest, se, p - 1, pe, flags) == 0);
347+ {
348+ /* if srest > s, we are not at start of string */
349+ xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
350+ m2 = (GMATCH (srest, se, prest, pe, xflags) == 0) ||
351+ (s != srest && GMATCH (srest, se, p - 1, pe, xflags) == 0);
352+ }
353 if (m1 && m2)
354 return (0);
355 }
356@@ -704,8 +709,10 @@
357 srest = (prest == pe) ? se : s;
358 for ( ; srest <= se; srest++)
359 {
360+ /* if srest > s, we are not at start of string */
361+ xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
362 if (GMATCH (s, srest, psub, pnext - 1, flags) == 0 &&
363- GMATCH (srest, se, prest, pe, flags) == 0)
364+ GMATCH (srest, se, prest, pe, xflags) == 0)
365 return (0);
366 }
367 if (pnext == prest)
368@@ -726,7 +733,9 @@
369 if (pnext == prest)
370 break;
371 }
372- if (m1 == 0 && GMATCH (srest, se, prest, pe, flags) == 0)
373+ /* if srest > s, we are not at start of string */
374+ xflags = (srest > s) ? (flags & ~FNM_PERIOD) : flags;
375+ if (m1 == 0 && GMATCH (srest, se, prest, pe, xflags) == 0)
376 return (0);
377 }
378 return (FNM_NOMATCH);
[69cde8d]379diff -Naur bash-3.1.orig/lib/readline/display.c bash-3.1/lib/readline/display.c
[3614cf6]380--- bash-3.1.orig/lib/readline/display.c 2005-11-30 11:05:02.000000000 -0800
381+++ bash-3.1/lib/readline/display.c 2006-04-19 15:58:34.000000000 -0700
[69cde8d]382@@ -1983,11 +1983,15 @@
383 int pchar;
384 {
385 int len;
386- char *pmt;
387+ char *pmt, *p;
388
389 rl_save_prompt ();
390
391- if (saved_local_prompt == 0)
392+ /* We've saved the prompt, and can do anything with the various prompt
393+ strings we need before they're restored. We want the unexpanded
394+ portion of the prompt string after any final newline. */
395+ p = rl_prompt ? strrchr (rl_prompt, '\n') : 0;
396+ if (p == 0)
397 {
398 len = (rl_prompt && *rl_prompt) ? strlen (rl_prompt) : 0;
399 pmt = (char *)xmalloc (len + 2);
400@@ -1998,19 +2002,17 @@
401 }
402 else
403 {
404- len = *saved_local_prompt ? strlen (saved_local_prompt) : 0;
405+ p++;
406+ len = strlen (p);
407 pmt = (char *)xmalloc (len + 2);
408 if (len)
409- strcpy (pmt, saved_local_prompt);
410+ strcpy (pmt, p);
411 pmt[len] = pchar;
412 pmt[len+1] = '\0';
413- local_prompt = savestring (pmt);
414- prompt_last_invisible = saved_last_invisible;
415- prompt_visible_length = saved_visible_length + 1;
416- }
417+ }
418
419+ /* will be overwritten by expand_prompt, called from rl_message */
420 prompt_physical_chars = saved_physical_chars + 1;
421-
422 return pmt;
423 }
424
425diff -Naur bash-3.1.orig/lib/readline/readline.c bash-3.1/lib/readline/readline.c
[3614cf6]426--- bash-3.1.orig/lib/readline/readline.c 2005-07-04 19:29:35.000000000 -0700
427+++ bash-3.1/lib/readline/readline.c 2006-04-19 15:58:34.000000000 -0700
[69cde8d]428@@ -282,6 +282,7 @@
429 {
430 FREE (rl_prompt);
431 rl_prompt = prompt ? savestring (prompt) : (char *)NULL;
432+ rl_display_prompt = rl_prompt ? rl_prompt : "";
433
434 rl_visible_prompt_length = rl_expand_prompt (rl_prompt);
435 return 0;
436diff -Naur bash-3.1.orig/lib/readline/terminal.c bash-3.1/lib/readline/terminal.c
[3614cf6]437--- bash-3.1.orig/lib/readline/terminal.c 2005-11-12 17:46:54.000000000 -0800
438+++ bash-3.1/lib/readline/terminal.c 2006-04-19 15:58:34.000000000 -0700
[69cde8d]439@@ -122,7 +122,7 @@
440 static char *_rl_visible_bell;
441
442 /* Non-zero means the terminal can auto-wrap lines. */
443-int _rl_term_autowrap;
444+int _rl_term_autowrap = -1;
445
446 /* Non-zero means that this terminal has a meta key. */
447 static int term_has_meta;
448@@ -274,6 +274,9 @@
449 _rl_set_screen_size (rows, cols)
450 int rows, cols;
451 {
452+ if (_rl_term_autowrap == -1)
453+ _rl_init_terminal_io (rl_terminal_name);
454+
455 if (rows > 0)
456 _rl_screenheight = rows;
457 if (cols > 0)
458diff -Naur bash-3.1.orig/parse.y bash-3.1/parse.y
[3614cf6]459--- bash-3.1.orig/parse.y 2005-11-11 20:14:18.000000000 -0800
460+++ bash-3.1/parse.y 2006-04-19 15:58:34.000000000 -0700
[69cde8d]461@@ -2716,6 +2716,7 @@
462 #define P_ALLOWESC 0x02
463 #define P_DQUOTE 0x04
464 #define P_COMMAND 0x08 /* parsing a command, so look for comments */
465+#define P_BACKQUOTE 0x10 /* parsing a backquoted command substitution */
466
467 static char matched_pair_error;
468 static char *
469@@ -2725,12 +2726,12 @@
470 int *lenp, flags;
471 {
472 int count, ch, was_dollar, in_comment, check_comment;
473- int pass_next_character, nestlen, ttranslen, start_lineno;
474+ int pass_next_character, backq_backslash, nestlen, ttranslen, start_lineno;
475 char *ret, *nestret, *ttrans;
476 int retind, retsize, rflags;
477
478 count = 1;
479- pass_next_character = was_dollar = in_comment = 0;
480+ pass_next_character = backq_backslash = was_dollar = in_comment = 0;
481 check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
482
483 /* RFLAGS is the set of flags we want to pass to recursive calls. */
484@@ -2742,11 +2743,8 @@
485 start_lineno = line_number;
486 while (count)
487 {
488-#if 0
489- ch = shell_getc ((qc != '\'' || (flags & P_ALLOWESC)) && pass_next_character == 0);
490-#else
491- ch = shell_getc (qc != '\'' && pass_next_character == 0);
492-#endif
493+ ch = shell_getc (qc != '\'' && pass_next_character == 0 && backq_backslash == 0);
494+
495 if (ch == EOF)
496 {
497 free (ret);
498@@ -2771,9 +2769,16 @@
499 continue;
500 }
501 /* Not exactly right yet */
502- else if (check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind -1])))
503+ else if MBTEST(check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind - 1])))
504 in_comment = 1;
505
506+ /* last char was backslash inside backquoted command substitution */
507+ if (backq_backslash)
508+ {
509+ backq_backslash = 0;
510+ /* Placeholder for adding special characters */
511+ }
512+
513 if (pass_next_character) /* last char was backslash */
514 {
515 pass_next_character = 0;
516@@ -2814,6 +2819,8 @@
517 {
518 if MBTEST((flags & P_ALLOWESC) && ch == '\\')
519 pass_next_character++;
520+ else if MBTEST((flags & P_BACKQUOTE) && ch == '\\')
521+ backq_backslash++;
522 continue;
523 }
524
525@@ -2898,7 +2905,11 @@
526 }
527 else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 0)
528 {
529- nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags);
530+ /* Add P_BACKQUOTE so backslash quotes the next character and
531+ shell_getc does the right thing with \<newline>. We do this for
532+ a measure of backwards compatibility -- it's not strictly the
533+ right POSIX thing. */
534+ nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags|P_BACKQUOTE);
535 goto add_nestret;
536 }
537 else if MBTEST(was_dollar && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
538@@ -2907,7 +2918,7 @@
539 if (open == ch) /* undo previous increment */
540 count--;
541 if (ch == '(') /* ) */
542- nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags);
543+ nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags & ~P_DQUOTE);
544 else if (ch == '{') /* } */
545 nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|rflags);
546 else if (ch == '[') /* ] */
547@@ -3578,7 +3589,7 @@
548 FREE (ttok);
549 all_digit_token = 0;
550 compound_assignment = 1;
551-#if 0
552+#if 1
553 goto next_character;
554 #else
555 goto got_token; /* ksh93 seems to do this */
556@@ -3695,7 +3706,9 @@
557 struct builtin *b;
558 b = builtin_address_internal (token, 0);
559 if (b && (b->flags & ASSIGNMENT_BUILTIN))
560- parser_state |= PST_ASSIGNOK;
561+ parser_state |= PST_ASSIGNOK;
562+ else if (STREQ (token, "eval") || STREQ (token, "let"))
563+ parser_state |= PST_ASSIGNOK;
564 }
565
566 yylval.word = the_word;
567@@ -4686,18 +4699,21 @@
568 int *retlenp;
569 {
570 WORD_LIST *wl, *rl;
571- int tok, orig_line_number, orig_token_size;
572+ int tok, orig_line_number, orig_token_size, orig_last_token, assignok;
573 char *saved_token, *ret;
574
575 saved_token = token;
576 orig_token_size = token_buffer_size;
577 orig_line_number = line_number;
578+ orig_last_token = last_read_token;
579
580 last_read_token = WORD; /* WORD to allow reserved words here */
581
582 token = (char *)NULL;
583 token_buffer_size = 0;
584
585+ assignok = parser_state&PST_ASSIGNOK; /* XXX */
586+
587 wl = (WORD_LIST *)NULL; /* ( */
588 parser_state |= PST_COMPASSIGN;
589
590@@ -4740,7 +4756,7 @@
591 jump_to_top_level (DISCARD);
592 }
593
594- last_read_token = WORD;
595+ last_read_token = orig_last_token; /* XXX - was WORD? */
596 if (wl)
597 {
598 rl = REVERSE_LIST (wl, WORD_LIST *);
599@@ -4752,6 +4768,10 @@
600
601 if (retlenp)
602 *retlenp = (ret && *ret) ? strlen (ret) : 0;
603+
604+ if (assignok)
605+ parser_state |= PST_ASSIGNOK;
606+
607 return ret;
608 }
609
610diff -Naur bash-3.1.orig/patchlevel.h bash-3.1/patchlevel.h
[3614cf6]611--- bash-3.1.orig/patchlevel.h 2005-07-20 10:58:20.000000000 -0700
612+++ bash-3.1/patchlevel.h 2006-04-19 15:59:29.000000000 -0700
[69cde8d]613@@ -25,6 +25,6 @@
614 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
615 looks for to find the patch level (for the sccs version string). */
616
617-#define PATCHLEVEL 0
[3614cf6]618+#define PATCHLEVEL 17
[69cde8d]619
620 #endif /* _PATCHLEVEL_H_ */
621diff -Naur bash-3.1.orig/subst.c bash-3.1/subst.c
[3614cf6]622--- bash-3.1.orig/subst.c 2005-10-24 06:51:13.000000000 -0700
623+++ bash-3.1/subst.c 2006-04-19 15:59:29.000000000 -0700
[69cde8d]624@@ -2187,7 +2187,7 @@
625 if (mklocal && variable_context)
626 {
627 v = find_variable (name);
628- if (v == 0 || array_p (v) == 0)
629+ if (v == 0 || array_p (v) == 0 || v->context != variable_context)
630 v = make_local_array_variable (name);
631 v = assign_array_var_from_string (v, value, flags);
632 }
[3614cf6]633@@ -2575,6 +2575,13 @@
634 return (expand_string_to_string_internal (string, quoted, expand_string_assignment));
635 }
636
637+char *
638+expand_arith_string (string, quoted)
639+ char *string;
640+{
641+ return (expand_string_if_necessary (string, quoted, expand_string));
642+}
643+
644 #if defined (COND_COMMAND)
645 /* Just remove backslashes in STRING. Returns a new string. */
646 char *
647@@ -5248,7 +5255,7 @@
648 else
649 t = (char *)0;
650
651- temp1 = expand_string_if_necessary (substr, Q_DOUBLE_QUOTES, expand_string);
652+ temp1 = expand_arith_string (substr, Q_DOUBLE_QUOTES);
653 *e1p = evalexp (temp1, &expok);
654 free (temp1);
655 if (expok == 0)
656@@ -5293,7 +5300,7 @@
657 {
658 t++;
659 temp2 = savestring (t);
660- temp1 = expand_string_if_necessary (temp2, Q_DOUBLE_QUOTES, expand_string);
661+ temp1 = expand_arith_string (temp2, Q_DOUBLE_QUOTES);
662 free (temp2);
663 t[-1] = ':';
664 *e2p = evalexp (temp1, &expok);
665@@ -6435,7 +6442,7 @@
666 temp2[t_index] = '\0';
667
668 /* Expand variables found inside the expression. */
669- temp1 = expand_string_if_necessary (temp2, Q_DOUBLE_QUOTES, expand_string);
670+ temp1 = expand_arith_string (temp2, Q_DOUBLE_QUOTES);
671 free (temp2);
672
673 arithsub:
674@@ -6477,7 +6484,7 @@
675 zindex = t_index;
676
677 /* Do initial variable expansion. */
678- temp1 = expand_string_if_necessary (temp, Q_DOUBLE_QUOTES, expand_string);
679+ temp1 = expand_arith_string (temp, Q_DOUBLE_QUOTES);
680
681 goto arithsub;
682
683@@ -6795,6 +6802,12 @@
[69cde8d]684 if (temp && *temp && t_index > 0)
685 {
686 temp1 = bash_tilde_expand (temp, tflag);
687+ if (temp1 && *temp1 == '~' && STREQ (temp, temp1))
688+ {
689+ FREE (temp);
690+ FREE (temp1);
691+ goto add_character; /* tilde expansion failed */
692+ }
693 free (temp);
694 temp = temp1;
695 sindex += t_index;
[3614cf6]696diff -Naur bash-3.1.orig/subst.h bash-3.1/subst.h
697--- bash-3.1.orig/subst.h 2004-11-07 12:12:28.000000000 -0800
698+++ bash-3.1/subst.h 2006-04-19 15:59:29.000000000 -0700
699@@ -151,6 +151,9 @@
700 extern char *expand_string_unsplit_to_string __P((char *, int));
701 extern char *expand_assignment_string_to_string __P((char *, int));
702
703+/* Expand an arithmetic expression string */
704+extern char *expand_arith_string __P((char *, int));
705+
706 /* De-quoted quoted characters in STRING. */
707 extern char *dequote_string __P((char *));
708
[69cde8d]709diff -Naur bash-3.1.orig/variables.c bash-3.1/variables.c
[3614cf6]710--- bash-3.1.orig/variables.c 2005-11-12 18:22:37.000000000 -0800
711+++ bash-3.1/variables.c 2006-04-19 15:58:34.000000000 -0700
[69cde8d]712@@ -860,9 +860,11 @@
713 {
714 char val[INT_STRLEN_BOUND(int) + 1], *v;
715
716+#if defined (READLINE)
717 /* If we are currently assigning to LINES or COLUMNS, don't do anything. */
718 if (winsize_assignment)
719 return;
720+#endif
721
722 v = inttostr (lines, val, sizeof (val));
723 bind_variable ("LINES", v, 0);
Note: See TracBrowser for help on using the repository browser.