source: patches/bash-4.2-branch_update-2.patch@ 01962cfe

clfs-1.2
Last change on this file since 01962cfe was b369f3c, checked in by Jonathan Norman <jon@…>, 14 years ago

Add GCC branch update, Updated ncurses, vim, bash and tar patches

  • Property mode set to 100644
File size: 13.8 KB
RevLine 
[b369f3c]1Submitted By: Jonathan Norman (jonathan at bluesquarelinux.co.uk)
2Date: 2011-05-16
[b36b9f9]3Initial Package Version: 4.2
4Origin: Upstream
[b369f3c]5Upstream Status: Applied
6Description: Contains all upstream patches up to 4.2-010
[b36b9f9]7
[b369f3c]8diff -Naur bash-4.2.orig/builtins/fc.def bash-4.2/builtins/fc.def
9--- bash-4.2.orig/builtins/fc.def 2010-05-30 22:25:38.000000000 +0000
10+++ bash-4.2/builtins/fc.def 2011-05-16 23:42:00.796961011 +0000
11@@ -304,7 +304,7 @@
12 last_hist = i - rh - hist_last_line_added;
13
14 /* XXX */
15- if (saved_command_line_count > 0 && i == last_hist && hlist[last_hist] == 0)
16+ if (i == last_hist && hlist[last_hist] == 0)
17 while (last_hist >= 0 && hlist[last_hist] == 0)
18 last_hist--;
19 if (last_hist < 0)
20@@ -475,7 +475,7 @@
21 HIST_ENTRY **hlist;
22 {
23 int sign, n, clen, rh;
24- register int i, j;
25+ register int i, j, last_hist;
26 register char *s;
27
28 sign = 1;
29@@ -495,7 +495,15 @@
30 has been enabled (interactive or not) should use it in the last_hist
31 calculation as if it were on. */
32 rh = remember_on_history || ((subshell_environment & SUBSHELL_COMSUB) && enable_history_list);
33- i -= rh + hist_last_line_added;
34+ last_hist = i - rh - hist_last_line_added;
35+
36+ if (i == last_hist && hlist[last_hist] == 0)
37+ while (last_hist >= 0 && hlist[last_hist] == 0)
38+ last_hist--;
39+ if (last_hist < 0)
40+ return (-1);
41+
42+ i = last_hist;
43
44 /* No specification defaults to most recent command. */
45 if (command == NULL)
[b36b9f9]46diff -Naur bash-4.2.orig/builtins/printf.def bash-4.2/builtins/printf.def
[b369f3c]47--- bash-4.2.orig/builtins/printf.def 2010-11-23 15:02:55.000000000 +0000
48+++ bash-4.2/builtins/printf.def 2011-05-16 23:41:55.617535899 +0000
[b36b9f9]49@@ -465,6 +465,9 @@
50 secs = shell_start_time; /* roughly $SECONDS */
51 else
52 secs = arg;
53+#if defined (HAVE_TZSET)
54+ sv_tz ("TZ"); /* XXX -- just make sure */
55+#endif
56 tm = localtime (&secs);
57 n = strftime (timebuf, sizeof (timebuf), timefmt, tm);
58 free (timefmt);
59diff -Naur bash-4.2.orig/lib/glob/gmisc.c bash-4.2/lib/glob/gmisc.c
[b369f3c]60--- bash-4.2.orig/lib/glob/gmisc.c 2011-02-05 21:11:17.000000000 +0000
61+++ bash-4.2/lib/glob/gmisc.c 2011-05-16 23:41:53.037822234 +0000
[b36b9f9]62@@ -77,8 +77,8 @@
63 wchar_t *wpat;
64 size_t wmax;
65 {
66- wchar_t wc, *wbrack;
67- int matlen, t, in_cclass, in_collsym, in_equiv;
68+ wchar_t wc;
69+ int matlen, bracklen, t, in_cclass, in_collsym, in_equiv;
70
71 if (*wpat == 0)
72 return (0);
73@@ -118,58 +118,80 @@
74 break;
75 case L'[':
76 /* scan for ending `]', skipping over embedded [:...:] */
77- wbrack = wpat;
78+ bracklen = 1;
79 wc = *wpat++;
80 do
81 {
82 if (wc == 0)
83 {
84- matlen += wpat - wbrack - 1; /* incremented below */
85- break;
86+ wpat--; /* back up to NUL */
87+ matlen += bracklen;
88+ goto bad_bracket;
89 }
90 else if (wc == L'\\')
91 {
92- wc = *wpat++;
93- if (*wpat == 0)
94- break;
95+ /* *wpat == backslash-escaped character */
96+ bracklen++;
97+ /* If the backslash or backslash-escape ends the string,
98+ bail. The ++wpat skips over the backslash escape */
99+ if (*wpat == 0 || *++wpat == 0)
100+ {
101+ matlen += bracklen;
102+ goto bad_bracket;
103+ }
104 }
105 else if (wc == L'[' && *wpat == L':') /* character class */
106 {
107 wpat++;
108+ bracklen++;
109 in_cclass = 1;
110 }
111 else if (in_cclass && wc == L':' && *wpat == L']')
112 {
113 wpat++;
114+ bracklen++;
115 in_cclass = 0;
116 }
117 else if (wc == L'[' && *wpat == L'.') /* collating symbol */
118 {
119 wpat++;
120+ bracklen++;
121 if (*wpat == L']') /* right bracket can appear as collating symbol */
122- wpat++;
123+ {
124+ wpat++;
125+ bracklen++;
126+ }
127 in_collsym = 1;
128 }
129 else if (in_collsym && wc == L'.' && *wpat == L']')
130 {
131 wpat++;
132+ bracklen++;
133 in_collsym = 0;
134 }
135 else if (wc == L'[' && *wpat == L'=') /* equivalence class */
136 {
137 wpat++;
138+ bracklen++;
139 if (*wpat == L']') /* right bracket can appear as equivalence class */
140- wpat++;
141+ {
142+ wpat++;
143+ bracklen++;
144+ }
145 in_equiv = 1;
146 }
147 else if (in_equiv && wc == L'=' && *wpat == L']')
148 {
149 wpat++;
150+ bracklen++;
151 in_equiv = 0;
152 }
153+ else
154+ bracklen++;
155 }
156 while ((wc = *wpat++) != L']');
157 matlen++; /* bracket expression can only match one char */
158+bad_bracket:
159 break;
160 }
161 }
162@@ -213,8 +235,8 @@
163 char *pat;
164 size_t max;
165 {
166- char c, *brack;
167- int matlen, t, in_cclass, in_collsym, in_equiv;
168+ char c;
169+ int matlen, bracklen, t, in_cclass, in_collsym, in_equiv;
170
171 if (*pat == 0)
172 return (0);
173@@ -254,58 +276,80 @@
174 break;
175 case '[':
176 /* scan for ending `]', skipping over embedded [:...:] */
177- brack = pat;
178+ bracklen = 1;
179 c = *pat++;
180 do
181 {
182 if (c == 0)
183 {
184- matlen += pat - brack - 1; /* incremented below */
185- break;
186+ pat--; /* back up to NUL */
187+ matlen += bracklen;
188+ goto bad_bracket;
189 }
190 else if (c == '\\')
191 {
192- c = *pat++;
193- if (*pat == 0)
194- break;
195+ /* *pat == backslash-escaped character */
196+ bracklen++;
197+ /* If the backslash or backslash-escape ends the string,
198+ bail. The ++pat skips over the backslash escape */
199+ if (*pat == 0 || *++pat == 0)
200+ {
201+ matlen += bracklen;
202+ goto bad_bracket;
203+ }
204 }
205 else if (c == '[' && *pat == ':') /* character class */
206 {
207 pat++;
208+ bracklen++;
209 in_cclass = 1;
210 }
211 else if (in_cclass && c == ':' && *pat == ']')
212 {
213 pat++;
214+ bracklen++;
215 in_cclass = 0;
216 }
217 else if (c == '[' && *pat == '.') /* collating symbol */
218 {
219 pat++;
220+ bracklen++;
221 if (*pat == ']') /* right bracket can appear as collating symbol */
222- pat++;
223+ {
224+ pat++;
225+ bracklen++;
226+ }
227 in_collsym = 1;
228 }
229 else if (in_collsym && c == '.' && *pat == ']')
230 {
231 pat++;
232+ bracklen++;
233 in_collsym = 0;
234 }
235 else if (c == '[' && *pat == '=') /* equivalence class */
236 {
237 pat++;
238+ bracklen++;
239 if (*pat == ']') /* right bracket can appear as equivalence class */
240- pat++;
241+ {
242+ pat++;
243+ bracklen++;
244+ }
245 in_equiv = 1;
246 }
247 else if (in_equiv && c == '=' && *pat == ']')
248 {
249 pat++;
250+ bracklen++;
251 in_equiv = 0;
252 }
253+ else
254+ bracklen++;
255 }
256 while ((c = *pat++) != ']');
257 matlen++; /* bracket expression can only match one char */
258+bad_bracket:
259 break;
260 }
261 }
262diff -Naur bash-4.2.orig/lib/readline/callback.c bash-4.2/lib/readline/callback.c
[b369f3c]263--- bash-4.2.orig/lib/readline/callback.c 2010-06-06 16:18:58.000000000 +0000
264+++ bash-4.2/lib/readline/callback.c 2011-05-16 23:41:51.689971838 +0000
[b36b9f9]265@@ -148,6 +148,9 @@
266 eof = _rl_vi_domove_callback (_rl_vimvcxt);
267 /* Should handle everything, including cleanup, numeric arguments,
268 and turning off RL_STATE_VIMOTION */
269+ if (RL_ISSTATE (RL_STATE_NUMERICARG) == 0)
270+ _rl_internal_char_cleanup ();
271+
272 return;
273 }
274 #endif
275diff -Naur bash-4.2.orig/lib/readline/vi_mode.c bash-4.2/lib/readline/vi_mode.c
[b369f3c]276--- bash-4.2.orig/lib/readline/vi_mode.c 2010-11-21 00:51:39.000000000 +0000
277+++ bash-4.2/lib/readline/vi_mode.c 2011-05-16 23:41:51.689971838 +0000
[b36b9f9]278@@ -1114,7 +1114,7 @@
279 rl_beg_of_line (1, c);
280 _rl_vi_last_motion = c;
281 RL_UNSETSTATE (RL_STATE_VIMOTION);
282- return (0);
283+ return (vidomove_dispatch (m));
284 }
285 #if defined (READLINE_CALLBACKS)
286 /* XXX - these need to handle rl_universal_argument bindings */
287diff -Naur bash-4.2.orig/parse.y bash-4.2/parse.y
[b369f3c]288--- bash-4.2.orig/parse.y 2011-01-02 20:48:11.000000000 +0000
289+++ bash-4.2/parse.y 2011-05-16 23:41:55.613536343 +0000
[b36b9f9]290@@ -5135,6 +5135,9 @@
291 case 'A':
292 /* Make the current time/date into a string. */
293 (void) time (&the_time);
294+#if defined (HAVE_TZSET)
295+ sv_tz ("TZ"); /* XXX -- just make sure */
296+#endif
297 tm = localtime (&the_time);
298
299 if (c == 'd')
300diff -Naur bash-4.2.orig/patchlevel.h bash-4.2/patchlevel.h
[b369f3c]301--- bash-4.2.orig/patchlevel.h 2010-06-13 00:14:48.000000000 +0000
302+++ bash-4.2/patchlevel.h 2011-05-16 23:42:02.092817179 +0000
[b36b9f9]303@@ -25,6 +25,6 @@
304 regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
305 looks for to find the patch level (for the sccs version string). */
306
307-#define PATCHLEVEL 0
[b369f3c]308+#define PATCHLEVEL 10
[b36b9f9]309
310 #endif /* _PATCHLEVEL_H_ */
[b369f3c]311diff -Naur bash-4.2.orig/print_cmd.c bash-4.2/print_cmd.c
312--- bash-4.2.orig/print_cmd.c 2010-05-30 22:34:08.000000000 +0000
313+++ bash-4.2/print_cmd.c 2011-05-16 23:42:02.092817179 +0000
314@@ -315,6 +315,7 @@
315 cprintf ("( ");
316 skip_this_indent++;
317 make_command_string_internal (command->value.Subshell->command);
318+ PRINT_DEFERRED_HEREDOCS ("");
319 cprintf (" )");
320 break;
321
322@@ -592,6 +593,7 @@
323 newline ("do\n");
324 indentation += indentation_amount;
325 make_command_string_internal (arith_for_command->action);
326+ PRINT_DEFERRED_HEREDOCS ("");
327 semicolon ();
328 indentation -= indentation_amount;
329 newline ("done");
330@@ -653,6 +655,7 @@
331 }
332
333 make_command_string_internal (group_command->command);
334+ PRINT_DEFERRED_HEREDOCS ("");
335
336 if (inside_function_def)
337 {
[b36b9f9]338diff -Naur bash-4.2.orig/sig.c bash-4.2/sig.c
[b369f3c]339--- bash-4.2.orig/sig.c 2010-11-23 13:21:22.000000000 +0000
340+++ bash-4.2/sig.c 2011-05-16 23:41:59.501104844 +0000
[b36b9f9]341@@ -46,6 +46,7 @@
342
343 #if defined (READLINE)
344 # include "bashline.h"
345+# include <readline/readline.h>
346 #endif
347
348 #if defined (HISTORY)
349@@ -62,6 +63,7 @@
350 #if defined (HISTORY)
351 extern int history_lines_this_session;
352 #endif
353+extern int no_line_editing;
354
355 extern void initialize_siglist ();
356
357@@ -505,7 +507,10 @@
358 {
359 #if defined (HISTORY)
360 /* XXX - will inhibit history file being written */
361- history_lines_this_session = 0;
362+# if defined (READLINE)
363+ if (interactive_shell == 0 || interactive == 0 || (sig != SIGHUP && sig != SIGTERM) || no_line_editing || (RL_ISSTATE (RL_STATE_READCMD) == 0))
364+# endif
365+ history_lines_this_session = 0;
366 #endif
367 terminate_immediately = 0;
368 termsig_handler (sig);
369diff -Naur bash-4.2.orig/subst.c bash-4.2/subst.c
[b369f3c]370--- bash-4.2.orig/subst.c 2011-01-02 21:12:51.000000000 +0000
371+++ bash-4.2/subst.c 2011-05-16 23:41:58.205248678 +0000
[b36b9f9]372@@ -1379,10 +1379,12 @@
373 slen = strlen (string + *sindex) + *sindex;
374
375 /* The handling of dolbrace_state needs to agree with the code in parse.y:
376- parse_matched_pair() */
377- dolbrace_state = 0;
378- if (quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES))
379- dolbrace_state = (flags & SX_POSIXEXP) ? DOLBRACE_QUOTE : DOLBRACE_PARAM;
380+ parse_matched_pair(). The different initial value is to handle the
381+ case where this function is called to parse the word in
382+ ${param op word} (SX_WORD). */
383+ dolbrace_state = (flags & SX_WORD) ? DOLBRACE_WORD : DOLBRACE_PARAM;
384+ if ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) && (flags & SX_POSIXEXP))
385+ dolbrace_state = DOLBRACE_QUOTE;
386
387 i = *sindex;
388 while (c = string[i])
389@@ -3371,7 +3373,7 @@
390 if (string == 0 || *string == '\0')
391 return (WORD_LIST *)NULL;
392
393- td.flags = 0;
394+ td.flags = W_NOSPLIT2; /* no splitting, remove "" and '' */
395 td.word = string;
396 tresult = call_expand_word_internal (&td, quoted, 1, dollar_at_p, has_dollar_at);
397 return (tresult);
398@@ -4607,6 +4609,7 @@
399 if (ifs_firstc == 0)
400 #endif
401 word->flags |= W_NOSPLIT;
402+ word->flags |= W_NOSPLIT2;
403 result = call_expand_word_internal (word, quoted, 0, (int *)NULL, (int *)NULL);
404 expand_no_split_dollar_star = 0;
405
406@@ -7176,7 +7179,7 @@
407 {
408 /* Extract the contents of the ${ ... } expansion
409 according to the Posix.2 rules. */
410- value = extract_dollar_brace_string (string, &sindex, quoted, (c == '%' || c == '#') ? SX_POSIXEXP : 0);
411+ value = extract_dollar_brace_string (string, &sindex, quoted, (c == '%' || c == '#' || c =='/' || c == '^' || c == ',' || c ==':') ? SX_POSIXEXP|SX_WORD : SX_WORD);
412 if (string[sindex] == RBRACE)
413 sindex++;
414 else
415diff -Naur bash-4.2.orig/subst.h bash-4.2/subst.h
[b369f3c]416--- bash-4.2.orig/subst.h 2010-12-03 01:21:29.000000000 +0000
417+++ bash-4.2/subst.h 2011-05-16 23:41:50.378117447 +0000
[b36b9f9]418@@ -56,6 +56,7 @@
419 #define SX_NOLONGJMP 0x0040 /* don't longjmp on fatal error */
420 #define SX_ARITHSUB 0x0080 /* extracting $(( ... )) (currently unused) */
421 #define SX_POSIXEXP 0x0100 /* extracting new Posix pattern removal expansions in extract_dollar_brace_string */
422+#define SX_WORD 0x0200 /* extracting word in ${param op word} */
423
424 /* Remove backslashes which are quoting backquotes from STRING. Modifies
425 STRING, and returns a pointer to it. */
426diff -Naur bash-4.2.orig/variables.c bash-4.2/variables.c
[b369f3c]427--- bash-4.2.orig/variables.c 2011-01-25 01:07:48.000000000 +0000
428+++ bash-4.2/variables.c 2011-05-16 23:41:56.917391622 +0000
[b36b9f9]429@@ -3653,6 +3653,22 @@
430 return n;
431 }
432
433+int
434+chkexport (name)
435+ char *name;
436+{
437+ SHELL_VAR *v;
438+
439+ v = find_variable (name);
440+ if (v && exported_p (v))
441+ {
442+ array_needs_making = 1;
443+ maybe_make_export_env ();
444+ return 1;
445+ }
446+ return 0;
447+}
448+
449 void
450 maybe_make_export_env ()
451 {
452@@ -4214,7 +4230,7 @@
453 { "TEXTDOMAIN", sv_locale },
454 { "TEXTDOMAINDIR", sv_locale },
455
456-#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
457+#if defined (HAVE_TZSET)
458 { "TZ", sv_tz },
459 #endif
460
461@@ -4558,12 +4574,13 @@
462 }
463 #endif /* HISTORY */
464
465-#if defined (HAVE_TZSET) && defined (PROMPT_STRING_DECODE)
466+#if defined (HAVE_TZSET)
467 void
468 sv_tz (name)
469 char *name;
470 {
471- tzset ();
472+ if (chkexport (name))
473+ tzset ();
474 }
475 #endif
476
477diff -Naur bash-4.2.orig/variables.h bash-4.2/variables.h
[b369f3c]478--- bash-4.2.orig/variables.h 2010-12-03 01:22:01.000000000 +0000
479+++ bash-4.2/variables.h 2011-05-16 23:41:55.613536343 +0000
[b36b9f9]480@@ -313,6 +313,7 @@
481
482 extern void sort_variables __P((SHELL_VAR **));
483
484+extern int chkexport __P((char *));
485 extern void maybe_make_export_env __P((void));
486 extern void update_export_env_inplace __P((char *, int, char *));
487 extern void put_command_name_into_env __P((char *));
Note: See TracBrowser for help on using the repository browser.