Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-shells/bash/files/
Date: Sun, 15 Sep 2019 07:53:06
Message-Id: 1568533858.efb92a51c30ded73401e564c714c951772619485.vapier@gentoo
1 commit: efb92a51c30ded73401e564c714c951772619485
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 14 18:14:41 2019 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 15 07:50:58 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=efb92a51
7
8 Revert "app-shells/bash: remove unused patches."
9
10 This reverts commit 40314bb465f6ec08c01228ba7fb01c0c73450d44.
11
12 All of these patches are used.
13
14 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
15
16 app-shells/bash/files/bash-3.0-afs.patch | 20 ++
17 app-shells/bash/files/bash-3.0-crash.patch | 46 ++++
18 .../bash/files/bash-3.0-histtimeformat.patch | 56 ++++
19 app-shells/bash/files/bash-3.0-jobs.patch | 56 ++++
20 app-shells/bash/files/bash-3.0-locale.patch | 112 ++++++++
21 app-shells/bash/files/bash-3.0-manpage.patch | 15 ++
22 app-shells/bash/files/bash-3.0-multibyteifs.patch | 281 +++++++++++++++++++++
23 app-shells/bash/files/bash-3.0-pwd.patch | 16 ++
24 app-shells/bash/files/bash-3.0-subshell.patch | 39 +++
25 app-shells/bash/files/bash-3.0-ulimit.patch | 186 ++++++++++++++
26 .../bash/files/bash-3.0-volatile-command.patch | 16 ++
27 11 files changed, 843 insertions(+)
28
29 diff --git a/app-shells/bash/files/bash-3.0-afs.patch b/app-shells/bash/files/bash-3.0-afs.patch
30 new file mode 100644
31 index 00000000000..f07371c39eb
32 --- /dev/null
33 +++ b/app-shells/bash/files/bash-3.0-afs.patch
34 @@ -0,0 +1,20 @@
35 +Ripped from Fedora
36 +
37 +- Fixed AFS support for output redirection, so that the correct errors
38 + are reported for other filesystems (bug #155373).
39 +
40 +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=155373
41 +
42 +--- bash-3.0/redir.c.afs 2005-04-20 09:16:15.000000000 +0100
43 ++++ bash-3.0/redir.c 2005-04-20 09:16:58.000000000 +0100
44 +@@ -596,7 +596,9 @@
45 + fd = open (filename, flags, mode);
46 + #if defined (AFS)
47 + if ((fd < 0) && (errno == EACCES))
48 +- fd = open (filename, flags & ~O_CREAT, mode);
49 ++ if ((fd = open (filename, flags & ~O_CREAT, mode)) < 0)
50 ++ /* Restore previous errno. */
51 ++ errno = EACCES;
52 + #endif /* AFS */
53 + }
54 +
55
56 diff --git a/app-shells/bash/files/bash-3.0-crash.patch b/app-shells/bash/files/bash-3.0-crash.patch
57 new file mode 100644
58 index 00000000000..984e85d82ed
59 --- /dev/null
60 +++ b/app-shells/bash/files/bash-3.0-crash.patch
61 @@ -0,0 +1,46 @@
62 +> Machine Type: i686-pc-linux-gnu
63 +>
64 +> Bash Version: 3.0
65 +> Patch Level: 0
66 +> Release Status: release
67 +>
68 +> Description:
69 +> GNU bash, version 3.00.0(1)-release (i686-pc-linux-gnu)
70 +> (and
71 +> GNU bash, version 2.05b.0(1)-release (i386-redhat-linux-gnu)
72 +>
73 +> dumps a core because of a null pointer "in make_bare_word
74 +> at make_cmd.c:90" (see gdb output below)
75 +
76 +Thanks for the report. Here's a quick fix:
77 +
78 +*** arrayfunc.c~ Sat Nov 6 15:08:29 2004
79 +--- arrayfunc.c Mon Jan 31 11:56:21 2005
80 +***************
81 +*** 709,713 ****
82 + return ((char *)NULL);
83 + }
84 +! else if (var == 0)
85 + return ((char *)NULL);
86 + else if (array_p (var) == 0)
87 +--- 709,713 ----
88 + return ((char *)NULL);
89 + }
90 +! else if (var == 0 || value_cell (var) == 0)
91 + return ((char *)NULL);
92 + else if (array_p (var) == 0)
93 +
94 +
95 +Chet
96 +
97 +--
98 +``The lyf so short, the craft so long to lerne.'' - Chaucer
99 +( ``Discere est Dolere'' -- chet )
100 + Live...Laugh...Love
101 +Chet Ramey, ITS, CWRU chet@×××××××.edu http://tiswww.tis.cwru.edu/~chet/
102 +
103 +
104 +_______________________________________________
105 +Bug-bash mailing list
106 +Bug-bash@×××.org
107 +http://lists.gnu.org/mailman/listinfo/bug-bash
108
109 diff --git a/app-shells/bash/files/bash-3.0-histtimeformat.patch b/app-shells/bash/files/bash-3.0-histtimeformat.patch
110 new file mode 100644
111 index 00000000000..b910600fd89
112 --- /dev/null
113 +++ b/app-shells/bash/files/bash-3.0-histtimeformat.patch
114 @@ -0,0 +1,56 @@
115 +Ripped from Debian
116 +
117 +http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00008.html
118 +
119 +From: Enrique Perez-Terron <enrio@××××××.no>
120 +To: bug-bash@×××.org
121 +Subject: When using HISTTIMEFORMAT, the date and the command are run
122 + together.
123 +Date: Sun, 01 Aug 2004 18:36:45 +0200
124 +
125 +Configuration Information [Automatically generated, do not change]:
126 +Machine: i586
127 +OS: linux-gnu
128 +Compiler: gcc
129 +Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i586'
130 +-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-pc-linux-gnu'
131 +-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale'
132 +-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
133 +-g -O2
134 +uname output: Linux arabia.home.lan 2.6.6-1.435.2.3 #1 Thu Jul 1
135 +09:11:28 EDT 2004 i586 i586 i386 GNU/Linux
136 +Machine Type: i586-pc-linux-gnu
137 +
138 +# DP: Add space separating the time and the command in the
139 +# DP: output from the history builtin command.
140 +
141 +Bash Version: 3.0
142 +Patch Level: 0
143 +Release Status: release
144 +
145 +Description:
146 + There is no space separating the time and the command in the
147 + output from the history builtin command.
148 +
149 +Repeat-By:
150 + $ export HISTTIMEFORMAT=_A_format_string_
151 + $ history 3
152 + 997 _A_format_string_echo $BASH_VERSION
153 + 998 _A_format_string_export HISTTIMEFORMAT=_A_format_string_
154 + 999 _A_format_string_history 3
155 +
156 +Fix:
157 +--- ./builtins/history.def.orig 2003-12-20 00:02:09.000000000 +0100
158 ++++ ./builtins/history.def 2004-08-01 18:18:02.652720102 +0200
159 +@@ -287,9 +287,10 @@
160 + QUIT;
161 +
162 + timestr = (histtimefmt && *histtimefmt) ? histtime (hlist[i], histtimefmt) : (char *)NULL;
163 +- printf ("%5d%c %s%s\n", i + history_base,
164 ++ printf ("%5d%c %s%s%s\n", i + history_base,
165 + histdata(i) ? '*' : ' ',
166 + ((timestr && *timestr) ? timestr : ""),
167 ++ ((timestr && *timestr) ? " " : ""),
168 + histline(i));
169 + i++;
170 + }
171
172 diff --git a/app-shells/bash/files/bash-3.0-jobs.patch b/app-shells/bash/files/bash-3.0-jobs.patch
173 new file mode 100644
174 index 00000000000..72c149c71cf
175 --- /dev/null
176 +++ b/app-shells/bash/files/bash-3.0-jobs.patch
177 @@ -0,0 +1,56 @@
178 +Ripped from Fedora
179 +
180 +* Wed Sep 8 2004 Tim Waugh <twaugh@××××××.com> 3.0-13
181 +- Check for EINVAL from waitpid() and avoid WCONTINUED in that case.
182 +- Fixed jobs4 test.
183 +
184 +From: Tim Waugh
185 +Subject: [patch] bash-3.0: avoid WCONTINUED if invalid
186 +Date: Wed, 8 Sep 2004 16:52:38 +0100
187 +User-agent: Mutt/1.4.1i
188 +
189 +Hi,
190 +
191 +GNU libc defines WCONTINUED, but (at least on Linux 2.4.x kernels)
192 +waitpid() returns -1 with errno set to EINVAL if WCONTINUED is
193 +supplied in options.
194 +
195 +Here is a patch to retry without WCONTINUED set in that case.
196 +
197 +Tim.
198 +
199 +--- bash-3.0/tests/jobs4.sub
200 ++++ bash-3.0/tests/jobs4.sub
201 +@@ -18,5 +18,5 @@
202 +
203 + wait
204 +
205 +-cat &
206 ++sleep 100 &
207 + kill -1 %% && echo i killed it || echo could not kill it
208 +--- bash-3.0/jobs.c
209 ++++ bash-3.0/jobs.c
210 +@@ -2475,6 +2475,7 @@
211 + PROCESS *child;
212 + pid_t pid;
213 + int call_set_current, last_stopped_job, job, children_exited, waitpid_flags;
214 ++ static int wcontinued_not_supported = 0;
215 +
216 + call_set_current = children_exited = 0;
217 + last_stopped_job = NO_JOB;
218 +@@ -2488,7 +2489,15 @@
219 + : 0;
220 + if (sigchld || block == 0)
221 + waitpid_flags |= WNOHANG;
222 ++ retry:
223 ++ if (wcontinued_not_supported)
224 ++ waitpid_flags &= ~WCONTINUED;
225 + pid = WAITPID (-1, &status, waitpid_flags);
226 ++ if (pid == -1 && errno == EINVAL)
227 ++ {
228 ++ wcontinued_not_supported = 1;
229 ++ goto retry;
230 ++ }
231 +
232 + /* The check for WNOHANG is to make sure we decrement sigchld only
233 + if it was non-zero before we called waitpid. */
234
235 diff --git a/app-shells/bash/files/bash-3.0-locale.patch b/app-shells/bash/files/bash-3.0-locale.patch
236 new file mode 100644
237 index 00000000000..ea1ef3deae3
238 --- /dev/null
239 +++ b/app-shells/bash/files/bash-3.0-locale.patch
240 @@ -0,0 +1,112 @@
241 +Ripped from SuSe
242 +
243 +http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00005.html
244 +
245 +From: schwab@××××.de
246 +To: bug-bash@×××.org
247 +Subject: HISTTIMEFORMAT doesn't track locale changes
248 +Date: Sun, 1 Aug 2004 11:14:00 +0200 (CEST)
249 +
250 +Configuration Information [Automatically generated, do not change]:
251 +Machine: ia64
252 +OS: linux-gnu
253 +Compiler: gcc
254 +Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='ia64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='ia64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I../bash-3.0 -I../bash-3.0/include -I../bash-3.0/lib -O2 -g
255 +uname output: Linux sykes 2.6.5-22-default #1 SMP Fri Jul 2 13:43:23 UTC 2004 ia64 ia64 ia64 GNU/Linux
256 +Machine Type: ia64-unknown-linux-gnu
257 +
258 +Bash Version: 3.0
259 +Patch Level: 0
260 +Release Status: release
261 +
262 +Description:
263 +Bash doesn't use the current locale when formatting HISTTIMEFORMAT.
264 +
265 +Repeat-By:
266 +sykes:/tmp/bash/Build/:[0]$ locale
267 +LANG=de_DE.UTF-8
268 +LC_CTYPE="de_DE.UTF-8"
269 +LC_NUMERIC=POSIX
270 +LC_TIME=POSIX
271 +LC_COLLATE=POSIX
272 +LC_MONETARY="de_DE.UTF-8"
273 +LC_MESSAGES=en_US.UTF-8
274 +LC_PAPER="de_DE.UTF-8"
275 +LC_NAME="de_DE.UTF-8"
276 +LC_ADDRESS="de_DE.UTF-8"
277 +LC_TELEPHONE="de_DE.UTF-8"
278 +LC_MEASUREMENT="de_DE.UTF-8"
279 +LC_IDENTIFICATION="de_DE.UTF-8"
280 +LC_ALL=
281 +sykes:/tmp/bash/Build/:[0]$ history 1
282 + 1502 history 1
283 +sykes:/tmp/bash/Build/:[0]$ HISTTIMEFORMAT=%c
284 +sykes:/tmp/bash/Build/:[0]$ history 1
285 + 1504 Sun Aug 1 10:56:59 2004history 1
286 +sykes:/tmp/bash/Build/:[0]$ export LC_TIME=$LANG
287 +sykes:/tmp/bash/Build/:[0]$ history 1
288 + 1506 Sun Aug 1 10:57:24 2004history 1
289 +
290 +--- bash-3.0/locale.c
291 ++++ bash-3.0/locale.c
292 +@@ -71,9 +71,10 @@ set_default_locale ()
293 + textdomain (PACKAGE);
294 + }
295 +
296 +-/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES and LC_NUMERIC
297 +- if they are not specified in the environment, but LC_ALL is. This
298 +- should be called from main() after parsing the environment. */
299 ++/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_NUMERIC
300 ++ and LC_TIME if they are not specified in the environment, but LC_ALL
301 ++ is. This should be called from main() after parsing the
302 ++ environment. */
303 + void
304 + set_default_locale_vars ()
305 + {
306 +@@ -109,6 +110,12 @@ set_default_locale_vars ()
307 + setlocale (LC_NUMERIC, lc_all);
308 + # endif /* LC_NUMERIC */
309 +
310 ++# if defined (LC_TIME)
311 ++ val = get_string_value ("LC_TIME");
312 ++ if (val == 0 && lc_all && *lc_all)
313 ++ setlocale (LC_TIME, lc_all);
314 ++# endif /* LC_TIME */
315 ++
316 + #endif /* HAVE_SETLOCALE */
317 +
318 + val = get_string_value ("TEXTDOMAIN");
319 +@@ -213,6 +220,13 @@ set_locale_var (var, value)
320 + return (setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC")) != 0);
321 + # endif /* LC_NUMERIC */
322 + }
323 ++ else if (var[3] == 'T' && var[4] == 'I') /* LC_TIME */
324 ++ {
325 ++# if defined (LC_TIME)
326 ++ if (lc_all == 0 || *lc_all == '\0')
327 ++ return (setlocale (LC_TIME, get_locale_var ("LC_TIME")) != 0);
328 ++# endif /* LC_TIME */
329 ++ }
330 + #endif /* HAVE_SETLOCALE */
331 +
332 + return (0);
333 +@@ -285,6 +299,9 @@ reset_locale_vars ()
334 + # if defined (LC_NUMERIC)
335 + setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC"));
336 + # endif
337 ++# if defined (LC_TIME)
338 ++ setlocale (LC_TIME, get_locale_var ("LC_TIME"));
339 ++# endif
340 +
341 + locale_setblanks ();
342 +
343 +--- bash-3.0/variables.c
344 ++++ bash-3.0/variables.c
345 +@@ -3646,6 +3646,7 @@ static struct name_and_function special_
346 + { "LC_CTYPE", sv_locale },
347 + { "LC_MESSAGES", sv_locale },
348 + { "LC_NUMERIC", sv_locale },
349 ++ { "LC_TIME", sv_locale },
350 +
351 + { "MAIL", sv_mail },
352 + { "MAILCHECK", sv_mail },
353
354 diff --git a/app-shells/bash/files/bash-3.0-manpage.patch b/app-shells/bash/files/bash-3.0-manpage.patch
355 new file mode 100644
356 index 00000000000..08e3143e542
357 --- /dev/null
358 +++ b/app-shells/bash/files/bash-3.0-manpage.patch
359 @@ -0,0 +1,15 @@
360 +Ripped from Fedora
361 +
362 +fix obvious display bug
363 +
364 +--- bash-3.0/doc/bash.1
365 ++++ bash-3.0/doc/bash.1
366 +@@ -3929,7 +3929,7 @@
367 + .B SIGHUP
368 + to all jobs when an interactive login shell exits.
369 + .PP
370 +-If \Bbash\fP is waiting for a command to complete and receives a signal
371 ++If \fBbash\fP is waiting for a command to complete and receives a signal
372 + for which a trap has been set, the trap will not be executed until
373 + the command completes.
374 + When \fBbash\fP is waiting for an asynchronous command via the \fBwait\fP
375
376 diff --git a/app-shells/bash/files/bash-3.0-multibyteifs.patch b/app-shells/bash/files/bash-3.0-multibyteifs.patch
377 new file mode 100644
378 index 00000000000..1e74832b638
379 --- /dev/null
380 +++ b/app-shells/bash/files/bash-3.0-multibyteifs.patch
381 @@ -0,0 +1,281 @@
382 +From: Tim Waugh <twaugh@××××××.com>
383 +To: bug-bash@×××.org
384 +Subject: [patch] multibyte IFS values
385 +Date: Tue, 24 Aug 2004 13:34:59 +0100
386 +
387 +Hi,
388 +
389 +Here is a patch to address these problems:
390 +
391 +http://lists.gnu.org/archive/html/bug-bash/2004-07/msg00294.html
392 +http://lists.gnu.org/archive/html/bug-bash/2004-07/msg00296.html
393 +
394 +It works well for me at least.
395 +
396 +Tim.
397 +
398 +--- bash-3.0/subst.c.multibyteifs 2004-08-20 15:22:48.366497771 +0100
399 ++++ bash-3.0/subst.c 2004-08-20 18:13:30.833624616 +0100
400 +@@ -124,7 +124,12 @@
401 + SHELL_VAR *ifs_var;
402 + char *ifs_value;
403 + unsigned char ifs_cmap[UCHAR_MAX + 1];
404 ++#if defined (HANDLE_MULTIBYTE)
405 ++unsigned char ifs_firstc[MB_LEN_MAX];
406 ++size_t ifs_firstc_len;
407 ++#else
408 + unsigned char ifs_firstc;
409 ++#endif
410 +
411 + /* Extern functions and variables from different files. */
412 + extern int last_command_exit_value, last_command_exit_signal;
413 +@@ -862,8 +867,14 @@
414 + char *charlist;
415 + {
416 + register int i = *sindex;
417 ++ size_t slen;
418 ++#if defined (HANDLE_MULTIBYTE)
419 ++ size_t clen;
420 ++ wchar_t *wcharlist = NULL;
421 ++#endif
422 + int c;
423 + char *temp;
424 ++ DECLARE_MBSTATE;
425 +
426 + if (charlist[0] == '\'' && charlist[1] == '\0')
427 + {
428 +@@ -872,18 +883,65 @@
429 + return temp;
430 + }
431 +
432 +- for (i = *sindex; c = string[i]; i++)
433 ++ slen = strlen (string + *sindex) + *sindex;
434 ++ i = *sindex;
435 ++#if defined (HANDLE_MULTIBYTE)
436 ++ clen = strlen (charlist);
437 ++#endif
438 ++ while ((c = string[i]))
439 + {
440 ++#if defined (HANDLE_MULTIBYTE)
441 ++ size_t mblength;
442 ++#endif
443 ++
444 + if (c == CTLESC)
445 + {
446 +- i++;
447 ++ i += 2;
448 + continue;
449 + }
450 +
451 ++#if defined (HANDLE_MULTIBYTE)
452 ++ mblength = mblen (string + i, slen - i);
453 ++ if (mblength > 1)
454 ++ {
455 ++ wchar_t wc;
456 ++ size_t mblength = mbtowc (&wc, string + i, slen - i);
457 ++ if (MB_INVALIDCH (mblength))
458 ++ {
459 ++ if (MEMBER (c, charlist))
460 ++ break;
461 ++ }
462 ++ else
463 ++ {
464 ++ if (!wcharlist)
465 ++ {
466 ++ size_t len = mbstowcs (wcharlist, charlist, 0);
467 ++ if (len == -1)
468 ++ len = 0;
469 ++ wcharlist = xmalloc (sizeof (wchar_t) * (len + 1));
470 ++ mbstowcs (wcharlist, charlist, 1 + len);
471 ++ }
472 ++
473 ++ if (wcschr (wcharlist, wc))
474 ++ {
475 ++ break;
476 ++ }
477 ++ }
478 ++ }
479 ++ else
480 ++#endif
481 ++
482 + if (MEMBER (c, charlist))
483 + break;
484 ++
485 ++ ADVANCE_CHAR (string, slen, i);
486 + }
487 +
488 ++#if defined (HANDLE_MULTIBYTE)
489 ++ if (wcharlist)
490 ++ free (wcharlist);
491 ++#endif
492 ++
493 + temp = substring (string, *sindex, i);
494 + *sindex = i;
495 +
496 +@@ -1456,11 +1514,36 @@
497 + d2 = 0;
498 + if (delims)
499 + {
500 +- d2 = (char *)xmalloc (strlen (delims) + 1);
501 +- for (i = ts = 0; delims[i]; i++)
502 ++ size_t slength = strlen (delims);
503 ++#if defined (HANDLE_MULTIBYTE)
504 ++ size_t mblength = 1;
505 ++ DECLARE_MBSTATE;
506 ++#endif
507 ++
508 ++ d2 = (char *)xmalloc (slength + 1);
509 ++ i = ts = 0;
510 ++ while (delims[i])
511 + {
512 ++#if defined (HANDLE_MULTIBYTE)
513 ++ mbstate_t state_bak = state;
514 ++ mblength = mbrlen (delims + i, slength, &state);
515 ++
516 ++ if (MB_INVALIDCH (mblength))
517 ++ state = state_bak;
518 ++ else if (mblength != 1)
519 ++ {
520 ++ memcpy (d2 + ts, delims + i, mblength);
521 ++ ts += mblength;
522 ++ i += mblength;
523 ++ slength -= mblength;
524 ++ continue;
525 ++ }
526 ++#endif
527 ++
528 + if (whitespace(delims[i]) == 0)
529 + d2[ts++] = delims[i];
530 ++ i++;
531 ++ slength--;
532 + }
533 + d2[ts] = '\0';
534 + }
535 +@@ -1654,10 +1737,19 @@
536 + string_list_dollar_star (list)
537 + WORD_LIST *list;
538 + {
539 ++#if defined (HANDLE_MULTIBYTE)
540 ++ char sep[MB_CUR_MAX + 1];
541 ++#else
542 + char sep[2];
543 ++#endif
544 +
545 ++#if defined (HANDLE_MULTIBYTE)
546 ++ memcpy (sep, ifs_firstc, ifs_firstc_len);
547 ++ sep[ifs_firstc_len] = '\0';
548 ++#else
549 + sep[0] = ifs_firstc;
550 + sep[1] = '\0';
551 ++#endif
552 +
553 + return (string_list_internal (list, sep));
554 + }
555 +@@ -1676,14 +1768,41 @@
556 + WORD_LIST *list;
557 + int quoted;
558 + {
559 +- char *ifs, sep[2];
560 ++ char *ifs;
561 ++#if defined (HANDLE_MULTIBYTE)
562 ++ char sep[MB_CUR_MAX + 1];
563 ++#else
564 ++ char sep[2];
565 ++#endif
566 + WORD_LIST *tlist;
567 +
568 + /* XXX this could just be ifs = ifs_value; */
569 + ifs = ifs_var ? value_cell (ifs_var) : (char *)0;
570 +
571 ++#if defined (HANDLE_MULTIBYTE)
572 ++ if (ifs && *ifs)
573 ++ {
574 ++ size_t mblength = mblen (ifs, strnlen (ifs, MB_CUR_MAX));
575 ++ if (MB_INVALIDCH (mblength))
576 ++ {
577 ++ sep[0] = *ifs;
578 ++ sep[1] = '\0';
579 ++ }
580 ++ else
581 ++ {
582 ++ memcpy (sep, ifs, mblength);
583 ++ sep[mblength] = '\0';
584 ++ }
585 ++ }
586 ++ else
587 ++ {
588 ++ sep[0] = ' ';
589 ++ sep[1] = '\0';
590 ++ }
591 ++#else
592 + sep[0] = (ifs == 0 || *ifs == 0) ? ' ' : *ifs;
593 + sep[1] = '\0';
594 ++#endif
595 +
596 + tlist = ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (ifs && *ifs == 0))
597 + ? quote_list (list)
598 +@@ -1732,6 +1851,7 @@
599 + WORD_DESC *t;
600 + char *current_word, *s;
601 + int sindex, sh_style_split, whitesep;
602 ++ size_t slen = 0;
603 +
604 + if (!string || !*string)
605 + return ((WORD_LIST *)NULL);
606 +@@ -1805,7 +1925,12 @@
607 +
608 + /* Move past the current separator character. */
609 + if (string[sindex])
610 +- sindex++;
611 ++ {
612 ++ DECLARE_MBSTATE;
613 ++ if (!slen)
614 ++ slen = strlen (string);
615 ++ ADVANCE_CHAR (string, slen, sindex);
616 ++ }
617 +
618 + /* Now skip sequences of space, tab, or newline characters if they are
619 + in the list of separators. */
620 +@@ -6796,7 +6921,27 @@
621 + ifs_cmap[uc] = 1;
622 + }
623 +
624 ++#if defined (HANDLE_MULTIBYTE)
625 ++ if (!ifs_value)
626 ++ {
627 ++ ifs_firstc[0] = '\0';
628 ++ ifs_firstc_len = 1;
629 ++ }
630 ++ else
631 ++ {
632 ++ size_t ifs_len = strnlen (ifs_value, MB_CUR_MAX);
633 ++ ifs_firstc_len = mblen (ifs_value, ifs_len);
634 ++ if (MB_INVALIDCH (ifs_firstc_len))
635 ++ {
636 ++ ifs_firstc[0] = '\0';
637 ++ ifs_firstc_len = 1;
638 ++ }
639 ++ else
640 ++ memcpy (ifs_firstc, ifs_value, ifs_firstc_len);
641 ++ }
642 ++#else
643 + ifs_firstc = ifs_value ? *ifs_value : 0;
644 ++#endif
645 + }
646 +
647 + char *
648 +--- bash-3.0/subst.h.multibyteifs 2004-08-20 15:51:08.301074583 +0100
649 ++++ bash-3.0/subst.h 2004-08-20 15:51:39.070206473 +0100
650 +@@ -231,7 +231,12 @@
651 + extern SHELL_VAR *ifs_var;
652 + extern char *ifs_value;
653 + extern unsigned char ifs_cmap[];
654 ++#if defined (HANDLE_MULTIBYTE)
655 ++extern unsigned char ifs_firstc[];
656 ++extern size_t ifs_firstc_len;
657 ++#else
658 + extern unsigned char ifs_firstc;
659 ++#endif
660 +
661 + /* Evaluates to 1 if C is a character in $IFS. */
662 + #define isifs(c) (ifs_cmap[(unsigned char)(c)] != 0)
663
664 diff --git a/app-shells/bash/files/bash-3.0-pwd.patch b/app-shells/bash/files/bash-3.0-pwd.patch
665 new file mode 100644
666 index 00000000000..77f0918fb4d
667 --- /dev/null
668 +++ b/app-shells/bash/files/bash-3.0-pwd.patch
669 @@ -0,0 +1,16 @@
670 +Ripped from Fedora
671 +
672 +* Tue Mar 15 2005 Tim Waugh <twaugh@××××××.com> 3.0-30
673 +- Fix PS1 expansion crash when PWD is unset (bg #151116).
674 +
675 +--- bash-3.0/parse.y.pwd 2005-03-15 14:22:36.000000000 +0000
676 ++++ bash-3.0/parse.y 2005-03-15 14:22:37.000000000 +0000
677 +@@ -4103,7 +4103,7 @@
678 + #define ROOT_PATH(x) ((x)[0] == '/' && (x)[1] == 0)
679 + #define DOUBLE_SLASH_ROOT(x) ((x)[0] == '/' && (x)[1] == '/' && (x)[2] == 0)
680 + /* Abbreviate \W as ~ if $PWD == $HOME */
681 +- if (c == 'W' && (((t = get_string_value ("HOME")) == 0) || STREQ (t, temp) == 0))
682 ++ if (c == 'W' && (((t = get_string_value ("HOME")) == 0) || STREQ (t, t_string) == 0))
683 + {
684 + if (ROOT_PATH (t_string) == 0 && DOUBLE_SLASH_ROOT (t_string) == 0)
685 + {
686
687 diff --git a/app-shells/bash/files/bash-3.0-subshell.patch b/app-shells/bash/files/bash-3.0-subshell.patch
688 new file mode 100644
689 index 00000000000..a1d7dfe7d34
690 --- /dev/null
691 +++ b/app-shells/bash/files/bash-3.0-subshell.patch
692 @@ -0,0 +1,39 @@
693 +Ripped from Fedora which took this from upstream
694 +
695 +* Tue Nov 22 2005 Tim Waugh <twaugh@××××××.com> 3.0-37
696 +- Applied patch from upstream to fix parsing problem (bug #146638).
697 +
698 +http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=146638
699 +
700 +--- bash-3.0/parse.y.subshell 2005-11-22 13:19:11.000000000 +0000
701 ++++ bash-3.0/parse.y 2005-11-22 13:19:24.000000000 +0000
702 +@@ -2055,14 +2055,6 @@
703 + if (uc)
704 + shell_input_line_index++;
705 +
706 +- if MBTEST(uc == '\\' && remove_quoted_newline && shell_input_line[shell_input_line_index] == '\n')
707 +- {
708 +- if (SHOULD_PROMPT ())
709 +- prompt_again ();
710 +- line_number++;
711 +- goto restart_read;
712 +- }
713 +-
714 + #if defined (ALIAS) || defined (DPAREN_ARITHMETIC)
715 + /* If UC is NULL, we have reached the end of the current input string. If
716 + pushed_string_list is non-empty, it's time to pop to the previous string
717 +@@ -2078,6 +2070,14 @@
718 + }
719 + #endif /* ALIAS || DPAREN_ARITHMETIC */
720 +
721 ++ if MBTEST(uc == '\\' && remove_quoted_newline && shell_input_line[shell_input_line_index] == '\n')
722 ++ {
723 ++ if (SHOULD_PROMPT ())
724 ++ prompt_again ();
725 ++ line_number++;
726 ++ goto restart_read;
727 ++ }
728 ++
729 + if (!uc && shell_input_line_terminator == EOF)
730 + return ((shell_input_line_index != 0) ? '\n' : EOF);
731 +
732
733 diff --git a/app-shells/bash/files/bash-3.0-ulimit.patch b/app-shells/bash/files/bash-3.0-ulimit.patch
734 new file mode 100644
735 index 00000000000..8202b95d276
736 --- /dev/null
737 +++ b/app-shells/bash/files/bash-3.0-ulimit.patch
738 @@ -0,0 +1,186 @@
739 +Ripped from Fedora
740 +
741 +--- bash-3.0/builtins/ulimit.def
742 ++++ bash-3.0/builtins/ulimit.def
743 +@@ -34,15 +34,20 @@
744 + -a all current limits are reported
745 + -c the maximum size of core files created
746 + -d the maximum size of a process's data segment
747 ++ -e the maximum scheduling priority (`nice')
748 + -f the maximum size of files created by the shell
749 ++ -i the maximum number of pending signals
750 + -l the maximum size a process may lock into memory
751 + -m the maximum resident set size
752 + -n the maximum number of open file descriptors
753 + -p the pipe buffer size
754 ++ -q the maximum number of bytes in POSIX message queues
755 ++ -r the maximum rt priority
756 + -s the maximum stack size
757 + -t the maximum amount of cpu time in seconds
758 + -u the maximum number of user processes
759 + -v the size of virtual memory
760 ++ -x the maximum number of file locks
761 +
762 + If LIMIT is given, it is the new value of the specified resource;
763 + the special LIMIT values `soft', `hard', and `unlimited' stand for
764 +@@ -199,7 +204,13 @@
765 + #ifdef RLIMIT_DATA
766 + { 'd', RLIMIT_DATA, 1024, "data seg size", "kbytes" },
767 + #endif
768 ++#ifdef RLIMIT_NICE
769 ++ { 'e', RLIMIT_NICE, 1, "max nice", (char *)NULL},
770 ++#endif /* RLIMIT_NICE */
771 + { 'f', RLIMIT_FILESIZE, 1024, "file size", "blocks" },
772 ++#ifdef RLIMIT_SIGPENDING
773 ++ { 'i', RLIMIT_SIGPENDING, 1, "pending signals", (char *)NULL},
774 ++#endif
775 + #ifdef RLIMIT_MEMLOCK
776 + { 'l', RLIMIT_MEMLOCK, 1024, "max locked memory", "kbytes" },
777 + #endif
778 +@@ -208,6 +219,12 @@
779 + #endif /* RLIMIT_RSS */
780 + { 'n', RLIMIT_OPENFILES, 1, "open files", (char *)NULL},
781 + { 'p', RLIMIT_PIPESIZE, 512, "pipe size", "512 bytes" },
782 ++#ifdef RLIMIT_MSGQUEUE
783 ++ { 'q', RLIMIT_MSGQUEUE, 1, "POSIX message queues", "bytes" },
784 ++#endif
785 ++#ifdef RLIMIT_RTPRIO
786 ++ { 'r', RLIMIT_RTPRIO, 1, "max rt priority", (char *)NULL},
787 ++#endif /* RLIMIT_RTPRIO */
788 + #ifdef RLIMIT_STACK
789 + { 's', RLIMIT_STACK, 1024, "stack size", "kbytes" },
790 + #endif
791 +@@ -221,6 +238,9 @@
792 + #ifdef RLIMIT_SWAP
793 + { 'w', RLIMIT_SWAP, 1024, "swap size", "kbytes" },
794 + #endif
795 ++#ifdef RLIMIT_LOCKS
796 ++ { 'x', RLIMIT_LOCKS, 1, "file locks", (char *)NULL},
797 ++#endif
798 + { -1, -1, -1, (char *)NULL, (char *)NULL }
799 + };
800 + #define NCMDS (sizeof(limits) / sizeof(limits[0]))
801 +@@ -647,11 +667,11 @@
802 +
803 + for (i = 0; limits[i].option > 0; i++)
804 + {
805 +- if (get_limit (i, &softlim, &hardlim) < 0)
806 ++ if (get_limit (i, &softlim, &hardlim) == 0)
807 ++ printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);
808 ++ else if (errno != EINVAL)
809 + builtin_error ("%s: cannot get limit: %s", limits[i].description,
810 + strerror (errno));
811 +- else
812 +- printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1);
813 + }
814 + }
815 +
816 +@@ -670,7 +690,7 @@
817 + else
818 + sprintf (unitstr, "(-%c) ", limits[limind].option);
819 +
820 +- printf ("%-18s %16s", limits[limind].description, unitstr);
821 ++ printf ("%-20s %16s", limits[limind].description, unitstr);
822 + }
823 + if (curlim == RLIM_INFINITY)
824 + puts ("unlimited");
825 +--- bash-3.0/doc/bashref.texi
826 ++++ bash-3.0/doc/bashref.texi
827 +@@ -3793,7 +3793,7 @@
828 + @item ulimit
829 + @btindex ulimit
830 + @example
831 +-ulimit [-acdflmnpstuvSH] [@var{limit}]
832 ++ulimit [-acdeflmnpqrstuvxSH] [@var{limit}]
833 + @end example
834 + @code{ulimit} provides control over the resources available to processes
835 + started by the shell, on systems that allow such control. If an
836 +@@ -3814,9 +3814,15 @@
837 + @item -d
838 + The maximum size of a process's data segment.
839 +
840 ++@item -e
841 ++The maximum scheduling priority.
842 ++
843 + @item -f
844 + The maximum size of files created by the shell.
845 +
846 ++@item -i
847 ++The maximum number of pending signals.
848 ++
849 + @item -l
850 + The maximum size that may be locked into memory.
851 +
852 +@@ -3829,6 +3835,12 @@
853 + @item -p
854 + The pipe buffer size.
855 +
856 ++@item -q
857 ++The maximum number of bytes in POSIX message queues.
858 ++
859 ++@item -r
860 ++The maximum RT priority.
861 ++
862 + @item -s
863 + The maximum stack size.
864 +
865 +@@ -3841,6 +3853,9 @@
866 + @item -v
867 + The maximum amount of virtual memory available to the process.
868 +
869 ++@item -x
870 ++The maximum amount of file locks.
871 ++
872 + @end table
873 +
874 + If @var{limit} is given, it is the new value of the specified resource;
875 +--- bash-3.0/doc/bash.1
876 ++++ bash-3.0/doc/bash.1
877 +@@ -8362,7 +8362,7 @@
878 + returns true if any of the arguments are found, false if
879 + none are found.
880 + .TP
881 +-\fBulimit\fP [\fB\-SHacdflmnpstuv\fP [\fIlimit\fP]]
882 ++\fBulimit\fP [\fB\-SHacdefilmnpqrstuvx\fP [\fIlimit\fP]]
883 + Provides control over the resources available to the shell and to
884 + processes started by it, on systems that allow such control.
885 + The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is
886 +@@ -8398,9 +8398,15 @@
887 + .B \-d
888 + The maximum size of a process's data segment
889 + .TP
890 ++.B \-e
891 ++The maximum scheduling priority (`nice')
892 ++.TP
893 + .B \-f
894 + The maximum size of files created by the shell
895 + .TP
896 ++.B \-i
897 ++The maximum number of pending signals
898 ++.TP
899 + .B \-l
900 + The maximum size that may be locked into memory
901 + .TP
902 +@@ -8414,6 +8420,12 @@
903 + .B \-p
904 + The pipe size in 512-byte blocks (this may not be set)
905 + .TP
906 ++.B \-q
907 ++The maximum number of bytes in POSIX message queues
908 ++.TP
909 ++.B \-r
910 ++The maximum rt priority
911 ++.TP
912 + .B \-s
913 + The maximum stack size
914 + .TP
915 +@@ -8425,6 +8437,9 @@
916 + .TP
917 + .B \-v
918 + The maximum amount of virtual memory available to the shell
919 ++.TP
920 ++.B \-x
921 ++The maximum number of file locks
922 + .PD
923 + .PP
924 + If
925
926 diff --git a/app-shells/bash/files/bash-3.0-volatile-command.patch b/app-shells/bash/files/bash-3.0-volatile-command.patch
927 new file mode 100644
928 index 00000000000..8b89b35914b
929 --- /dev/null
930 +++ b/app-shells/bash/files/bash-3.0-volatile-command.patch
931 @@ -0,0 +1,16 @@
932 +Ripped from Debian
933 +
934 +# DP: current_command must be declared volatile to prevent assignments from
935 +# being optimized away as dead code. In reality, the use of setjmp/longjmp
936 +# makes it not dead code at all.
937 +
938 +--- eval.old 2003-12-18 23:44:15.000000000 -0500
939 ++++ eval.c 2005-10-03 01:59:31.000000000 -0400
940 +@@ -63,7 +63,7 @@
941 + reader_loop ()
942 + {
943 + int our_indirection_level;
944 +- COMMAND *current_command = (COMMAND *)NULL;
945 ++ COMMAND * volatile current_command = (COMMAND *)NULL;
946 +
947 + USE_VAR(current_command);