source: scripts/patches/bash-3.1-fixes-5.patch@ c4008f7

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

r2504@server (orig r1243): ryan | 2006-03-10 02:06:31 -0800

r1293@rei: lfs | 2006-03-08 18:43:14 +1100
Add lfs bash-3.1-fixes patch


Submitted By: Archaic (archaic AT linuxfromscratch D0T org)
Date: 2006-02-27
Initial Package Version: 3.1
Upstream Status: From Upstream
Origin: http://ftp.gnu.org/gnu/bash/bash-3.1-patches/
Description: Contains patches 001-011 from upstream (including the fixed 010

patch)



  • Property mode set to 100644
File size: 16.0 KB
RevLine 
[de2a4b2]1Submitted By: Archaic (archaic AT linuxfromscratch D0T org)
2Date: 2006-02-27
3Initial Package Version: 3.1
4Upstream Status: From Upstream
5Origin: http://ftp.gnu.org/gnu/bash/bash-3.1-patches/
6Description: Contains patches 001-011 from upstream (including the fixed 010
7 patch)
8
9diff -Naur bash-3.1.orig/doc/bash.1 bash-3.1/doc/bash.1
10--- bash-3.1.orig/doc/bash.1 2005-10-12 15:40:52.000000000 +0000
11+++ bash-3.1/doc/bash.1 2006-02-28 03:35:06.000000000 +0000
12@@ -6,12 +6,12 @@
13 .\" Case Western Reserve University
14 .\" chet@po.cwru.edu
15 .\"
16-.\" Last Change: Sat Aug 27 13:28:44 EDT 2005
17+.\" Last Change: Wed Dec 28 19:58:45 EST 2005
18 .\"
19 .\" bash_builtins, strip all but Built-Ins section
20 .if \n(zZ=1 .ig zZ
21 .if \n(zY=1 .ig zY
22-.TH BASH 1 "2005 Aug 27" "GNU Bash-3.1-beta1"
23+.TH BASH 1 "2005 Dec 28" "GNU Bash-3.1"
24 .\"
25 .\" There's some problem with having a `@'
26 .\" in a tagged paragraph with the BSD man macros.
27@@ -677,8 +677,8 @@
28 .B nocasematch
29 is enabled, the match is performed without regard to the case
30 of alphabetic characters.
31-The return value is 0 if the string matches or does not match
32-the pattern, respectively, and 1 otherwise.
33+The return value is 0 if the string matches (\fB==\fP) or does not match
34+(\fB!=\fP) the pattern, and 1 otherwise.
35 Any part of the pattern may be quoted to force it to be matched as a
36 string.
37 .if t .sp 0.5
38@@ -807,6 +807,12 @@
39 as for pathname expansion (see
40 .B Pathname Expansion
41 below).
42+The \fIword\fP is expanded using tilde
43+expansion, parameter and variable expansion, arithmetic substituion,
44+command substitution, process substitution and quote removal.
45+Each \fIpattern\fP examined is expanded using tilde
46+expansion, parameter and variable expansion, arithmetic substituion,
47+command substitution, and process substitution.
48 If the shell option
49 .B nocasematch
50 is enabled, the match is performed without regard to the case
51@@ -8484,7 +8490,7 @@
52 returns true if any of the arguments are found, false if
53 none are found.
54 .TP
55-\fBulimit\fP [\fB\-SHacdflmnpstuv\fP [\fIlimit\fP]]
56+\fBulimit\fP [\fB\-SHacdfilmnpqstuvx\fP [\fIlimit\fP]]
57 Provides control over the resources available to the shell and to
58 processes started by it, on systems that allow such control.
59 The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
60@@ -8523,6 +8529,9 @@
61 .B \-f
62 The maximum size of files created by the shell
63 .TP
64+.B \-i
65+The maximum number of pending signals
66+.TP
67 .B \-l
68 The maximum size that may be locked into memory
69 .TP
70@@ -8536,6 +8545,9 @@
71 .B \-p
72 The pipe size in 512-byte blocks (this may not be set)
73 .TP
74+.B \-q
75+The maximum number of bytes in POSIX message queues
76+.TP
77 .B \-s
78 The maximum stack size
79 .TP
80@@ -8547,6 +8559,9 @@
81 .TP
82 .B \-v
83 The maximum amount of virtual memory available to the shell
84+.TP
85+.B \-x
86+The maximum number of file locks
87 .PD
88 .PP
89 If
90diff -Naur bash-3.1.orig/doc/bashref.texi bash-3.1/doc/bashref.texi
91--- bash-3.1.orig/doc/bashref.texi 2005-10-03 19:07:21.000000000 +0000
92+++ bash-3.1/doc/bashref.texi 2006-02-28 03:35:06.000000000 +0000
93@@ -961,8 +961,8 @@
94 (see the description of @code{shopt} in @ref{Bash Builtins})
95 is enabled, the match is performed without regard to the case
96 of alphabetic characters.
97-The return value is 0 if the string matches or does not match
98-the pattern, respectively, and 1 otherwise.
99+The return value is 0 if the string matches (@samp{==}) or does not
100+match (@samp{!=})the pattern, and 1 otherwise.
101 Any part of the pattern may be quoted to force it to be matched as a
102 string.
103
104@@ -2598,7 +2598,7 @@
105 Builtin commands are necessary to implement functionality impossible
106 or inconvenient to obtain with separate utilities.
107
108-This section briefly the builtins which Bash inherits from
109+This section briefly describes the builtins which Bash inherits from
110 the Bourne Shell, as well as the builtin commands which are unique
111 to or have been extended in Bash.
112
113@@ -3833,7 +3833,7 @@
114 @item ulimit
115 @btindex ulimit
116 @example
117-ulimit [-acdflmnpstuvSH] [@var{limit}]
118+ulimit [-acdfilmnpqstuvxSH] [@var{limit}]
119 @end example
120 @code{ulimit} provides control over the resources available to processes
121 started by the shell, on systems that allow such control. If an
122@@ -3857,6 +3857,9 @@
123 @item -f
124 The maximum size of files created by the shell.
125
126+@item -i
127+The maximum number of pending signals.
128+
129 @item -l
130 The maximum size that may be locked into memory.
131
132@@ -3869,6 +3872,9 @@
133 @item -p
134 The pipe buffer size.
135
136+@item -q
137+The maximum number of bytes in POSIX message queues.
138+
139 @item -s
140 The maximum stack size.
141
142@@ -3881,6 +3887,9 @@
143 @item -v
144 The maximum amount of virtual memory available to the process.
145
146+@item -x
147+The maximum number of file locks.
148+
149 @end table
150
151 If @var{limit} is given, it is the new value of the specified resource;
152@@ -4089,8 +4098,8 @@
153 Print shell input lines as they are read.
154
155 @item -x
156-Print a trace of simple commands, \fBfor\fP commands, \fBcase\fP
157-commands, \fBselect\fP commands, and arithmetic \fBfor\fP commands
158+Print a trace of simple commands, @code{for} commands, @code{case}
159+commands, @code{select} commands, and arithmetic @code{for} commands
160 and their arguments or associated word lists after they are
161 expanded and before they are executed. The value of the @env{PS4}
162 variable is expanded and the resultant value is printed before
163diff -Naur bash-3.1.orig/doc/version.texi bash-3.1/doc/version.texi
164--- bash-3.1.orig/doc/version.texi 2005-09-20 18:52:56.000000000 +0000
165+++ bash-3.1/doc/version.texi 2006-02-28 03:35:06.000000000 +0000
166@@ -2,9 +2,9 @@
167 Copyright (C) 1988-2005 Free Software Foundation, Inc.
168 @end ignore
169
170-@set LASTCHANGE Mon Sep 5 11:47:04 EDT 2005
171+@set LASTCHANGE Fri Dec 30 10:50:51 EST 2005
172
173-@set EDITION 3.1-beta1
174-@set VERSION 3.1-beta1
175-@set UPDATED 5 September 2005
176-@set UPDATED-MONTH September 2005
177+@set EDITION 3.1
178+@set VERSION 3.1
179+@set UPDATED 30 December 2005
180+@set UPDATED-MONTH December 2005
181diff -Naur bash-3.1.orig/jobs.c bash-3.1/jobs.c
182--- bash-3.1.orig/jobs.c 2005-11-12 04:13:27.000000000 +0000
183+++ bash-3.1/jobs.c 2006-02-28 03:35:30.000000000 +0000
184@@ -619,8 +619,11 @@
185 * once in the parent and once in each child. This is where
186 * the parent gives it away.
187 *
188+ * Don't give the terminal away if this shell is an asynchronous
189+ * subshell.
190+ *
191 */
192- if (job_control && newjob->pgrp)
193+ if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0)
194 give_terminal_to (newjob->pgrp, 0);
195 }
196 }
197@@ -844,9 +847,10 @@
198 realloc_jobs_list ()
199 {
200 sigset_t set, oset;
201- int nsize, i, j;
202+ int nsize, i, j, ncur, nprev;
203 JOB **nlist;
204
205+ ncur = nprev = NO_JOB;
206 nsize = ((js.j_njobs + JOB_SLOTS - 1) / JOB_SLOTS);
207 nsize *= JOB_SLOTS;
208 i = js.j_njobs % JOB_SLOTS;
209@@ -854,17 +858,51 @@
210 nsize += JOB_SLOTS;
211
212 BLOCK_CHILD (set, oset);
213- nlist = (JOB **) xmalloc (nsize * sizeof (JOB *));
214+ nlist = (js.j_jobslots == nsize) ? jobs : (JOB **) xmalloc (nsize * sizeof (JOB *));
215+
216 for (i = j = 0; i < js.j_jobslots; i++)
217 if (jobs[i])
218- nlist[j++] = jobs[i];
219+ {
220+ if (i == js.j_current)
221+ ncur = j;
222+ if (i == js.j_previous)
223+ nprev = j;
224+ nlist[j++] = jobs[i];
225+ }
226+
227+#if defined (DEBUG)
228+ itrace ("realloc_jobs_list: resize jobs list from %d to %d", js.j_jobslots, nsize);
229+ itrace ("realloc_jobs_list: j_lastj changed from %d to %d", js.j_lastj, (j > 0) ? j - 1 : 0);
230+ itrace ("realloc_jobs_list: j_njobs changed from %d to %d", js.j_njobs, (j > 0) ? j - 1 : 0);
231+#endif
232
233 js.j_firstj = 0;
234- js.j_lastj = (j > 0) ? j - 1: 0;
235+ js.j_lastj = (j > 0) ? j - 1 : 0;
236+ js.j_njobs = j;
237 js.j_jobslots = nsize;
238
239- free (jobs);
240- jobs = nlist;
241+ /* Zero out remaining slots in new jobs list */
242+ for ( ; j < nsize; j++)
243+ nlist[j] = (JOB *)NULL;
244+
245+ if (jobs != nlist)
246+ {
247+ free (jobs);
248+ jobs = nlist;
249+ }
250+
251+ if (ncur != NO_JOB)
252+ js.j_current = ncur;
253+ if (nprev != NO_JOB)
254+ js.j_previous = nprev;
255+
256+ /* Need to reset these */
257+ if (js.j_current == NO_JOB || js.j_previous == NO_JOB || js.j_current > js.j_lastj || js.j_previous > js.j_lastj)
258+ reset_current ();
259+
260+#ifdef DEBUG
261+ itrace ("realloc_jobs_list: reset js.j_current (%d) and js.j_previous (%d)", js.j_current, js.j_previous);
262+#endif
263
264 UNBLOCK_CHILD (oset);
265 }
266@@ -1655,7 +1693,7 @@
267 In this case, we don't want to give the terminal to the
268 shell's process group (we could be in the middle of a
269 pipeline, for example). */
270- if (async_p == 0 && pipeline_pgrp != shell_pgrp)
271+ if (async_p == 0 && pipeline_pgrp != shell_pgrp && ((subshell_environment&SUBSHELL_ASYNC) == 0))
272 give_terminal_to (pipeline_pgrp, 0);
273
274 #if defined (PGRP_PIPE)
275@@ -2198,7 +2236,11 @@
276 /* This is possibly a race condition -- should it go in stop_pipeline? */
277 wait_sigint_received = 0;
278 if (job_control == 0)
279- old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
280+ {
281+ old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler);
282+ if (old_sigint_handler == SIG_IGN)
283+ set_signal_handler (SIGINT, old_sigint_handler);
284+ }
285
286 termination_state = last_command_exit_value;
287
288diff -Naur bash-3.1.orig/lib/readline/terminal.c bash-3.1/lib/readline/terminal.c
289--- bash-3.1.orig/lib/readline/terminal.c 2005-11-13 01:46:54.000000000 +0000
290+++ bash-3.1/lib/readline/terminal.c 2006-02-28 03:35:13.000000000 +0000
291@@ -122,7 +122,7 @@
292 static char *_rl_visible_bell;
293
294 /* Non-zero means the terminal can auto-wrap lines. */
295-int _rl_term_autowrap;
296+int _rl_term_autowrap = -1;
297
298 /* Non-zero means that this terminal has a meta key. */
299 static int term_has_meta;
300@@ -274,6 +274,9 @@
301 _rl_set_screen_size (rows, cols)
302 int rows, cols;
303 {
304+ if (_rl_term_autowrap == -1)
305+ _rl_init_terminal_io (rl_terminal_name);
306+
307 if (rows > 0)
308 _rl_screenheight = rows;
309 if (cols > 0)
310diff -Naur bash-3.1.orig/parse.y bash-3.1/parse.y
311--- bash-3.1.orig/parse.y 2005-11-12 04:14:18.000000000 +0000
312+++ bash-3.1/parse.y 2006-02-28 03:35:40.000000000 +0000
313@@ -2716,6 +2716,7 @@
314 #define P_ALLOWESC 0x02
315 #define P_DQUOTE 0x04
316 #define P_COMMAND 0x08 /* parsing a command, so look for comments */
317+#define P_BACKQUOTE 0x10 /* parsing a backquoted command substitution */
318
319 static char matched_pair_error;
320 static char *
321@@ -2725,12 +2726,12 @@
322 int *lenp, flags;
323 {
324 int count, ch, was_dollar, in_comment, check_comment;
325- int pass_next_character, nestlen, ttranslen, start_lineno;
326+ int pass_next_character, backq_backslash, nestlen, ttranslen, start_lineno;
327 char *ret, *nestret, *ttrans;
328 int retind, retsize, rflags;
329
330 count = 1;
331- pass_next_character = was_dollar = in_comment = 0;
332+ pass_next_character = backq_backslash = was_dollar = in_comment = 0;
333 check_comment = (flags & P_COMMAND) && qc != '\'' && qc != '"' && (flags & P_DQUOTE) == 0;
334
335 /* RFLAGS is the set of flags we want to pass to recursive calls. */
336@@ -2742,11 +2743,8 @@
337 start_lineno = line_number;
338 while (count)
339 {
340-#if 0
341- ch = shell_getc ((qc != '\'' || (flags & P_ALLOWESC)) && pass_next_character == 0);
342-#else
343- ch = shell_getc (qc != '\'' && pass_next_character == 0);
344-#endif
345+ ch = shell_getc (qc != '\'' && pass_next_character == 0 && backq_backslash == 0);
346+
347 if (ch == EOF)
348 {
349 free (ret);
350@@ -2771,9 +2769,16 @@
351 continue;
352 }
353 /* Not exactly right yet */
354- else if (check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind -1])))
355+ else if MBTEST(check_comment && in_comment == 0 && ch == '#' && (retind == 0 || ret[retind-1] == '\n' || whitespace (ret[retind - 1])))
356 in_comment = 1;
357
358+ /* last char was backslash inside backquoted command substitution */
359+ if (backq_backslash)
360+ {
361+ backq_backslash = 0;
362+ /* Placeholder for adding special characters */
363+ }
364+
365 if (pass_next_character) /* last char was backslash */
366 {
367 pass_next_character = 0;
368@@ -2814,6 +2819,8 @@
369 {
370 if MBTEST((flags & P_ALLOWESC) && ch == '\\')
371 pass_next_character++;
372+ else if MBTEST((flags & P_BACKQUOTE) && ch == '\\')
373+ backq_backslash++;
374 continue;
375 }
376
377@@ -2898,7 +2905,11 @@
378 }
379 else if MBTEST(qc == '`' && (ch == '"' || ch == '\'') && in_comment == 0)
380 {
381- nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags);
382+ /* Add P_BACKQUOTE so backslash quotes the next character and
383+ shell_getc does the right thing with \<newline>. We do this for
384+ a measure of backwards compatibility -- it's not strictly the
385+ right POSIX thing. */
386+ nestret = parse_matched_pair (0, ch, ch, &nestlen, rflags|P_BACKQUOTE);
387 goto add_nestret;
388 }
389 else if MBTEST(was_dollar && (ch == '(' || ch == '{' || ch == '[')) /* ) } ] */
390@@ -2907,7 +2918,7 @@
391 if (open == ch) /* undo previous increment */
392 count--;
393 if (ch == '(') /* ) */
394- nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags);
395+ nestret = parse_matched_pair (0, '(', ')', &nestlen, rflags & ~P_DQUOTE);
396 else if (ch == '{') /* } */
397 nestret = parse_matched_pair (0, '{', '}', &nestlen, P_FIRSTCLOSE|rflags);
398 else if (ch == '[') /* ] */
399@@ -3695,7 +3706,9 @@
400 struct builtin *b;
401 b = builtin_address_internal (token, 0);
402 if (b && (b->flags & ASSIGNMENT_BUILTIN))
403- parser_state |= PST_ASSIGNOK;
404+ parser_state |= PST_ASSIGNOK;
405+ else if (STREQ (token, "eval") || STREQ (token, "let"))
406+ parser_state |= PST_ASSIGNOK;
407 }
408
409 yylval.word = the_word;
410@@ -4686,18 +4699,21 @@
411 int *retlenp;
412 {
413 WORD_LIST *wl, *rl;
414- int tok, orig_line_number, orig_token_size;
415+ int tok, orig_line_number, orig_token_size, orig_last_token, assignok;
416 char *saved_token, *ret;
417
418 saved_token = token;
419 orig_token_size = token_buffer_size;
420 orig_line_number = line_number;
421+ orig_last_token = last_read_token;
422
423 last_read_token = WORD; /* WORD to allow reserved words here */
424
425 token = (char *)NULL;
426 token_buffer_size = 0;
427
428+ assignok = parser_state&PST_ASSIGNOK; /* XXX */
429+
430 wl = (WORD_LIST *)NULL; /* ( */
431 parser_state |= PST_COMPASSIGN;
432
433@@ -4740,7 +4756,7 @@
434 jump_to_top_level (DISCARD);
435 }
436
437- last_read_token = WORD;
438+ last_read_token = orig_last_token; /* XXX - was WORD? */
439 if (wl)
440 {
441 rl = REVERSE_LIST (wl, WORD_LIST *);
442@@ -4752,6 +4768,10 @@
443
444 if (retlenp)
445 *retlenp = (ret && *ret) ? strlen (ret) : 0;
446+
447+ if (assignok)
448+ parser_state |= PST_ASSIGNOK;
449+
450 return ret;
451 }
452
453diff -Naur bash-3.1.orig/patchlevel.h bash-3.1/patchlevel.h
454--- bash-3.1.orig/patchlevel.h 2005-07-20 17:58:20.000000000 +0000
455+++ bash-3.1/patchlevel.h 2006-02-28 03:35:40.000000000 +0000
456@@ -25,6 +25,6 @@
457 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
458 looks for to find the patch level (for the sccs version string). */
459
460-#define PATCHLEVEL 0
461+#define PATCHLEVEL 11
462
463 #endif /* _PATCHLEVEL_H_ */
464diff -Naur bash-3.1.orig/subst.c bash-3.1/subst.c
465--- bash-3.1.orig/subst.c 2005-10-24 13:51:13.000000000 +0000
466+++ bash-3.1/subst.c 2006-02-28 03:35:11.000000000 +0000
467@@ -2187,7 +2187,7 @@
468 if (mklocal && variable_context)
469 {
470 v = find_variable (name);
471- if (v == 0 || array_p (v) == 0)
472+ if (v == 0 || array_p (v) == 0 || v->context != variable_context)
473 v = make_local_array_variable (name);
474 v = assign_array_var_from_string (v, value, flags);
475 }
476@@ -6795,6 +6795,12 @@
477 if (temp && *temp && t_index > 0)
478 {
479 temp1 = bash_tilde_expand (temp, tflag);
480+ if (temp1 && *temp1 == '~' && STREQ (temp, temp1))
481+ {
482+ FREE (temp);
483+ FREE (temp1);
484+ goto add_character; /* tilde expansion failed */
485+ }
486 free (temp);
487 temp = temp1;
488 sindex += t_index;
489diff -Naur bash-3.1.orig/variables.c bash-3.1/variables.c
490--- bash-3.1.orig/variables.c 2005-11-13 02:22:37.000000000 +0000
491+++ bash-3.1/variables.c 2006-02-28 03:35:08.000000000 +0000
492@@ -860,9 +860,11 @@
493 {
494 char val[INT_STRLEN_BOUND(int) + 1], *v;
495
496+#if defined (READLINE)
497 /* If we are currently assigning to LINES or COLUMNS, don't do anything. */
498 if (winsize_assignment)
499 return;
500+#endif
501
502 v = inttostr (lines, val, sizeof (val));
503 bind_variable ("LINES", v, 0);
Note: See TracBrowser for help on using the repository browser.