From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- app-shells/bash/files/autoconf-mktime-2.53.patch | 199 +++++++++++++++ app-shells/bash/files/autoconf-mktime-2.59.patch | 197 +++++++++++++++ app-shells/bash/files/bash-2.05b-destdir.patch | 28 ++ .../bash/files/bash-2.05b-empty-herestring.patch | 25 ++ .../bash/files/bash-2.05b-fix-job-warning.patch | 14 + app-shells/bash/files/bash-2.05b-jobs.patch | 28 ++ .../bash/files/bash-2.05b-parallel-build.patch | 15 ++ app-shells/bash/files/bash-2.05b-protos.patch | 25 ++ app-shells/bash/files/bash-2.05b-rbash.patch | 27 ++ app-shells/bash/files/bash-3.0-afs.patch | 20 ++ app-shells/bash/files/bash-3.0-crash.patch | 46 ++++ app-shells/bash/files/bash-3.0-darwin-conn.patch | 20 ++ .../bash/files/bash-3.0-histtimeformat.patch | 56 ++++ app-shells/bash/files/bash-3.0-jobs.patch | 56 ++++ app-shells/bash/files/bash-3.0-locale.patch | 112 ++++++++ app-shells/bash/files/bash-3.0-manpage.patch | 15 ++ app-shells/bash/files/bash-3.0-multibyteifs.patch | 281 +++++++++++++++++++++ app-shells/bash/files/bash-3.0-pgrp-pipe-fix.patch | 20 ++ app-shells/bash/files/bash-3.0-protos.patch | 68 +++++ app-shells/bash/files/bash-3.0-pwd.patch | 16 ++ app-shells/bash/files/bash-3.0-rbash.patch | 18 ++ .../bash/files/bash-3.0-read-builtin-pipe.patch | 20 ++ app-shells/bash/files/bash-3.0-read-memleak.patch | 15 ++ app-shells/bash/files/bash-3.0-strnlen.patch | 175 +++++++++++++ app-shells/bash/files/bash-3.0-subshell.patch | 39 +++ .../bash/files/bash-3.0-trap-fg-signals.patch | 23 ++ app-shells/bash/files/bash-3.0-ulimit.patch | 186 ++++++++++++++ .../bash/files/bash-3.0-volatile-command.patch | 16 ++ .../files/bash-3.1-dev-fd-buffer-overflow.patch | 16 ++ .../bash/files/bash-3.1-dev-fd-test-as-user.patch | 14 + .../bash/files/bash-3.1-fix-dash-login-shell.patch | 52 ++++ app-shells/bash/files/bash-3.1-protos.patch | 67 +++++ app-shells/bash/files/bash-3.1-ulimit.patch | 122 +++++++++ .../bash/files/bash-3.2-dev-fd-test-as-user.patch | 26 ++ .../bash/files/bash-3.2-ldflags-for-build.patch | 37 +++ app-shells/bash/files/bash-3.2-loadables.patch | 239 ++++++++++++++++++ app-shells/bash/files/bash-3.2-process-subst.patch | 12 + app-shells/bash/files/bash-3.2-protos.patch | 57 +++++ .../bash/files/bash-3.2-session-leader.patch | 65 +++++ app-shells/bash/files/bash-3.2-ulimit.patch | 13 + app-shells/bash/files/bash-4.0-configure.patch | 25 ++ .../bash/files/bash-4.0-ldflags-for-build.patch | 15 ++ .../bash/files/bash-4.0-negative-return.patch | 33 +++ .../bash/files/bash-4.0-parallel-build.patch | 65 +++++ app-shells/bash/files/bash-4.1-fbsd-eaccess.patch | 29 +++ .../bash/files/bash-4.1-parallel-build.patch | 23 ++ .../files/bash-4.2-dev-fd-buffer-overflow.patch | 46 ++++ .../bash/files/bash-4.2-execute-job-control.patch | 24 ++ app-shells/bash/files/bash-4.2-no-readline.patch | 19 ++ .../bash/files/bash-4.2-parallel-build.patch | 106 ++++++++ app-shells/bash/files/bash-4.2-read-retry.patch | 41 +++ .../bash/files/bash-4.2-speed-up-read-N.patch | 112 ++++++++ .../files/bash-4.3-append-process-segfault.patch | 18 ++ app-shells/bash/files/bash-4.3-arrayfunc.patch | 15 ++ app-shells/bash/files/bash-4.3-compat-lvl.patch | 13 + ....3-mapfile-improper-array-name-validation.patch | 13 + app-shells/bash/files/bash-4.3-protos.patch | 10 + .../bash/files/bash-4.4-popd-offset-overflow.patch | 30 +++ .../bash/files/bash-4.x-deferred-heredocs.patch | 47 ++++ app-shells/bash/files/bash_logout | 9 + app-shells/bash/files/bashrc | 113 +++++++++ app-shells/bash/files/dot-bash_logout | 6 + app-shells/bash/files/dot-bash_profile | 7 + app-shells/bash/files/dot-bashrc | 18 ++ 64 files changed, 3317 insertions(+) create mode 100644 app-shells/bash/files/autoconf-mktime-2.53.patch create mode 100644 app-shells/bash/files/autoconf-mktime-2.59.patch create mode 100644 app-shells/bash/files/bash-2.05b-destdir.patch create mode 100644 app-shells/bash/files/bash-2.05b-empty-herestring.patch create mode 100644 app-shells/bash/files/bash-2.05b-fix-job-warning.patch create mode 100644 app-shells/bash/files/bash-2.05b-jobs.patch create mode 100644 app-shells/bash/files/bash-2.05b-parallel-build.patch create mode 100644 app-shells/bash/files/bash-2.05b-protos.patch create mode 100644 app-shells/bash/files/bash-2.05b-rbash.patch create mode 100644 app-shells/bash/files/bash-3.0-afs.patch create mode 100644 app-shells/bash/files/bash-3.0-crash.patch create mode 100644 app-shells/bash/files/bash-3.0-darwin-conn.patch create mode 100644 app-shells/bash/files/bash-3.0-histtimeformat.patch create mode 100644 app-shells/bash/files/bash-3.0-jobs.patch create mode 100644 app-shells/bash/files/bash-3.0-locale.patch create mode 100644 app-shells/bash/files/bash-3.0-manpage.patch create mode 100644 app-shells/bash/files/bash-3.0-multibyteifs.patch create mode 100644 app-shells/bash/files/bash-3.0-pgrp-pipe-fix.patch create mode 100644 app-shells/bash/files/bash-3.0-protos.patch create mode 100644 app-shells/bash/files/bash-3.0-pwd.patch create mode 100644 app-shells/bash/files/bash-3.0-rbash.patch create mode 100644 app-shells/bash/files/bash-3.0-read-builtin-pipe.patch create mode 100644 app-shells/bash/files/bash-3.0-read-memleak.patch create mode 100644 app-shells/bash/files/bash-3.0-strnlen.patch create mode 100644 app-shells/bash/files/bash-3.0-subshell.patch create mode 100644 app-shells/bash/files/bash-3.0-trap-fg-signals.patch create mode 100644 app-shells/bash/files/bash-3.0-ulimit.patch create mode 100644 app-shells/bash/files/bash-3.0-volatile-command.patch create mode 100644 app-shells/bash/files/bash-3.1-dev-fd-buffer-overflow.patch create mode 100644 app-shells/bash/files/bash-3.1-dev-fd-test-as-user.patch create mode 100644 app-shells/bash/files/bash-3.1-fix-dash-login-shell.patch create mode 100644 app-shells/bash/files/bash-3.1-protos.patch create mode 100644 app-shells/bash/files/bash-3.1-ulimit.patch create mode 100644 app-shells/bash/files/bash-3.2-dev-fd-test-as-user.patch create mode 100644 app-shells/bash/files/bash-3.2-ldflags-for-build.patch create mode 100644 app-shells/bash/files/bash-3.2-loadables.patch create mode 100644 app-shells/bash/files/bash-3.2-process-subst.patch create mode 100644 app-shells/bash/files/bash-3.2-protos.patch create mode 100644 app-shells/bash/files/bash-3.2-session-leader.patch create mode 100644 app-shells/bash/files/bash-3.2-ulimit.patch create mode 100644 app-shells/bash/files/bash-4.0-configure.patch create mode 100644 app-shells/bash/files/bash-4.0-ldflags-for-build.patch create mode 100644 app-shells/bash/files/bash-4.0-negative-return.patch create mode 100644 app-shells/bash/files/bash-4.0-parallel-build.patch create mode 100644 app-shells/bash/files/bash-4.1-fbsd-eaccess.patch create mode 100644 app-shells/bash/files/bash-4.1-parallel-build.patch create mode 100644 app-shells/bash/files/bash-4.2-dev-fd-buffer-overflow.patch create mode 100644 app-shells/bash/files/bash-4.2-execute-job-control.patch create mode 100644 app-shells/bash/files/bash-4.2-no-readline.patch create mode 100644 app-shells/bash/files/bash-4.2-parallel-build.patch create mode 100644 app-shells/bash/files/bash-4.2-read-retry.patch create mode 100644 app-shells/bash/files/bash-4.2-speed-up-read-N.patch create mode 100644 app-shells/bash/files/bash-4.3-append-process-segfault.patch create mode 100644 app-shells/bash/files/bash-4.3-arrayfunc.patch create mode 100644 app-shells/bash/files/bash-4.3-compat-lvl.patch create mode 100644 app-shells/bash/files/bash-4.3-mapfile-improper-array-name-validation.patch create mode 100644 app-shells/bash/files/bash-4.3-protos.patch create mode 100644 app-shells/bash/files/bash-4.4-popd-offset-overflow.patch create mode 100644 app-shells/bash/files/bash-4.x-deferred-heredocs.patch create mode 100644 app-shells/bash/files/bash_logout create mode 100644 app-shells/bash/files/bashrc create mode 100644 app-shells/bash/files/dot-bash_logout create mode 100644 app-shells/bash/files/dot-bash_profile create mode 100644 app-shells/bash/files/dot-bashrc (limited to 'app-shells/bash/files') diff --git a/app-shells/bash/files/autoconf-mktime-2.53.patch b/app-shells/bash/files/autoconf-mktime-2.53.patch new file mode 100644 index 000000000000..7632b63f4f79 --- /dev/null +++ b/app-shells/bash/files/autoconf-mktime-2.53.patch @@ -0,0 +1,199 @@ +https://bugs.gentoo.org/220040 + +--- a/configure ++++ b/configure +@@ -12393,22 +12393,25 @@ else + #line $LINENO "configure" + #include "confdefs.h" + /* Test program from Paul Eggert and Tony Leneis. */ +-#if TIME_WITH_SYS_TIME ++#ifdef TIME_WITH_SYS_TIME + # include + # include + #else +-# if HAVE_SYS_TIME_H ++# ifdef HAVE_SYS_TIME_H + # include + # else + # include + # endif + #endif + +-#if HAVE_UNISTD_H ++#include ++#include ++ ++#ifdef HAVE_UNISTD_H + # include + #endif + +-#if !HAVE_ALARM ++#ifndef HAVE_ALARM + # define alarm(X) /* empty */ + #endif + +@@ -12416,6 +12419,7 @@ else + #undef putenv + + static time_t time_t_max; ++static time_t time_t_min; + + /* Values we'll use to set the TZ environment variable. */ + static const char *const tz_strings[] = { +@@ -12424,9 +12428,9 @@ static const char *const tz_strings[] = { + }; + #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) + +-/* Fail if mktime fails to convert a date in the spring-forward gap. ++/* Return 0 if mktime fails to convert a date in the spring-forward gap. + Based on a problem report from Andreas Jaeger. */ +-static void ++static int + spring_forward_gap () + { + /* glibc (up to about 1998-10-07) failed this test. */ +@@ -12445,23 +12449,27 @@ spring_forward_gap () + tm.tm_min = 0; + tm.tm_sec = 0; + tm.tm_isdst = -1; +- if (mktime (&tm) == (time_t)-1) +- exit (1); ++ return mktime (&tm) != (time_t) -1; + } + +-static void +-mktime_test (now) ++static int ++mktime_test1 (now) + time_t now; + { + struct tm *lt; +- if ((lt = localtime (&now)) && mktime (lt) != now) +- exit (1); +- now = time_t_max - now; +- if ((lt = localtime (&now)) && mktime (lt) != now) +- exit (1); ++ return ! (lt = localtime (&now)) || mktime (lt) == now; + } + +-static void ++static int ++mktime_test (now) ++ time_t now; ++{ ++ return (mktime_test1 (now) ++ && mktime_test1 ((time_t) (time_t_max - now)) ++ && mktime_test1 ((time_t) (time_t_min + now))); ++} ++ ++static int + irix_6_4_bug () + { + /* Based on code from Ariel Faigon. */ +@@ -12474,11 +12482,10 @@ irix_6_4_bug () + tm.tm_sec = 0; + tm.tm_isdst = -1; + mktime (&tm); +- if (tm.tm_mon != 2 || tm.tm_mday != 31) +- exit (1); ++ return tm.tm_mon == 2 && tm.tm_mday == 31; + } + +-static void ++static int + bigtime_test (j) + int j; + { +@@ -12500,8 +12507,39 @@ bigtime_test (j) + && lt->tm_wday == tm.tm_wday + && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) + == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) +- exit (1); ++ return 0; + } ++ return 1; ++} ++ ++static int ++year_2050_test () ++{ ++ /* The correct answer for 2050-02-01 00:00:00 in Pacific time, ++ ignoring leap seconds. */ ++ unsigned long int answer = 2527315200UL; ++ ++ struct tm tm; ++ time_t t; ++ tm.tm_year = 2050 - 1900; ++ tm.tm_mon = 2 - 1; ++ tm.tm_mday = 1; ++ tm.tm_hour = tm.tm_min = tm.tm_sec = 0; ++ tm.tm_isdst = -1; ++ ++ /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" ++ instead of "TZ=America/Vancouver" in order to detect the bug even ++ on systems that don't support the Olson extension, or don't have the ++ full zoneinfo tables installed. */ ++ putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); ++ ++ t = mktime (&tm); ++ ++ /* Check that the result is either a failure, or close enough ++ to the correct answer that we can assume the discrepancy is ++ due to leap seconds. */ ++ return (t == (time_t) -1 ++ || (0 < t && answer - 120 <= t && t <= answer + 120)); + } + + int +@@ -12515,9 +12553,15 @@ main () + isn't worth using anyway. */ + alarm (60); + +- for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) +- continue; +- time_t_max--; ++ for (;;) ++ { ++ t = (time_t_max << 1) + 1; ++ if (t <= time_t_max) ++ break; ++ time_t_max = t; ++ } ++ time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max; ++ + delta = time_t_max / 997; /* a suitable prime number */ + for (i = 0; i < N_STRINGS; i++) + { +@@ -12525,17 +12569,22 @@ main () + putenv (tz_strings[i]); + + for (t = 0; t <= time_t_max - delta; t += delta) +- mktime_test (t); +- mktime_test ((time_t) 60 * 60); +- mktime_test ((time_t) 60 * 60 * 24); +- +- for (j = 1; 0 < j; j *= 2) +- bigtime_test (j); +- bigtime_test (j - 1); ++ if (! mktime_test (t)) ++ return 1; ++ if (! (mktime_test ((time_t) 1) ++ && mktime_test ((time_t) (60 * 60)) ++ && mktime_test ((time_t) (60 * 60 * 24)))) ++ return 1; ++ ++ for (j = 1; ; j <<= 1) ++ if (! bigtime_test (j)) ++ return 1; ++ else if (INT_MAX / 2 < j) ++ break; ++ if (! bigtime_test (INT_MAX)) ++ return 1; + } +- irix_6_4_bug (); +- spring_forward_gap (); +- exit (0); ++ return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); + } + _ACEOF + rm -f conftest$ac_exeext diff --git a/app-shells/bash/files/autoconf-mktime-2.59.patch b/app-shells/bash/files/autoconf-mktime-2.59.patch new file mode 100644 index 000000000000..3ac3ad1da867 --- /dev/null +++ b/app-shells/bash/files/autoconf-mktime-2.59.patch @@ -0,0 +1,197 @@ +http://bugs.gentoo.org/220040 +--- configure ++++ configure +@@ -5299,26 +6059,25 @@ + cat >>conftest.$ac_ext <<_ACEOF + /* end confdefs.h. */ + /* Test program from Paul Eggert and Tony Leneis. */ +-#if TIME_WITH_SYS_TIME ++#ifdef TIME_WITH_SYS_TIME + # include + # include + #else +-# if HAVE_SYS_TIME_H ++# ifdef HAVE_SYS_TIME_H + # include + # else + # include + # endif + #endif + +-#if HAVE_STDLIB_H +-# include +-#endif ++#include ++#include + +-#if HAVE_UNISTD_H ++#ifdef HAVE_UNISTD_H + # include + #endif + +-#if !HAVE_ALARM ++#ifndef HAVE_ALARM + # define alarm(X) /* empty */ + #endif + +@@ -5335,9 +6094,9 @@ + }; + #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) + +-/* Fail if mktime fails to convert a date in the spring-forward gap. ++/* Return 0 if mktime fails to convert a date in the spring-forward gap. + Based on a problem report from Andreas Jaeger. */ +-static void ++static int + spring_forward_gap () + { + /* glibc (up to about 1998-10-07) failed this test. */ +@@ -5356,29 +6115,27 @@ + tm.tm_min = 0; + tm.tm_sec = 0; + tm.tm_isdst = -1; +- if (mktime (&tm) == (time_t)-1) +- exit (1); ++ return mktime (&tm) != (time_t) -1; + } + +-static void ++static int + mktime_test1 (now) + time_t now; + { + struct tm *lt; +- if ((lt = localtime (&now)) && mktime (lt) != now) +- exit (1); ++ return ! (lt = localtime (&now)) || mktime (lt) == now; + } + +-static void ++static int + mktime_test (now) + time_t now; + { +- mktime_test1 (now); +- mktime_test1 ((time_t) (time_t_max - now)); +- mktime_test1 ((time_t) (time_t_min + now)); ++ return (mktime_test1 (now) ++ && mktime_test1 ((time_t) (time_t_max - now)) ++ && mktime_test1 ((time_t) (time_t_min + now))); + } + +-static void ++static int + irix_6_4_bug () + { + /* Based on code from Ariel Faigon. */ +@@ -5391,11 +6148,10 @@ + tm.tm_sec = 0; + tm.tm_isdst = -1; + mktime (&tm); +- if (tm.tm_mon != 2 || tm.tm_mday != 31) +- exit (1); ++ return tm.tm_mon == 2 && tm.tm_mday == 31; + } + +-static void ++static int + bigtime_test (j) + int j; + { +@@ -5417,8 +6173,39 @@ + && lt->tm_wday == tm.tm_wday + && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) + == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) +- exit (1); ++ return 0; + } ++ return 1; ++} ++ ++static int ++year_2050_test () ++{ ++ /* The correct answer for 2050-02-01 00:00:00 in Pacific time, ++ ignoring leap seconds. */ ++ unsigned long int answer = 2527315200UL; ++ ++ struct tm tm; ++ time_t t; ++ tm.tm_year = 2050 - 1900; ++ tm.tm_mon = 2 - 1; ++ tm.tm_mday = 1; ++ tm.tm_hour = tm.tm_min = tm.tm_sec = 0; ++ tm.tm_isdst = -1; ++ ++ /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" ++ instead of "TZ=America/Vancouver" in order to detect the bug even ++ on systems that don't support the Olson extension, or don't have the ++ full zoneinfo tables installed. */ ++ putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); ++ ++ t = mktime (&tm); ++ ++ /* Check that the result is either a failure, or close enough ++ to the correct answer that we can assume the discrepancy is ++ due to leap seconds. */ ++ return (t == (time_t) -1 ++ || (0 < t && answer - 120 <= t && t <= answer + 120)); + } + + int +@@ -5432,12 +6219,15 @@ + isn't worth using anyway. */ + alarm (60); + +- for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) +- continue; +- time_t_max--; +- if ((time_t) -1 < 0) +- for (time_t_min = -1; (time_t) (time_t_min * 2) < 0; time_t_min *= 2) +- continue; ++ for (;;) ++ { ++ t = (time_t_max << 1) + 1; ++ if (t <= time_t_max) ++ break; ++ time_t_max = t; ++ } ++ time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max; ++ + delta = time_t_max / 997; /* a suitable prime number */ + for (i = 0; i < N_STRINGS; i++) + { +@@ -5445,18 +6235,22 @@ + putenv (tz_strings[i]); + + for (t = 0; t <= time_t_max - delta; t += delta) +- mktime_test (t); +- mktime_test ((time_t) 1); +- mktime_test ((time_t) (60 * 60)); +- mktime_test ((time_t) (60 * 60 * 24)); +- +- for (j = 1; 0 < j; j *= 2) +- bigtime_test (j); +- bigtime_test (j - 1); ++ if (! mktime_test (t)) ++ return 1; ++ if (! (mktime_test ((time_t) 1) ++ && mktime_test ((time_t) (60 * 60)) ++ && mktime_test ((time_t) (60 * 60 * 24)))) ++ return 1; ++ ++ for (j = 1; ; j <<= 1) ++ if (! bigtime_test (j)) ++ return 1; ++ else if (INT_MAX / 2 < j) ++ break; ++ if (! bigtime_test (INT_MAX)) ++ return 1; + } +- irix_6_4_bug (); +- spring_forward_gap (); +- exit (0); ++ return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); + } + _ACEOF + rm -f conftest$ac_exeext diff --git a/app-shells/bash/files/bash-2.05b-destdir.patch b/app-shells/bash/files/bash-2.05b-destdir.patch new file mode 100644 index 000000000000..a1089d293c16 --- /dev/null +++ b/app-shells/bash/files/bash-2.05b-destdir.patch @@ -0,0 +1,28 @@ +support DESTDIR install + +--- bash-2.05b/Makefile.in ++++ bash-2.05b/Makefile.in +@@ -20,16 +20,16 @@ + all: .made + + # Include some boilerplate Gnu makefile definitions. +-prefix = @prefix@ ++prefix = $(DESTDIR)@prefix@ + +-exec_prefix = @exec_prefix@ +-bindir = @bindir@ +-libdir = @libdir@ +-infodir = @infodir@ +-includedir = @includedir@ ++exec_prefix = $(DESTDIR)@exec_prefix@ ++bindir = $(DESTDIR)@bindir@ ++libdir = $(DESTDIR)@libdir@ ++infodir = $(DESTDIR)@infodir@ ++includedir = $(DESTDIR)@includedir@ + datadir = @datadir@ + +-mandir = @mandir@ ++mandir = $(DESTDIR)@mandir@ + manpfx = man + + man1ext = .1 diff --git a/app-shells/bash/files/bash-2.05b-empty-herestring.patch b/app-shells/bash/files/bash-2.05b-empty-herestring.patch new file mode 100644 index 000000000000..db868c49aea7 --- /dev/null +++ b/app-shells/bash/files/bash-2.05b-empty-herestring.patch @@ -0,0 +1,25 @@ +################################################################### +# Added by Tavis Ormandy 01/05/2003 +# Reproduce with +# +# $ xargs <<< ${EMTPY_VARIABLE} +# Segmentation fault. +# +# note: bash will still give you a "\n" with this patch, but this is +# standard behaviour, if you need proof: +# +# $ wc -l <<< "" +############################### + +--- bash-2.05b/redir.c ++++ bash-2.05b/redir.c +@@ -263,7 +263,7 @@ + int herelen, n, e; + + herestr = expand_string_to_string (redirectee->word, 0); +- herelen = strlen (herestr); ++ herelen = (herestr == NULL) ? 0 : strlen (herestr); + + n = write (fd, herestr, herelen); + if (n == herelen) + { diff --git a/app-shells/bash/files/bash-2.05b-fix-job-warning.patch b/app-shells/bash/files/bash-2.05b-fix-job-warning.patch new file mode 100644 index 000000000000..fcec078d3d0c --- /dev/null +++ b/app-shells/bash/files/bash-2.05b-fix-job-warning.patch @@ -0,0 +1,14 @@ +fix obvious error: +common.c:247:5: warning: format '%s' expects a matching 'char *' argument [-Wformat=] + +--- a/builtins/common.c ++++ b/builtins/common.c +@@ -244,7 +244,7 @@ + char *s; + { + if (s) +- builtin_error ("%s: no job control"); ++ builtin_error ("%s: no job control", s); + else + builtin_error ("no job control"); + } diff --git a/app-shells/bash/files/bash-2.05b-jobs.patch b/app-shells/bash/files/bash-2.05b-jobs.patch new file mode 100644 index 000000000000..4ed475eab799 --- /dev/null +++ b/app-shells/bash/files/bash-2.05b-jobs.patch @@ -0,0 +1,28 @@ +Fix using bash with post-20040808 glibc ebuilds (from fedora) + +--- bash-2.05b/jobs.c ++++ bash-2.05b/jobs.c +@@ -2423,6 +2423,7 @@ + PROCESS *child; + pid_t pid; + int call_set_current, last_stopped_job, job, children_exited, waitpid_flags; ++ static int wcontinued_not_supported = 0; + + call_set_current = children_exited = 0; + last_stopped_job = NO_JOB; +@@ -2436,7 +2437,15 @@ + : 0; + if (sigchld || block == 0) + waitpid_flags |= WNOHANG; ++ retry: ++ if (wcontinued_not_supported) ++ waitpid_flags &= ~WCONTINUED; + pid = WAITPID (-1, &status, waitpid_flags); ++ if (pid == -1 && errno == EINVAL) ++ { ++ wcontinued_not_supported = 1; ++ goto retry; ++ } + + /* The check for WNOHANG is to make sure we decrement sigchld only + if it was non-zero before we called waitpid. */ diff --git a/app-shells/bash/files/bash-2.05b-parallel-build.patch b/app-shells/bash/files/bash-2.05b-parallel-build.patch new file mode 100644 index 000000000000..382ffd6dfd5e --- /dev/null +++ b/app-shells/bash/files/bash-2.05b-parallel-build.patch @@ -0,0 +1,15 @@ +Fix parallel make + +http://bugs.gentoo.org/41002 + +--- a/Makefile.in ++++ b/Makefile.in +@@ -604,7 +604,7 @@ + + config.h: stamp-h + +-stamp-h: config.status $(srcdir)/config.h.in $(srcdir)/config-top.h $(srcdir)/config-bot.h ++stamp-h: version.h config.status $(srcdir)/config.h.in $(srcdir)/config-top.h $(srcdir)/config-bot.h + CONFIG_FILES= CONFIG_HEADERS=config.h $(SHELL) ./config.status + + config.status: $(srcdir)/configure diff --git a/app-shells/bash/files/bash-2.05b-protos.patch b/app-shells/bash/files/bash-2.05b-protos.patch new file mode 100644 index 000000000000..2a42ced54711 --- /dev/null +++ b/app-shells/bash/files/bash-2.05b-protos.patch @@ -0,0 +1,25 @@ +move prototypes around so they show up when needed + +--- a/externs.h ++++ b/externs.h +@@ -327,6 +327,9 @@ + #undef xstrchr + extern char *xstrchr __P((const char *, int)); + ++/* declarations for functions defined in lib/sh/zcatfd.c */ ++extern int zcatfd __P((int, int, char *)); ++ + /* declarations for functions defined in lib/sh/zread.c */ + extern ssize_t zread __P((int, char *, size_t)); + extern ssize_t zreadintr __P((int, char *, size_t)); +--- a/jobs.h ++++ b/jobs.h +@@ -175,6 +175,8 @@ + extern void ignore_tty_job_signals __P((void)); + extern void default_tty_job_signals __P((void)); + ++extern void close_pgrp_pipe __P((void)); ++ + #if defined (JOB_CONTROL) + extern int job_control; + #endif diff --git a/app-shells/bash/files/bash-2.05b-rbash.patch b/app-shells/bash/files/bash-2.05b-rbash.patch new file mode 100644 index 000000000000..19b89ca35e2f --- /dev/null +++ b/app-shells/bash/files/bash-2.05b-rbash.patch @@ -0,0 +1,27 @@ +Fix broken rbash functionality when used as a login shell via /etc/passwd + +http://bugs.gentoo.org/26854 +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=170298 + +Backported from bash-3.1 + +--- bash-2.05b/shell.c ++++ bash-2.05b/shell.c +@@ -1065,6 +1099,8 @@ + if (restricted) + return 1; + temp = base_pathname (name); ++ if (*temp == '-') ++ temp++; + return (STREQ (temp, RESTRICTED_SHELL_NAME)); + } + +@@ -1082,6 +1118,8 @@ + char *temp; + + temp = base_pathname (name); ++ if (*temp == '-') ++ temp++; + if (restricted || (STREQ (temp, RESTRICTED_SHELL_NAME))) + { + set_var_read_only ("PATH"); diff --git a/app-shells/bash/files/bash-3.0-afs.patch b/app-shells/bash/files/bash-3.0-afs.patch new file mode 100644 index 000000000000..f07371c39eb4 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-afs.patch @@ -0,0 +1,20 @@ +Ripped from Fedora + +- Fixed AFS support for output redirection, so that the correct errors + are reported for other filesystems (bug #155373). + +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=155373 + +--- bash-3.0/redir.c.afs 2005-04-20 09:16:15.000000000 +0100 ++++ bash-3.0/redir.c 2005-04-20 09:16:58.000000000 +0100 +@@ -596,7 +596,9 @@ + fd = open (filename, flags, mode); + #if defined (AFS) + if ((fd < 0) && (errno == EACCES)) +- fd = open (filename, flags & ~O_CREAT, mode); ++ if ((fd = open (filename, flags & ~O_CREAT, mode)) < 0) ++ /* Restore previous errno. */ ++ errno = EACCES; + #endif /* AFS */ + } + diff --git a/app-shells/bash/files/bash-3.0-crash.patch b/app-shells/bash/files/bash-3.0-crash.patch new file mode 100644 index 000000000000..984e85d82ed3 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-crash.patch @@ -0,0 +1,46 @@ +> Machine Type: i686-pc-linux-gnu +> +> Bash Version: 3.0 +> Patch Level: 0 +> Release Status: release +> +> Description: +> GNU bash, version 3.00.0(1)-release (i686-pc-linux-gnu) +> (and +> GNU bash, version 2.05b.0(1)-release (i386-redhat-linux-gnu) +> +> dumps a core because of a null pointer "in make_bare_word +> at make_cmd.c:90" (see gdb output below) + +Thanks for the report. Here's a quick fix: + +*** arrayfunc.c~ Sat Nov 6 15:08:29 2004 +--- arrayfunc.c Mon Jan 31 11:56:21 2005 +*************** +*** 709,713 **** + return ((char *)NULL); + } +! else if (var == 0) + return ((char *)NULL); + else if (array_p (var) == 0) +--- 709,713 ---- + return ((char *)NULL); + } +! else if (var == 0 || value_cell (var) == 0) + return ((char *)NULL); + else if (array_p (var) == 0) + + +Chet + +-- +``The lyf so short, the craft so long to lerne.'' - Chaucer +( ``Discere est Dolere'' -- chet ) + Live...Laugh...Love +Chet Ramey, ITS, CWRU chet@po.cwru.edu http://tiswww.tis.cwru.edu/~chet/ + + +_______________________________________________ +Bug-bash mailing list +Bug-bash@gnu.org +http://lists.gnu.org/mailman/listinfo/bug-bash diff --git a/app-shells/bash/files/bash-3.0-darwin-conn.patch b/app-shells/bash/files/bash-3.0-darwin-conn.patch new file mode 100644 index 000000000000..f83e4c3f701d --- /dev/null +++ b/app-shells/bash/files/bash-3.0-darwin-conn.patch @@ -0,0 +1,20 @@ +Sune Foldager writes: +On Darwin (Mac OS X), bash incorrectly assumed that it has been called over a +network connection (such as ssh, rsh etc.), when stdin stems from the pipe() +system call. This is because bash's heuristic code for determining if it's +been started over a net connection is incorrect on Darwin kernels. + +http://bugs.gentoo.org/79124 + +--- a/lib/sh/netconn.c ++++ b/lib/sh/netconn.c +@@ -53,7 +53,8 @@ + l = sizeof(sa); + rv = getpeername(fd, &sa, &l); + /* Solaris 2.5 getpeername() returns EINVAL if the fd is not a socket. */ +- return ((rv < 0 && (errno == ENOTSOCK || errno == EINVAL)) ? 0 : 1); ++ /* Darwin 7.7.0 getpeername() returns ENOTCONN if the fd was created with pipe(). */ ++ return ((rv < 0 && (errno == ENOTSOCK || errno == ENOTCONN || errno == EINVAL)) ? 0 : 1); + #else /* !HAVE_GETPEERNAME || SVR4_2 || __BEOS__ */ + # if defined (SVR4) || defined (SVR4_2) + /* Sockets on SVR4 and SVR4.2 are character special (streams) devices. */ diff --git a/app-shells/bash/files/bash-3.0-histtimeformat.patch b/app-shells/bash/files/bash-3.0-histtimeformat.patch new file mode 100644 index 000000000000..b910600fd896 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-histtimeformat.patch @@ -0,0 +1,56 @@ +Ripped from Debian + +http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00008.html + +From: Enrique Perez-Terron +To: bug-bash@gnu.org +Subject: When using HISTTIMEFORMAT, the date and the command are run + together. +Date: Sun, 01 Aug 2004 18:36:45 +0200 + +Configuration Information [Automatically generated, do not change]: +Machine: i586 +OS: linux-gnu +Compiler: gcc +Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i586' +-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i586-pc-linux-gnu' +-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/share/locale' +-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib +-g -O2 +uname output: Linux arabia.home.lan 2.6.6-1.435.2.3 #1 Thu Jul 1 +09:11:28 EDT 2004 i586 i586 i386 GNU/Linux +Machine Type: i586-pc-linux-gnu + +# DP: Add space separating the time and the command in the +# DP: output from the history builtin command. + +Bash Version: 3.0 +Patch Level: 0 +Release Status: release + +Description: + There is no space separating the time and the command in the + output from the history builtin command. + +Repeat-By: + $ export HISTTIMEFORMAT=_A_format_string_ + $ history 3 + 997 _A_format_string_echo $BASH_VERSION + 998 _A_format_string_export HISTTIMEFORMAT=_A_format_string_ + 999 _A_format_string_history 3 + +Fix: +--- ./builtins/history.def.orig 2003-12-20 00:02:09.000000000 +0100 ++++ ./builtins/history.def 2004-08-01 18:18:02.652720102 +0200 +@@ -287,9 +287,10 @@ + QUIT; + + timestr = (histtimefmt && *histtimefmt) ? histtime (hlist[i], histtimefmt) : (char *)NULL; +- printf ("%5d%c %s%s\n", i + history_base, ++ printf ("%5d%c %s%s%s\n", i + history_base, + histdata(i) ? '*' : ' ', + ((timestr && *timestr) ? timestr : ""), ++ ((timestr && *timestr) ? " " : ""), + histline(i)); + i++; + } diff --git a/app-shells/bash/files/bash-3.0-jobs.patch b/app-shells/bash/files/bash-3.0-jobs.patch new file mode 100644 index 000000000000..72c149c71cf5 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-jobs.patch @@ -0,0 +1,56 @@ +Ripped from Fedora + +* Wed Sep 8 2004 Tim Waugh 3.0-13 +- Check for EINVAL from waitpid() and avoid WCONTINUED in that case. +- Fixed jobs4 test. + +From: Tim Waugh +Subject: [patch] bash-3.0: avoid WCONTINUED if invalid +Date: Wed, 8 Sep 2004 16:52:38 +0100 +User-agent: Mutt/1.4.1i + +Hi, + +GNU libc defines WCONTINUED, but (at least on Linux 2.4.x kernels) +waitpid() returns -1 with errno set to EINVAL if WCONTINUED is +supplied in options. + +Here is a patch to retry without WCONTINUED set in that case. + +Tim. + +--- bash-3.0/tests/jobs4.sub ++++ bash-3.0/tests/jobs4.sub +@@ -18,5 +18,5 @@ + + wait + +-cat & ++sleep 100 & + kill -1 %% && echo i killed it || echo could not kill it +--- bash-3.0/jobs.c ++++ bash-3.0/jobs.c +@@ -2475,6 +2475,7 @@ + PROCESS *child; + pid_t pid; + int call_set_current, last_stopped_job, job, children_exited, waitpid_flags; ++ static int wcontinued_not_supported = 0; + + call_set_current = children_exited = 0; + last_stopped_job = NO_JOB; +@@ -2488,7 +2489,15 @@ + : 0; + if (sigchld || block == 0) + waitpid_flags |= WNOHANG; ++ retry: ++ if (wcontinued_not_supported) ++ waitpid_flags &= ~WCONTINUED; + pid = WAITPID (-1, &status, waitpid_flags); ++ if (pid == -1 && errno == EINVAL) ++ { ++ wcontinued_not_supported = 1; ++ goto retry; ++ } + + /* The check for WNOHANG is to make sure we decrement sigchld only + if it was non-zero before we called waitpid. */ diff --git a/app-shells/bash/files/bash-3.0-locale.patch b/app-shells/bash/files/bash-3.0-locale.patch new file mode 100644 index 000000000000..ea1ef3deae36 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-locale.patch @@ -0,0 +1,112 @@ +Ripped from SuSe + +http://lists.gnu.org/archive/html/bug-bash/2004-08/msg00005.html + +From: schwab@suse.de +To: bug-bash@gnu.org +Subject: HISTTIMEFORMAT doesn't track locale changes +Date: Sun, 1 Aug 2004 11:14:00 +0200 (CEST) + +Configuration Information [Automatically generated, do not change]: +Machine: ia64 +OS: linux-gnu +Compiler: gcc +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 +uname output: Linux sykes 2.6.5-22-default #1 SMP Fri Jul 2 13:43:23 UTC 2004 ia64 ia64 ia64 GNU/Linux +Machine Type: ia64-unknown-linux-gnu + +Bash Version: 3.0 +Patch Level: 0 +Release Status: release + +Description: +Bash doesn't use the current locale when formatting HISTTIMEFORMAT. + +Repeat-By: +sykes:/tmp/bash/Build/:[0]$ locale +LANG=de_DE.UTF-8 +LC_CTYPE="de_DE.UTF-8" +LC_NUMERIC=POSIX +LC_TIME=POSIX +LC_COLLATE=POSIX +LC_MONETARY="de_DE.UTF-8" +LC_MESSAGES=en_US.UTF-8 +LC_PAPER="de_DE.UTF-8" +LC_NAME="de_DE.UTF-8" +LC_ADDRESS="de_DE.UTF-8" +LC_TELEPHONE="de_DE.UTF-8" +LC_MEASUREMENT="de_DE.UTF-8" +LC_IDENTIFICATION="de_DE.UTF-8" +LC_ALL= +sykes:/tmp/bash/Build/:[0]$ history 1 + 1502 history 1 +sykes:/tmp/bash/Build/:[0]$ HISTTIMEFORMAT=%c +sykes:/tmp/bash/Build/:[0]$ history 1 + 1504 Sun Aug 1 10:56:59 2004history 1 +sykes:/tmp/bash/Build/:[0]$ export LC_TIME=$LANG +sykes:/tmp/bash/Build/:[0]$ history 1 + 1506 Sun Aug 1 10:57:24 2004history 1 + +--- bash-3.0/locale.c ++++ bash-3.0/locale.c +@@ -71,9 +71,10 @@ set_default_locale () + textdomain (PACKAGE); + } + +-/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES and LC_NUMERIC +- if they are not specified in the environment, but LC_ALL is. This +- should be called from main() after parsing the environment. */ ++/* Set default values for LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_NUMERIC ++ and LC_TIME if they are not specified in the environment, but LC_ALL ++ is. This should be called from main() after parsing the ++ environment. */ + void + set_default_locale_vars () + { +@@ -109,6 +110,12 @@ set_default_locale_vars () + setlocale (LC_NUMERIC, lc_all); + # endif /* LC_NUMERIC */ + ++# if defined (LC_TIME) ++ val = get_string_value ("LC_TIME"); ++ if (val == 0 && lc_all && *lc_all) ++ setlocale (LC_TIME, lc_all); ++# endif /* LC_TIME */ ++ + #endif /* HAVE_SETLOCALE */ + + val = get_string_value ("TEXTDOMAIN"); +@@ -213,6 +220,13 @@ set_locale_var (var, value) + return (setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC")) != 0); + # endif /* LC_NUMERIC */ + } ++ else if (var[3] == 'T' && var[4] == 'I') /* LC_TIME */ ++ { ++# if defined (LC_TIME) ++ if (lc_all == 0 || *lc_all == '\0') ++ return (setlocale (LC_TIME, get_locale_var ("LC_TIME")) != 0); ++# endif /* LC_TIME */ ++ } + #endif /* HAVE_SETLOCALE */ + + return (0); +@@ -285,6 +299,9 @@ reset_locale_vars () + # if defined (LC_NUMERIC) + setlocale (LC_NUMERIC, get_locale_var ("LC_NUMERIC")); + # endif ++# if defined (LC_TIME) ++ setlocale (LC_TIME, get_locale_var ("LC_TIME")); ++# endif + + locale_setblanks (); + +--- bash-3.0/variables.c ++++ bash-3.0/variables.c +@@ -3646,6 +3646,7 @@ static struct name_and_function special_ + { "LC_CTYPE", sv_locale }, + { "LC_MESSAGES", sv_locale }, + { "LC_NUMERIC", sv_locale }, ++ { "LC_TIME", sv_locale }, + + { "MAIL", sv_mail }, + { "MAILCHECK", sv_mail }, diff --git a/app-shells/bash/files/bash-3.0-manpage.patch b/app-shells/bash/files/bash-3.0-manpage.patch new file mode 100644 index 000000000000..08e3143e5422 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-manpage.patch @@ -0,0 +1,15 @@ +Ripped from Fedora + +fix obvious display bug + +--- bash-3.0/doc/bash.1 ++++ bash-3.0/doc/bash.1 +@@ -3929,7 +3929,7 @@ + .B SIGHUP + to all jobs when an interactive login shell exits. + .PP +-If \Bbash\fP is waiting for a command to complete and receives a signal ++If \fBbash\fP is waiting for a command to complete and receives a signal + for which a trap has been set, the trap will not be executed until + the command completes. + When \fBbash\fP is waiting for an asynchronous command via the \fBwait\fP diff --git a/app-shells/bash/files/bash-3.0-multibyteifs.patch b/app-shells/bash/files/bash-3.0-multibyteifs.patch new file mode 100644 index 000000000000..1e74832b638a --- /dev/null +++ b/app-shells/bash/files/bash-3.0-multibyteifs.patch @@ -0,0 +1,281 @@ +From: Tim Waugh +To: bug-bash@gnu.org +Subject: [patch] multibyte IFS values +Date: Tue, 24 Aug 2004 13:34:59 +0100 + +Hi, + +Here is a patch to address these problems: + +http://lists.gnu.org/archive/html/bug-bash/2004-07/msg00294.html +http://lists.gnu.org/archive/html/bug-bash/2004-07/msg00296.html + +It works well for me at least. + +Tim. + +--- bash-3.0/subst.c.multibyteifs 2004-08-20 15:22:48.366497771 +0100 ++++ bash-3.0/subst.c 2004-08-20 18:13:30.833624616 +0100 +@@ -124,7 +124,12 @@ + SHELL_VAR *ifs_var; + char *ifs_value; + unsigned char ifs_cmap[UCHAR_MAX + 1]; ++#if defined (HANDLE_MULTIBYTE) ++unsigned char ifs_firstc[MB_LEN_MAX]; ++size_t ifs_firstc_len; ++#else + unsigned char ifs_firstc; ++#endif + + /* Extern functions and variables from different files. */ + extern int last_command_exit_value, last_command_exit_signal; +@@ -862,8 +867,14 @@ + char *charlist; + { + register int i = *sindex; ++ size_t slen; ++#if defined (HANDLE_MULTIBYTE) ++ size_t clen; ++ wchar_t *wcharlist = NULL; ++#endif + int c; + char *temp; ++ DECLARE_MBSTATE; + + if (charlist[0] == '\'' && charlist[1] == '\0') + { +@@ -872,18 +883,65 @@ + return temp; + } + +- for (i = *sindex; c = string[i]; i++) ++ slen = strlen (string + *sindex) + *sindex; ++ i = *sindex; ++#if defined (HANDLE_MULTIBYTE) ++ clen = strlen (charlist); ++#endif ++ while ((c = string[i])) + { ++#if defined (HANDLE_MULTIBYTE) ++ size_t mblength; ++#endif ++ + if (c == CTLESC) + { +- i++; ++ i += 2; + continue; + } + ++#if defined (HANDLE_MULTIBYTE) ++ mblength = mblen (string + i, slen - i); ++ if (mblength > 1) ++ { ++ wchar_t wc; ++ size_t mblength = mbtowc (&wc, string + i, slen - i); ++ if (MB_INVALIDCH (mblength)) ++ { ++ if (MEMBER (c, charlist)) ++ break; ++ } ++ else ++ { ++ if (!wcharlist) ++ { ++ size_t len = mbstowcs (wcharlist, charlist, 0); ++ if (len == -1) ++ len = 0; ++ wcharlist = xmalloc (sizeof (wchar_t) * (len + 1)); ++ mbstowcs (wcharlist, charlist, 1 + len); ++ } ++ ++ if (wcschr (wcharlist, wc)) ++ { ++ break; ++ } ++ } ++ } ++ else ++#endif ++ + if (MEMBER (c, charlist)) + break; ++ ++ ADVANCE_CHAR (string, slen, i); + } + ++#if defined (HANDLE_MULTIBYTE) ++ if (wcharlist) ++ free (wcharlist); ++#endif ++ + temp = substring (string, *sindex, i); + *sindex = i; + +@@ -1456,11 +1514,36 @@ + d2 = 0; + if (delims) + { +- d2 = (char *)xmalloc (strlen (delims) + 1); +- for (i = ts = 0; delims[i]; i++) ++ size_t slength = strlen (delims); ++#if defined (HANDLE_MULTIBYTE) ++ size_t mblength = 1; ++ DECLARE_MBSTATE; ++#endif ++ ++ d2 = (char *)xmalloc (slength + 1); ++ i = ts = 0; ++ while (delims[i]) + { ++#if defined (HANDLE_MULTIBYTE) ++ mbstate_t state_bak = state; ++ mblength = mbrlen (delims + i, slength, &state); ++ ++ if (MB_INVALIDCH (mblength)) ++ state = state_bak; ++ else if (mblength != 1) ++ { ++ memcpy (d2 + ts, delims + i, mblength); ++ ts += mblength; ++ i += mblength; ++ slength -= mblength; ++ continue; ++ } ++#endif ++ + if (whitespace(delims[i]) == 0) + d2[ts++] = delims[i]; ++ i++; ++ slength--; + } + d2[ts] = '\0'; + } +@@ -1654,10 +1737,19 @@ + string_list_dollar_star (list) + WORD_LIST *list; + { ++#if defined (HANDLE_MULTIBYTE) ++ char sep[MB_CUR_MAX + 1]; ++#else + char sep[2]; ++#endif + ++#if defined (HANDLE_MULTIBYTE) ++ memcpy (sep, ifs_firstc, ifs_firstc_len); ++ sep[ifs_firstc_len] = '\0'; ++#else + sep[0] = ifs_firstc; + sep[1] = '\0'; ++#endif + + return (string_list_internal (list, sep)); + } +@@ -1676,14 +1768,41 @@ + WORD_LIST *list; + int quoted; + { +- char *ifs, sep[2]; ++ char *ifs; ++#if defined (HANDLE_MULTIBYTE) ++ char sep[MB_CUR_MAX + 1]; ++#else ++ char sep[2]; ++#endif + WORD_LIST *tlist; + + /* XXX this could just be ifs = ifs_value; */ + ifs = ifs_var ? value_cell (ifs_var) : (char *)0; + ++#if defined (HANDLE_MULTIBYTE) ++ if (ifs && *ifs) ++ { ++ size_t mblength = mblen (ifs, strnlen (ifs, MB_CUR_MAX)); ++ if (MB_INVALIDCH (mblength)) ++ { ++ sep[0] = *ifs; ++ sep[1] = '\0'; ++ } ++ else ++ { ++ memcpy (sep, ifs, mblength); ++ sep[mblength] = '\0'; ++ } ++ } ++ else ++ { ++ sep[0] = ' '; ++ sep[1] = '\0'; ++ } ++#else + sep[0] = (ifs == 0 || *ifs == 0) ? ' ' : *ifs; + sep[1] = '\0'; ++#endif + + tlist = ((quoted & (Q_HERE_DOCUMENT|Q_DOUBLE_QUOTES)) || (ifs && *ifs == 0)) + ? quote_list (list) +@@ -1732,6 +1851,7 @@ + WORD_DESC *t; + char *current_word, *s; + int sindex, sh_style_split, whitesep; ++ size_t slen = 0; + + if (!string || !*string) + return ((WORD_LIST *)NULL); +@@ -1805,7 +1925,12 @@ + + /* Move past the current separator character. */ + if (string[sindex]) +- sindex++; ++ { ++ DECLARE_MBSTATE; ++ if (!slen) ++ slen = strlen (string); ++ ADVANCE_CHAR (string, slen, sindex); ++ } + + /* Now skip sequences of space, tab, or newline characters if they are + in the list of separators. */ +@@ -6796,7 +6921,27 @@ + ifs_cmap[uc] = 1; + } + ++#if defined (HANDLE_MULTIBYTE) ++ if (!ifs_value) ++ { ++ ifs_firstc[0] = '\0'; ++ ifs_firstc_len = 1; ++ } ++ else ++ { ++ size_t ifs_len = strnlen (ifs_value, MB_CUR_MAX); ++ ifs_firstc_len = mblen (ifs_value, ifs_len); ++ if (MB_INVALIDCH (ifs_firstc_len)) ++ { ++ ifs_firstc[0] = '\0'; ++ ifs_firstc_len = 1; ++ } ++ else ++ memcpy (ifs_firstc, ifs_value, ifs_firstc_len); ++ } ++#else + ifs_firstc = ifs_value ? *ifs_value : 0; ++#endif + } + + char * +--- bash-3.0/subst.h.multibyteifs 2004-08-20 15:51:08.301074583 +0100 ++++ bash-3.0/subst.h 2004-08-20 15:51:39.070206473 +0100 +@@ -231,7 +231,12 @@ + extern SHELL_VAR *ifs_var; + extern char *ifs_value; + extern unsigned char ifs_cmap[]; ++#if defined (HANDLE_MULTIBYTE) ++extern unsigned char ifs_firstc[]; ++extern size_t ifs_firstc_len; ++#else + extern unsigned char ifs_firstc; ++#endif + + /* Evaluates to 1 if C is a character in $IFS. */ + #define isifs(c) (ifs_cmap[(unsigned char)(c)] != 0) diff --git a/app-shells/bash/files/bash-3.0-pgrp-pipe-fix.patch b/app-shells/bash/files/bash-3.0-pgrp-pipe-fix.patch new file mode 100644 index 000000000000..35b0b7d05924 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-pgrp-pipe-fix.patch @@ -0,0 +1,20 @@ +Fix an error when using pipes and PGRP_PIPE is enabled. +( exec 3>&1; : `echo >&3` ) +bash: 3: Bad file descriptor + +http://bugs.gentoo.org/92349 + +Patch from upstream + +*** jobs.c Wed Sep 8 11:08:16 2004 +--- jobs.c Thu Jun 30 17:21:26 2005 +*************** +*** 3456,3459 **** +--- 3901,3907 ---- + stop_making_children (); + start_pipeline (); ++ #if defined (PGRP_PIPE) ++ pipe_close (pgrp_pipe); ++ #endif + delete_all_jobs (0); + set_job_control (0); diff --git a/app-shells/bash/files/bash-3.0-protos.patch b/app-shells/bash/files/bash-3.0-protos.patch new file mode 100644 index 000000000000..b1337b203954 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-protos.patch @@ -0,0 +1,68 @@ +move prototypes around so they show up when needed + +--- a/externs.h ++++ b/externs.h +@@ -327,6 +327,9 @@ + #undef xstrchr + extern char *xstrchr __P((const char *, int)); + ++/* declarations for functions defined in lib/sh/zcatfd.c */ ++extern int zcatfd __P((int, int, char *)); ++ + /* declarations for functions defined in lib/sh/zread.c */ + extern ssize_t zread __P((int, char *, size_t)); + extern ssize_t zreadintr __P((int, char *, size_t)); +--- a/jobs.h ++++ b/jobs.h +@@ -175,6 +175,8 @@ + extern void ignore_tty_job_signals __P((void)); + extern void default_tty_job_signals __P((void)); + ++extern void close_pgrp_pipe __P((void)); ++ + #if defined (JOB_CONTROL) + extern int job_control; + #endif +--- a/general.c ++++ b/general.c +@@ -39,6 +39,8 @@ + #include "bashintl.h" + + #include "shell.h" ++#include "test.h" ++ + #include + + #if !defined (errno) +--- a/builtins/evalfile.c ++++ b/builtins/evalfile.c +@@ -39,6 +39,7 @@ + #include "../flags.h" + #include "../input.h" + #include "../execute_cmd.h" ++#include "../trap.h" + + #if defined (HISTORY) + # include "../bashhist.h" +--- a/lib/glob/strmatch.c ++++ b/lib/glob/strmatch.c +@@ -25,9 +25,6 @@ + #include "strmatch.h" + + extern int xstrmatch __P((char *, char *, int)); +-#if defined (HAVE_MULTIBYTE) +-extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int)); +-#endif + + int + strmatch (pattern, string, flags) +--- a/lib/glob/strmatch.h ++++ b/lib/glob/strmatch.h +@@ -57,6 +57,7 @@ + + #if HANDLE_MULTIBYTE + extern int wcsmatch __P((wchar_t *, wchar_t *, int)); ++extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int)); + #endif + + #endif /* _STRMATCH_H */ diff --git a/app-shells/bash/files/bash-3.0-pwd.patch b/app-shells/bash/files/bash-3.0-pwd.patch new file mode 100644 index 000000000000..77f0918fb4d8 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-pwd.patch @@ -0,0 +1,16 @@ +Ripped from Fedora + +* Tue Mar 15 2005 Tim Waugh 3.0-30 +- Fix PS1 expansion crash when PWD is unset (bg #151116). + +--- bash-3.0/parse.y.pwd 2005-03-15 14:22:36.000000000 +0000 ++++ bash-3.0/parse.y 2005-03-15 14:22:37.000000000 +0000 +@@ -4103,7 +4103,7 @@ + #define ROOT_PATH(x) ((x)[0] == '/' && (x)[1] == 0) + #define DOUBLE_SLASH_ROOT(x) ((x)[0] == '/' && (x)[1] == '/' && (x)[2] == 0) + /* Abbreviate \W as ~ if $PWD == $HOME */ +- if (c == 'W' && (((t = get_string_value ("HOME")) == 0) || STREQ (t, temp) == 0)) ++ if (c == 'W' && (((t = get_string_value ("HOME")) == 0) || STREQ (t, t_string) == 0)) + { + if (ROOT_PATH (t_string) == 0 && DOUBLE_SLASH_ROOT (t_string) == 0) + { diff --git a/app-shells/bash/files/bash-3.0-rbash.patch b/app-shells/bash/files/bash-3.0-rbash.patch new file mode 100644 index 000000000000..e804d20f06a9 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-rbash.patch @@ -0,0 +1,18 @@ +Fix broken rbash functionality when used as a login shell via /etc/passwd + +http://bugs.gentoo.org/26854 +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=170298 + +Backported from bash-3.1 + +--- bash-3.0/shell.c ++++ bash-3.0/shell.c +@@ -1089,6 +1099,8 @@ + if (restricted) + return 1; + temp = base_pathname (name); ++ if (*temp == '-') ++ temp++; + return (STREQ (temp, RESTRICTED_SHELL_NAME)); + } + diff --git a/app-shells/bash/files/bash-3.0-read-builtin-pipe.patch b/app-shells/bash/files/bash-3.0-read-builtin-pipe.patch new file mode 100644 index 000000000000..466e45ae3004 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-read-builtin-pipe.patch @@ -0,0 +1,20 @@ +Description: +When using 'read -u 3' or the like, and the pipe-buf already contains +more than one line, the first line is returned, and bytes up to the next +multiple of 128 are skipped. + +http://lists.gnu.org/archive/html/bug-bash/2005-03/msg00168.html +http://lists.gnu.org/archive/html/bug-bash/2005-03/msg00173.html +http://bugs.gentoo.org/show_bug.cgi?id=87093 + +--- builtins/read.def ++++ builtins/read.def +@@ -276,7 +276,7 @@ + input_is_tty = isatty (fd); + if (input_is_tty == 0) + #ifndef __CYGWIN__ +- input_is_pipe = (lseek (0, 0L, SEEK_CUR) < 0) && (errno == ESPIPE); ++ input_is_pipe = (lseek (fd, 0L, SEEK_CUR) < 0) && (errno == ESPIPE); + #else + input_is_pipe = 1; + #endif diff --git a/app-shells/bash/files/bash-3.0-read-memleak.patch b/app-shells/bash/files/bash-3.0-read-memleak.patch new file mode 100644 index 000000000000..6cb769f3af34 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-read-memleak.patch @@ -0,0 +1,15 @@ +Ripped from Fedora + +http://lists.gnu.org/archive/html/bug-bash/2005-12/msg00013.html +https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=173283 + +--- bash-3.0/builtins/read.def ++++ bash-3.0/builtins/read.def +@@ -461,6 +461,7 @@ + if (retval < 0) + { + builtin_error (_("read error: %d: %s"), fd, strerror (errno)); ++ run_unwind_frame ("read_builtin"); + return (EXECUTION_FAILURE); + } + #endif diff --git a/app-shells/bash/files/bash-3.0-strnlen.patch b/app-shells/bash/files/bash-3.0-strnlen.patch new file mode 100644 index 000000000000..056e00b3de57 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-strnlen.patch @@ -0,0 +1,175 @@ +Add strnlen function for non-glibc systems, as one of Fedora's patches requires it. + +--- bash-3.0/configure.in ++++ bash-3.0/configure.in +@@ -613,6 +613,9 @@ + AC_LIBOBJ(vprint) + fi + ++AC_CHECK_FUNCS([strnlen]) ++AC_LIBOBJ(strnlen) ++ + dnl signal stuff + AC_TYPE_SIGNAL + +--- /dev/null ++++ bash-3.0/lib/sh/strnlen.c +@@ -0,0 +1,27 @@ ++/* ++ Copyright (C) 2005 Gentoo Foundation ++ ++ This program is free software; you can redistribute it and/or ++ modify it under the terms of the GNU General Public License ++ as published by the Free Software Foundation; either version 2 ++ of the License, or (at your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ GNU General Public License for more details. ++ ++ You should have received a copy of the GNU General Public License ++ along with this program; if not, write to the Free Software ++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US ++*/ ++ ++#include ++ ++size_t strnlen(const char *s, size_t n) ++{ ++ int i; ++ for (i=0; s[i] && i&5 ++echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 ++if eval "test \"\${$as_ac_var+set}\" = set"; then ++ echo $ECHO_N "(cached) $ECHO_C" >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++/* Define $ac_func to an innocuous variant, in case declares $ac_func. ++ For example, HP-UX 11i declares gettimeofday. */ ++#define $ac_func innocuous_$ac_func ++ ++/* System header to define __stub macros and hopefully few prototypes, ++ which can conflict with char $ac_func (); below. ++ Prefer to if __STDC__ is defined, since ++ exists even on freestanding compilers. */ ++ ++#ifdef __STDC__ ++# include ++#else ++# include ++#endif ++ ++#undef $ac_func ++ ++/* Override any gcc2 internal prototype to avoid an error. */ ++#ifdef __cplusplus ++extern "C" ++{ ++#endif ++/* We use char because int might match the return type of a gcc2 ++ builtin and then its argument prototype would still apply. */ ++char $ac_func (); ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined (__stub_$ac_func) || defined (__stub___$ac_func) ++choke me ++#else ++char (*f) () = $ac_func; ++#endif ++#ifdef __cplusplus ++} ++#endif ++ ++int ++main () ++{ ++return f != $ac_func; ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ++ (eval $ac_link) 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && ++ { ac_try='test -z "$ac_c_werror_flag" ++ || test ! -s conftest.err' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; } && ++ { ac_try='test -s conftest$ac_exeext' ++ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ++ (eval $ac_try) 2>&5 ++ ac_status=$? ++ echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); }; }; then ++ eval "$as_ac_var=yes" ++else ++ echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++eval "$as_ac_var=no" ++fi ++rm -f conftest.err conftest.$ac_objext \ ++ conftest$ac_exeext conftest.$ac_ext ++fi ++echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 ++echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 ++if test `eval echo '${'$as_ac_var'}'` = yes; then ++ cat >>confdefs.h <<_ACEOF ++#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 ++_ACEOF ++ ++fi ++done ++ ++case $LIBOBJS in ++ "strnlen.$ac_objext" | \ ++ *" strnlen.$ac_objext" | \ ++ "strnlen.$ac_objext "* | \ ++ *" strnlen.$ac_objext "* ) ;; ++ *) LIBOBJS="$LIBOBJS strnlen.$ac_objext" ;; ++esac ++ ++ + echo "$as_me:$LINENO: checking return type of signal handlers" >&5 + echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 + if test "${ac_cv_type_signal+set}" = set; then diff --git a/app-shells/bash/files/bash-3.0-subshell.patch b/app-shells/bash/files/bash-3.0-subshell.patch new file mode 100644 index 000000000000..a1d7dfe7d342 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-subshell.patch @@ -0,0 +1,39 @@ +Ripped from Fedora which took this from upstream + +* Tue Nov 22 2005 Tim Waugh 3.0-37 +- Applied patch from upstream to fix parsing problem (bug #146638). + +http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=146638 + +--- bash-3.0/parse.y.subshell 2005-11-22 13:19:11.000000000 +0000 ++++ bash-3.0/parse.y 2005-11-22 13:19:24.000000000 +0000 +@@ -2055,14 +2055,6 @@ + if (uc) + shell_input_line_index++; + +- if MBTEST(uc == '\\' && remove_quoted_newline && shell_input_line[shell_input_line_index] == '\n') +- { +- if (SHOULD_PROMPT ()) +- prompt_again (); +- line_number++; +- goto restart_read; +- } +- + #if defined (ALIAS) || defined (DPAREN_ARITHMETIC) + /* If UC is NULL, we have reached the end of the current input string. If + pushed_string_list is non-empty, it's time to pop to the previous string +@@ -2078,6 +2070,14 @@ + } + #endif /* ALIAS || DPAREN_ARITHMETIC */ + ++ if MBTEST(uc == '\\' && remove_quoted_newline && shell_input_line[shell_input_line_index] == '\n') ++ { ++ if (SHOULD_PROMPT ()) ++ prompt_again (); ++ line_number++; ++ goto restart_read; ++ } ++ + if (!uc && shell_input_line_terminator == EOF) + return ((shell_input_line_index != 0) ? '\n' : EOF); + diff --git a/app-shells/bash/files/bash-3.0-trap-fg-signals.patch b/app-shells/bash/files/bash-3.0-trap-fg-signals.patch new file mode 100644 index 000000000000..cde18326ed2d --- /dev/null +++ b/app-shells/bash/files/bash-3.0-trap-fg-signals.patch @@ -0,0 +1,23 @@ +Don't barf on handled signals inside of scripts. Makes for nicer output. + +patch by Martin Schlemmer + +--- jobs.c ++++ jobs.c +@@ -2893,11 +2893,11 @@ + } + else if (IS_FOREGROUND (job)) + { +-#if !defined (DONT_REPORT_SIGPIPE) +- if (termsig && WIFSIGNALED (s) && termsig != SIGINT) +-#else +- if (termsig && WIFSIGNALED (s) && termsig != SIGINT && termsig != SIGPIPE) +-#endif ++ if (termsig && WIFSIGNALED (s) && termsig != SIGINT && ++#if defined (DONT_REPORT_SIGPIPE) ++ termsig != SIGPIPE && ++#endif ++ signal_is_trapped (termsig) == 0) + { + fprintf (stderr, "%s", j_strsignal (termsig)); + diff --git a/app-shells/bash/files/bash-3.0-ulimit.patch b/app-shells/bash/files/bash-3.0-ulimit.patch new file mode 100644 index 000000000000..8202b95d2769 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-ulimit.patch @@ -0,0 +1,186 @@ +Ripped from Fedora + +--- bash-3.0/builtins/ulimit.def ++++ bash-3.0/builtins/ulimit.def +@@ -34,15 +34,20 @@ + -a all current limits are reported + -c the maximum size of core files created + -d the maximum size of a process's data segment ++ -e the maximum scheduling priority (`nice') + -f the maximum size of files created by the shell ++ -i the maximum number of pending signals + -l the maximum size a process may lock into memory + -m the maximum resident set size + -n the maximum number of open file descriptors + -p the pipe buffer size ++ -q the maximum number of bytes in POSIX message queues ++ -r the maximum rt priority + -s the maximum stack size + -t the maximum amount of cpu time in seconds + -u the maximum number of user processes + -v the size of virtual memory ++ -x the maximum number of file locks + + If LIMIT is given, it is the new value of the specified resource; + the special LIMIT values `soft', `hard', and `unlimited' stand for +@@ -199,7 +204,13 @@ + #ifdef RLIMIT_DATA + { 'd', RLIMIT_DATA, 1024, "data seg size", "kbytes" }, + #endif ++#ifdef RLIMIT_NICE ++ { 'e', RLIMIT_NICE, 1, "max nice", (char *)NULL}, ++#endif /* RLIMIT_NICE */ + { 'f', RLIMIT_FILESIZE, 1024, "file size", "blocks" }, ++#ifdef RLIMIT_SIGPENDING ++ { 'i', RLIMIT_SIGPENDING, 1, "pending signals", (char *)NULL}, ++#endif + #ifdef RLIMIT_MEMLOCK + { 'l', RLIMIT_MEMLOCK, 1024, "max locked memory", "kbytes" }, + #endif +@@ -208,6 +219,12 @@ + #endif /* RLIMIT_RSS */ + { 'n', RLIMIT_OPENFILES, 1, "open files", (char *)NULL}, + { 'p', RLIMIT_PIPESIZE, 512, "pipe size", "512 bytes" }, ++#ifdef RLIMIT_MSGQUEUE ++ { 'q', RLIMIT_MSGQUEUE, 1, "POSIX message queues", "bytes" }, ++#endif ++#ifdef RLIMIT_RTPRIO ++ { 'r', RLIMIT_RTPRIO, 1, "max rt priority", (char *)NULL}, ++#endif /* RLIMIT_RTPRIO */ + #ifdef RLIMIT_STACK + { 's', RLIMIT_STACK, 1024, "stack size", "kbytes" }, + #endif +@@ -221,6 +238,9 @@ + #ifdef RLIMIT_SWAP + { 'w', RLIMIT_SWAP, 1024, "swap size", "kbytes" }, + #endif ++#ifdef RLIMIT_LOCKS ++ { 'x', RLIMIT_LOCKS, 1, "file locks", (char *)NULL}, ++#endif + { -1, -1, -1, (char *)NULL, (char *)NULL } + }; + #define NCMDS (sizeof(limits) / sizeof(limits[0])) +@@ -647,11 +667,11 @@ + + for (i = 0; limits[i].option > 0; i++) + { +- if (get_limit (i, &softlim, &hardlim) < 0) ++ if (get_limit (i, &softlim, &hardlim) == 0) ++ printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1); ++ else if (errno != EINVAL) + builtin_error ("%s: cannot get limit: %s", limits[i].description, + strerror (errno)); +- else +- printone (i, (mode & LIMIT_SOFT) ? softlim : hardlim, 1); + } + } + +@@ -670,7 +690,7 @@ + else + sprintf (unitstr, "(-%c) ", limits[limind].option); + +- printf ("%-18s %16s", limits[limind].description, unitstr); ++ printf ("%-20s %16s", limits[limind].description, unitstr); + } + if (curlim == RLIM_INFINITY) + puts ("unlimited"); +--- bash-3.0/doc/bashref.texi ++++ bash-3.0/doc/bashref.texi +@@ -3793,7 +3793,7 @@ + @item ulimit + @btindex ulimit + @example +-ulimit [-acdflmnpstuvSH] [@var{limit}] ++ulimit [-acdeflmnpqrstuvxSH] [@var{limit}] + @end example + @code{ulimit} provides control over the resources available to processes + started by the shell, on systems that allow such control. If an +@@ -3814,9 +3814,15 @@ + @item -d + The maximum size of a process's data segment. + ++@item -e ++The maximum scheduling priority. ++ + @item -f + The maximum size of files created by the shell. + ++@item -i ++The maximum number of pending signals. ++ + @item -l + The maximum size that may be locked into memory. + +@@ -3829,6 +3835,12 @@ + @item -p + The pipe buffer size. + ++@item -q ++The maximum number of bytes in POSIX message queues. ++ ++@item -r ++The maximum RT priority. ++ + @item -s + The maximum stack size. + +@@ -3841,6 +3853,9 @@ + @item -v + The maximum amount of virtual memory available to the process. + ++@item -x ++The maximum amount of file locks. ++ + @end table + + If @var{limit} is given, it is the new value of the specified resource; +--- bash-3.0/doc/bash.1 ++++ bash-3.0/doc/bash.1 +@@ -8362,7 +8362,7 @@ + returns true if any of the arguments are found, false if + none are found. + .TP +-\fBulimit\fP [\fB\-SHacdflmnpstuv\fP [\fIlimit\fP]] ++\fBulimit\fP [\fB\-SHacdefilmnpqrstuvx\fP [\fIlimit\fP]] + Provides control over the resources available to the shell and to + processes started by it, on systems that allow such control. + The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is +@@ -8398,9 +8398,15 @@ + .B \-d + The maximum size of a process's data segment + .TP ++.B \-e ++The maximum scheduling priority (`nice') ++.TP + .B \-f + The maximum size of files created by the shell + .TP ++.B \-i ++The maximum number of pending signals ++.TP + .B \-l + The maximum size that may be locked into memory + .TP +@@ -8414,6 +8420,12 @@ + .B \-p + The pipe size in 512-byte blocks (this may not be set) + .TP ++.B \-q ++The maximum number of bytes in POSIX message queues ++.TP ++.B \-r ++The maximum rt priority ++.TP + .B \-s + The maximum stack size + .TP +@@ -8425,6 +8437,9 @@ + .TP + .B \-v + The maximum amount of virtual memory available to the shell ++.TP ++.B \-x ++The maximum number of file locks + .PD + .PP + If diff --git a/app-shells/bash/files/bash-3.0-volatile-command.patch b/app-shells/bash/files/bash-3.0-volatile-command.patch new file mode 100644 index 000000000000..8b89b35914b1 --- /dev/null +++ b/app-shells/bash/files/bash-3.0-volatile-command.patch @@ -0,0 +1,16 @@ +Ripped from Debian + +# DP: current_command must be declared volatile to prevent assignments from +# being optimized away as dead code. In reality, the use of setjmp/longjmp +# makes it not dead code at all. + +--- eval.old 2003-12-18 23:44:15.000000000 -0500 ++++ eval.c 2005-10-03 01:59:31.000000000 -0400 +@@ -63,7 +63,7 @@ + reader_loop () + { + int our_indirection_level; +- COMMAND *current_command = (COMMAND *)NULL; ++ COMMAND * volatile current_command = (COMMAND *)NULL; + + USE_VAR(current_command); diff --git a/app-shells/bash/files/bash-3.1-dev-fd-buffer-overflow.patch b/app-shells/bash/files/bash-3.1-dev-fd-buffer-overflow.patch new file mode 100644 index 000000000000..9d08856e5b00 --- /dev/null +++ b/app-shells/bash/files/bash-3.1-dev-fd-buffer-overflow.patch @@ -0,0 +1,16 @@ +https://bugs.gentoo.org/431850 + +this is a backport of the upstream bash42-033 patch for bash 3.1/3.0/2.05 + +--- a/test.c ++++ b/test.c +@@ -194,7 +194,8 @@ + trailing slash. Make sure /dev/fd/xx really uses DEV_FD_PREFIX/xx. + On most systems, with the notable exception of linux, this is + effectively a no-op. */ +- char pbuf[32]; ++ static char *pbuf = 0; ++ pbuf = xrealloc (pbuf, sizeof (DEV_FD_PREFIX) + strlen (path + 8)); + strcpy (pbuf, DEV_FD_PREFIX); + strcat (pbuf, path + 8); + return (stat (pbuf, finfo)); diff --git a/app-shells/bash/files/bash-3.1-dev-fd-test-as-user.patch b/app-shells/bash/files/bash-3.1-dev-fd-test-as-user.patch new file mode 100644 index 000000000000..80a4b0a1a034 --- /dev/null +++ b/app-shells/bash/files/bash-3.1-dev-fd-test-as-user.patch @@ -0,0 +1,14 @@ +Fix the /dev/fd test when running as a non root user +after logging in as a root user #131875 + +--- bash-3.1/configure ++++ bash-3.1/configure +@@ -23098,7 +23098,7 @@ + if test -d /dev/fd && test -r /dev/fd/0 < /dev/null; then + # check for systems like FreeBSD 5 that only provide /dev/fd/[012] + exec 3<&0 +- if test -r /dev/fd/3; then ++ if test -e /dev/fd/3; then + bash_cv_dev_fd=standard + else + bash_cv_dev_fd=absent diff --git a/app-shells/bash/files/bash-3.1-fix-dash-login-shell.patch b/app-shells/bash/files/bash-3.1-fix-dash-login-shell.patch new file mode 100644 index 000000000000..3ca7518fbb50 --- /dev/null +++ b/app-shells/bash/files/bash-3.1-fix-dash-login-shell.patch @@ -0,0 +1,52 @@ +http://lists.gnu.org/archive/html/bug-bash/2006-01/msg00054.html +http://bugs.gentoo.org/118257 + +Date: Fri, 13 Jan 2006 17:11:10 +0000 +From: Tim Waugh +To: bug-bash@gnu.org +Subject: [patch] fix 'exec -l /bin/bash' + +Configuration Information [Automatically generated, do not change]: +Machine: i386 +OS: linux-gnu +Compiler: i386-redhat-linux-gcc +Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables +uname output: Linux gene.surrey.redhat.com 2.6.13-1.1597_FC5 #1 Thu Oct 6 02:13:06 EDT 2005 i686 i686 i386 GNU/Linux +Machine Type: i386-redhat-linux-gnu + +Bash Version: 3.1 +Patch Level: 1 +Release Status: release + +Description: + If bash has argv[0] as '-/bin/bash' it does not become a login + shell. + +Repeat-By: + exec -l /bin/bash + shopt + +Fix: + +--- bash-3.1/shell.c.login 2006-01-13 16:52:14.000000000 +0000 ++++ bash-3.1/shell.c 2006-01-13 16:52:15.000000000 +0000 +@@ -1543,9 +1543,10 @@ + any startup files; just try to be more like /bin/sh. */ + shell_name = argv0 ? base_pathname (argv0) : PROGRAM; + +- if (*shell_name == '-') ++ if (argv0 && *argv0 == '-') + { +- shell_name++; ++ if (*shell_name == '-') ++ shell_name++; + login_shell++; + } + + + +_______________________________________________ +Bug-bash mailing list +Bug-bash@gnu.org +http://lists.gnu.org/mailman/listinfo/bug-bash + diff --git a/app-shells/bash/files/bash-3.1-protos.patch b/app-shells/bash/files/bash-3.1-protos.patch new file mode 100644 index 000000000000..32ae8cfe91a3 --- /dev/null +++ b/app-shells/bash/files/bash-3.1-protos.patch @@ -0,0 +1,67 @@ +move prototypes around so they show up when needed + +--- a/jobs.h ++++ b/jobs.h +@@ -182,6 +182,7 @@ + + extern int count_all_jobs __P((void)); + ++extern void close_pgrp_pipe __P((void)); + extern void terminate_current_pipeline __P((void)); + extern void terminate_stopped_jobs __P((void)); + extern void hangup_all_jobs __P((void)); +--- a/lib/glob/strmatch.c ++++ b/lib/glob/strmatch.c +@@ -25,9 +25,6 @@ + #include "strmatch.h" + + extern int xstrmatch __P((char *, char *, int)); +-#if defined (HAVE_MULTIBYTE) +-extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int)); +-#endif + + int + strmatch (pattern, string, flags) +--- a/lib/glob/strmatch.h ++++ b/lib/glob/strmatch.h +@@ -57,6 +57,7 @@ + + #if HANDLE_MULTIBYTE + extern int wcsmatch __P((wchar_t *, wchar_t *, int)); ++extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int)); + #endif + + #endif /* _STRMATCH_H */ +--- a/builtins/echo.def ++++ b/builtins/echo.def +@@ -31,6 +31,8 @@ + #include + #include "../shell.h" + ++#include "common.h" ++ + $BUILTIN echo + $FUNCTION echo_builtin + $DEPENDS_ON V9_ECHO +--- a/lib/sh/winsize.c ++++ b/lib/sh/winsize.c +@@ -55,6 +55,7 @@ + #if defined (READLINE) + extern void rl_set_screen_size __P((int, int)); + #endif ++extern void sh_set_lines_and_columns __P((int, int)); + + void + get_new_window_size (from_sig, rp, cp) +--- a/support/bashversion.c ++++ b/support/bashversion.c +@@ -47,6 +47,9 @@ + extern char *dist_version; + extern int patch_level; + ++extern char *shell_version_string __P((void)); ++extern void show_shell_version __P((int)); ++ + char *shell_name = "bash"; + char *progname; + diff --git a/app-shells/bash/files/bash-3.1-ulimit.patch b/app-shells/bash/files/bash-3.1-ulimit.patch new file mode 100644 index 000000000000..432fb54966b8 --- /dev/null +++ b/app-shells/bash/files/bash-3.1-ulimit.patch @@ -0,0 +1,122 @@ +Ripped from Fedora + +Add support for RLIMIT_NICE/RLIMIT_RTPRIO and add missing documentation +for many other options + +--- builtins/ulimit.def ++++ builtins/ulimit.def +@@ -24,7 +24,7 @@ + $BUILTIN ulimit + $FUNCTION ulimit_builtin + $DEPENDS_ON !_MINIX +-$SHORT_DOC ulimit [-SHacdfilmnpqstuvx] [limit] ++$SHORT_DOC ulimit [-SHacdefilmnpqrstuvx] [limit] + Ulimit provides control over the resources available to processes + started by the shell, on systems that allow such control. If an + option is given, it is interpreted as follows: +@@ -34,18 +34,20 @@ + -a all current limits are reported + -c the maximum size of core files created + -d the maximum size of a process's data segment ++ -e the maximum scheduling priority (`nice') + -f the maximum size of files created by the shell +- -i the maximum number of pending signals ++ -i the maximum number of pending signals + -l the maximum size a process may lock into memory + -m the maximum resident set size + -n the maximum number of open file descriptors + -p the pipe buffer size +- -q the maximum number of bytes in POSIX message queues ++ -q the maximum number of bytes in POSIX message queues ++ -r the maximum rt priority + -s the maximum stack size + -t the maximum amount of cpu time in seconds + -u the maximum number of user processes + -v the size of virtual memory +- -x the maximum number of file locks ++ -x the maximum number of file locks + + If LIMIT is given, it is the new value of the specified resource; + the special LIMIT values `soft', `hard', and `unlimited' stand for +@@ -202,6 +204,9 @@ + #ifdef RLIMIT_DATA + { 'd', RLIMIT_DATA, 1024, "data seg size", "kbytes" }, + #endif ++#ifdef RLIMIT_NICE ++ { 'e', RLIMIT_NICE, 1, "max nice", (char *)NULL}, ++#endif + { 'f', RLIMIT_FILESIZE, 1024, "file size", "blocks" }, + #ifdef RLIMIT_SIGPENDING + { 'i', RLIMIT_SIGPENDING, 1, "pending signals", (char *)NULL }, +@@ -217,6 +222,9 @@ + #ifdef RLIMIT_MSGQUEUE + { 'q', RLIMIT_MSGQUEUE, 1, "POSIX message queues", "bytes" }, + #endif ++#ifdef RLIMIT_RTPRIO ++ { 'r', RLIMIT_RTPRIO, 1, "max rt priority", (char *)NULL}, ++#endif + #ifdef RLIMIT_STACK + { 's', RLIMIT_STACK, 1024, "stack size", "kbytes" }, + #endif +--- doc/bashref.texi ++++ doc/bashref.texi +@@ -3833,7 +3833,7 @@ + @item ulimit + @btindex ulimit + @example +-ulimit [-acdfilmnpqstuvxSH] [@var{limit}] ++ulimit [-acdefilmnpqrstuvxSH] [@var{limit}] + @end example + @code{ulimit} provides control over the resources available to processes + started by the shell, on systems that allow such control. If an +@@ -3854,6 +3854,9 @@ + @item -d + The maximum size of a process's data segment. + ++@item -e ++The maximum scheduling priority. ++ + @item -f + The maximum size of files created by the shell. + +@@ -3875,6 +3878,9 @@ + @item -q + The maximum number of bytes in POSIX message queues. + ++@item -r ++The maximum RT priority. ++ + @item -s + The maximum stack size. + +--- doc/bash.1 ++++ doc/bash.1 +@@ -8490,7 +8490,7 @@ + returns true if any of the arguments are found, false if + none are found. + .TP +-\fBulimit\fP [\fB\-SHacdfilmnpqstuvx\fP [\fIlimit\fP]] ++\fBulimit\fP [\fB\-SHacdefilmnpqrstuvx\fP [\fIlimit\fP]] + Provides control over the resources available to the shell and to + processes started by it, on systems that allow such control. + The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is +@@ -8526,6 +8526,9 @@ + .B \-d + The maximum size of a process's data segment + .TP ++.B \-e ++The maximum scheduling priority (`nice') ++.TP + .B \-f + The maximum size of files created by the shell + .TP +@@ -8548,6 +8551,9 @@ + .B \-q + The maximum number of bytes in POSIX message queues + .TP ++.B \-r ++The maximum rt priority ++.TP + .B \-s + The maximum stack size + .TP diff --git a/app-shells/bash/files/bash-3.2-dev-fd-test-as-user.patch b/app-shells/bash/files/bash-3.2-dev-fd-test-as-user.patch new file mode 100644 index 000000000000..8aca7767161d --- /dev/null +++ b/app-shells/bash/files/bash-3.2-dev-fd-test-as-user.patch @@ -0,0 +1,26 @@ +diff -ur bash-3.2.orig/aclocal.m4 bash-3.2/aclocal.m4 +--- bash-3.2.orig/aclocal.m4 2006-12-30 20:00:31 +0000 ++++ bash-3.2/aclocal.m4 2006-12-30 20:02:02 +0000 +@@ -1544,7 +1544,8 @@ + if test -d /dev/fd && test -r /dev/fd/0 < /dev/null; then + # check for systems like FreeBSD 5 that only provide /dev/fd/[012] + exec 3 + #include "builtins.h" + #include "shell.h" ++#include "common.h" + + basename_builtin (list) + WORD_LIST *list; +--- bash-3.2/examples/loadables/cut.c ++++ bash-3.2/examples/loadables/cut.c +@@ -63,6 +63,7 @@ + #include "builtins.h" + #include "shell.h" + #include "bashgetopt.h" ++#include "common.h" + + #if !defined (errno) + extern int errno; +--- bash-3.2/examples/loadables/dirname.c ++++ bash-3.2/examples/loadables/dirname.c +@@ -11,6 +11,7 @@ + #include + #include "builtins.h" + #include "shell.h" ++#include "common.h" + + dirname_builtin (list) + WORD_LIST *list; +--- bash-3.2/examples/loadables/finfo.c ++++ bash-3.2/examples/loadables/finfo.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + + #include "bashansi.h" + #include "shell.h" +--- bash-3.2/examples/loadables/head.c ++++ bash-3.2/examples/loadables/head.c +@@ -21,6 +21,7 @@ + #include "builtins.h" + #include "shell.h" + #include "bashgetopt.h" ++#include "common.h" + + #if !defined (errno) + extern int errno; +--- bash-3.2/examples/loadables/ln.c ++++ bash-3.2/examples/loadables/ln.c +@@ -18,6 +18,7 @@ + #include "builtins.h" + #include "shell.h" + #include "bashgetopt.h" ++#include "common.h" + + #if !defined (errno) + extern int errno; +--- bash-3.2/examples/loadables/logname.c ++++ bash-3.2/examples/loadables/logname.c +@@ -11,6 +11,7 @@ + + #include "builtins.h" + #include "shell.h" ++#include "common.h" + + #if !defined (errno) + extern int errno; +--- bash-3.2/examples/loadables/mkdir.c ++++ bash-3.2/examples/loadables/mkdir.c +@@ -16,6 +16,7 @@ + #include "builtins.h" + #include "shell.h" + #include "bashgetopt.h" ++#include "common.h" + + #if !defined (errno) + extern int errno; +--- bash-3.2/examples/loadables/pathchk.c ++++ bash-3.2/examples/loadables/pathchk.c +@@ -45,6 +45,7 @@ + #include "stdc.h" + #include "bashgetopt.h" + #include "maxpath.h" ++#include "common.h" + + #if !defined (errno) + extern int errno; +--- bash-3.2/examples/loadables/print.c ++++ bash-3.2/examples/loadables/print.c +@@ -17,6 +17,8 @@ + #include "builtins.h" + #include "stdc.h" + #include "bashgetopt.h" ++#include "builtext.h" ++#include "common.h" + + #if !defined (errno) + extern int errno; +--- bash-3.2/examples/loadables/printenv.c ++++ bash-3.2/examples/loadables/printenv.c +@@ -11,6 +11,7 @@ + #include "builtins.h" + #include "shell.h" + #include "bashgetopt.h" ++#include "common.h" + + extern char **export_env; + +--- bash-3.2/examples/loadables/push.c ++++ bash-3.2/examples/loadables/push.c +@@ -11,6 +11,7 @@ + #include "shell.h" + #include "jobs.h" + #include "bashgetopt.h" ++#include "common.h" + + #ifndef errno + extern int errno; +--- bash-3.2/examples/loadables/realpath.c ++++ bash-3.2/examples/loadables/realpath.c +@@ -34,6 +34,7 @@ + #include "builtins.h" + #include "shell.h" + #include "bashgetopt.h" ++#include "common.h" + + #ifndef errno + extern int errno; +@@ -67,14 +68,14 @@ + vflag = 1; + break; + default: +- usage(); ++ builtin_usage(); + } + } + + list = loptend; + + if (list == 0) +- usage(); ++ builtin_usage(); + + for (es = EXECUTION_SUCCESS; list; list = list->next) { + p = list->word->word; +--- bash-3.2/examples/loadables/rmdir.c ++++ bash-3.2/examples/loadables/rmdir.c +@@ -8,6 +8,7 @@ + #include + #include "builtins.h" + #include "shell.h" ++#include "common.h" + + #if !defined (errno) + extern int errno; +--- bash-3.2/examples/loadables/sleep.c ++++ bash-3.2/examples/loadables/sleep.c +@@ -27,6 +27,7 @@ + + #include "shell.h" + #include "builtins.h" ++#include "common.h" + + #define RETURN(x) \ + do { \ +--- bash-3.2/examples/loadables/tee.c ++++ bash-3.2/examples/loadables/tee.c +@@ -22,6 +22,7 @@ + #include "builtins.h" + #include "shell.h" + #include "bashgetopt.h" ++#include "common.h" + + #if !defined (errno) + extern int errno; +--- bash-3.2/examples/loadables/truefalse.c ++++ bash-3.2/examples/loadables/truefalse.c +@@ -1,5 +1,7 @@ + /* true and false builtins */ + ++#include ++ + #include "bashtypes.h" + #include "shell.h" + #include "builtins.h" +--- bash-3.2/examples/loadables/tty.c ++++ bash-3.2/examples/loadables/tty.c +@@ -8,6 +8,7 @@ + #include "builtins.h" + #include "shell.h" + #include "bashgetopt.h" ++#include "common.h" + + extern char *ttyname (); + +--- bash-3.2/examples/loadables/uname.c ++++ bash-3.2/examples/loadables/uname.c +@@ -27,6 +27,7 @@ + #include "builtins.h" + #include "shell.h" + #include "bashgetopt.h" ++#include "common.h" + + #define FLAG_SYSNAME 0x01 /* -s */ + #define FLAG_NODENAME 0x02 /* -n */ +--- bash-3.2/examples/loadables/unlink.c ++++ bash-3.2/examples/loadables/unlink.c +@@ -14,6 +14,7 @@ + + #include "builtins.h" + #include "shell.h" ++#include "common.h" + + #ifndef errno + extern int errno; +--- bash-3.2/examples/loadables/whoami.c ++++ bash-3.2/examples/loadables/whoami.c +@@ -8,6 +8,7 @@ + #include "builtins.h" + #include "shell.h" + #include "bashgetopt.h" ++#include "common.h" + + whoami_builtin (list) + WORD_LIST *list; +--- bash-3.2/examples/loadables/Makefile.in ++++ bash-3.2/examples/loadables/Makefile.in +@@ -68,7 +68,7 @@ + SHOBJ_CC = @SHOBJ_CC@ + SHOBJ_CFLAGS = @SHOBJ_CFLAGS@ + SHOBJ_LD = @SHOBJ_LD@ +-SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@ ++SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@ @LDFLAGS@ + SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@ + SHOBJ_LIBS = @SHOBJ_LIBS@ + SHOBJ_STATUS = @SHOBJ_STATUS@ diff --git a/app-shells/bash/files/bash-3.2-process-subst.patch b/app-shells/bash/files/bash-3.2-process-subst.patch new file mode 100644 index 000000000000..bd0b3f4e1792 --- /dev/null +++ b/app-shells/bash/files/bash-3.2-process-subst.patch @@ -0,0 +1,12 @@ +Fix process substitution on BSD + +--- execute_cmd.c ++++ execute_cmd.c +@@ -2672,6 +2672,7 @@ + + do_piping (pipe_in, pipe_out); + ++ subshell_environment = 0; + if (async) + subshell_environment |= SUBSHELL_ASYNC; + if (pipe_in != NO_PIPE || pipe_out != NO_PIPE) diff --git a/app-shells/bash/files/bash-3.2-protos.patch b/app-shells/bash/files/bash-3.2-protos.patch new file mode 100644 index 000000000000..0a9ea74adfb0 --- /dev/null +++ b/app-shells/bash/files/bash-3.2-protos.patch @@ -0,0 +1,57 @@ +move prototypes around so they show up when needed + +--- a/jobs.h ++++ b/jobs.h +@@ -182,6 +182,7 @@ + + extern int count_all_jobs __P((void)); + ++extern void close_pgrp_pipe __P((void)); + extern void terminate_current_pipeline __P((void)); + extern void terminate_stopped_jobs __P((void)); + extern void hangup_all_jobs __P((void)); +--- a/lib/glob/strmatch.c ++++ b/lib/glob/strmatch.c +@@ -25,9 +25,6 @@ + #include "strmatch.h" + + extern int xstrmatch __P((char *, char *, int)); +-#if defined (HAVE_MULTIBYTE) +-extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int)); +-#endif + + int + strmatch (pattern, string, flags) +--- a/lib/glob/strmatch.h ++++ b/lib/glob/strmatch.h +@@ -57,6 +57,7 @@ + + #if HANDLE_MULTIBYTE + extern int wcsmatch __P((wchar_t *, wchar_t *, int)); ++extern int internal_wstrmatch __P((wchar_t *, wchar_t *, int)); + #endif + + #endif /* _STRMATCH_H */ +--- a/quit.h ++++ b/quit.h +@@ -21,6 +21,8 @@ + #if !defined (_QUIT_H_) + #define _QUIT_H_ + ++#include "sig.h" ++ + /* Non-zero means SIGINT has already ocurred. */ + extern volatile int interrupt_state; + extern volatile int terminating_signal; +--- a/support/bashversion.c ++++ b/support/bashversion.c +@@ -47,6 +47,9 @@ + extern char *dist_version; + extern int patch_level; + ++extern char *shell_version_string __P((void)); ++extern void show_shell_version __P((int)); ++ + char *shell_name = "bash"; + char *progname; + diff --git a/app-shells/bash/files/bash-3.2-session-leader.patch b/app-shells/bash/files/bash-3.2-session-leader.patch new file mode 100644 index 000000000000..82f7d9806333 --- /dev/null +++ b/app-shells/bash/files/bash-3.2-session-leader.patch @@ -0,0 +1,65 @@ +http://bugs.gentoo.org/231775 +http://lists.gnu.org/archive/html/bug-bash/2008-07/msg00010.html + +A parent bash shell sometimes will set the session leader tty (using tcsetpgrp) +back to itself, taking control away from a child bash shell, due to a race +condition. A result is that the child can then not then execute some commands +(like stty) from its init script (e.g. .bashrc). The result I (and others) +have seen is that the bash shell will hang while reading the init script. + +*** jobs.c.20080704 2008-07-10 15:14:13.000000000 -0400 +--- jobs.c 2008-07-10 15:17:59.000000000 -0400 +*************** +*** 266,269 **** +--- 266,270 ---- + static void set_job_running __P((int)); + static void setjstatus __P((int)); ++ static int maybe_give_terminal_to __P((pid_t, pid_t, int)); + static void mark_all_jobs_as_dead __P((void)); + static void mark_dead_jobs_as_notified __P((int)); +*************** +*** 637,641 **** + */ + if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0) +! give_terminal_to (newjob->pgrp, 0); + } + } +--- 638,642 ---- + */ + if (job_control && newjob->pgrp && (subshell_environment&SUBSHELL_ASYNC) == 0) +! maybe_give_terminal_to (shell_pgrp, newjob->pgrp, 0); + } + } +*************** +*** 3833,3836 **** +--- 3834,3863 ---- + } + ++ /* Give terminal to NPGRP iff it's currently owned by OPGRP. FLAGS are the ++ flags to pass to give_terminal_to(). */ ++ static int ++ maybe_give_terminal_to (opgrp, npgrp, flags) ++ pid_t opgrp, npgrp; ++ int flags; ++ { ++ int tpgrp; ++ ++ tpgrp = tcgetpgrp (shell_tty); ++ if (tpgrp == npgrp) ++ { ++ terminal_pgrp = npgrp; ++ return 0; ++ } ++ else if (tpgrp != opgrp) ++ { ++ #if defined (DEBUG) ++ internal_warning ("maybe_give_terminal_to: terminal pgrp == %d shell pgrp = %d", tpgrp, opgrp); ++ #endif ++ return -1; ++ } ++ else ++ return (give_terminal_to (npgrp, flags)); ++ } ++ + /* Clear out any jobs in the job array. This is intended to be used by + children of the shell, who should not have any job structures as baggage diff --git a/app-shells/bash/files/bash-3.2-ulimit.patch b/app-shells/bash/files/bash-3.2-ulimit.patch new file mode 100644 index 000000000000..a0975cb6e9a8 --- /dev/null +++ b/app-shells/bash/files/bash-3.2-ulimit.patch @@ -0,0 +1,13 @@ +add missing docs for -e and -r options + +--- builtins/ulimit.def ++++ builtins/ulimit.def +@@ -24,7 +24,7 @@ + $BUILTIN ulimit + $FUNCTION ulimit_builtin + $DEPENDS_ON !_MINIX +-$SHORT_DOC ulimit [-SHacdfilmnpqstuvx] [limit] ++$SHORT_DOC ulimit [-SHacdefilmnpqrstuvx] [limit] + Ulimit provides control over the resources available to processes + started by the shell, on systems that allow such control. If an + option is given, it is interpreted as follows: diff --git a/app-shells/bash/files/bash-4.0-configure.patch b/app-shells/bash/files/bash-4.0-configure.patch new file mode 100644 index 000000000000..e57cb6b2402e --- /dev/null +++ b/app-shells/bash/files/bash-4.0-configure.patch @@ -0,0 +1,25 @@ +http://bugs.gentoo.org/304901 + +newer patches touch configure ... we don't want autotool deps, so update +the files ourselves + +--- bash-4.0/configure ++++ bash-4.0/configure +@@ -5806,7 +5806,7 @@ + # static version specified as -llibname to override the + # dynamic version + case "${host_os}" in +- darwin[89]*) READLINE_LIB='${READLINE_LIBRARY}' ;; ++ darwin[89]*|darwin10*) READLINE_LIB='${READLINE_LIBRARY}' ;; + *) READLINE_LIB=-lreadline ;; + esac + fi +@@ -5847,7 +5847,7 @@ + # static version specified as -llibname to override the + # dynamic version + case "${host_os}" in +- darwin[89]*) HISTORY_LIB='${HISTORY_LIBRARY}' ;; ++ darwin[89]*|darwin10*) HISTORY_LIB='${HISTORY_LIBRARY}' ;; + *) HISTORY_LIB=-lhistory ;; + esac + fi diff --git a/app-shells/bash/files/bash-4.0-ldflags-for-build.patch b/app-shells/bash/files/bash-4.0-ldflags-for-build.patch new file mode 100644 index 000000000000..089264f97e40 --- /dev/null +++ b/app-shells/bash/files/bash-4.0-ldflags-for-build.patch @@ -0,0 +1,15 @@ +http://bugs.gentoo.org/211947 + +fix from Takashi YOSHII: dont use target ldflags for build apps + +--- bash/Makefile.in ++++ bash/Makefile.in +@@ -143,7 +143,7 @@ + CCFLAGS_FOR_BUILD = $(BASE_CCFLAGS) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) + + LDFLAGS = @LDFLAGS@ $(STATIC_LD) $(LOCAL_LDFLAGS) $(PROFILE_FLAGS) $(CFLAGS) +-LDFLAGS_FOR_BUILD = $(LDFLAGS) ++LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@ $(LOCAL_LDFLAGS) $(CFLAGS_FOR_BUILD) + + INCLUDES = -I. @RL_INCLUDE@ -I$(srcdir) -I$(BASHINCDIR) -I$(LIBSRC) $(INTL_INC) + diff --git a/app-shells/bash/files/bash-4.0-negative-return.patch b/app-shells/bash/files/bash-4.0-negative-return.patch new file mode 100644 index 000000000000..32affa18c179 --- /dev/null +++ b/app-shells/bash/files/bash-4.0-negative-return.patch @@ -0,0 +1,33 @@ +http://lists.gnu.org/archive/html/bug-bash/2009-02/msg00158.html + +make `return` accept negative values again + +hack by me (vapier@gentoo.org) ... i'm not familiar with bash source code, so +i imagine this isn't the best way to do it ... + +--- bash/builtins/return.def ++++ bash/builtins/return.def +@@ -60,9 +60,23 @@ + return_builtin (list) + WORD_LIST *list; + { ++ int neg = 0; ++ if (list && list->word && list->word->word) { ++ char *word = list->word->word; ++ if (*word == '-') { ++ while (*word++) ++ if (!isdigit(*word)) ++ break; ++ if (!*word) ++ neg = 1; ++ } ++ } ++ ++ if (!neg) { + if (no_options (list)) + return (EX_USAGE); + list = loptend; /* skip over possible `--' */ ++ } + + return_catch_value = get_exitstat (list); + diff --git a/app-shells/bash/files/bash-4.0-parallel-build.patch b/app-shells/bash/files/bash-4.0-parallel-build.patch new file mode 100644 index 000000000000..8384e2c9019c --- /dev/null +++ b/app-shells/bash/files/bash-4.0-parallel-build.patch @@ -0,0 +1,65 @@ +http://bugs.gentoo.org/267613 + +add missing dep + +patch by Peter Alfredsen + +--- bash-4.0/Makefile.in ++++ bash-4.0/Makefile.in +@@ -1022,10 +1022,11 @@ + subst.o: flags.h jobs.h siglist.h execute_cmd.h ${BASHINCDIR}/filecntl.h trap.h pathexp.h + subst.o: mailcheck.h input.h $(DEFSRC)/getopt.h $(DEFSRC)/common.h + subst.o: bashline.h bashhist.h ${GLOB_LIBSRC}/strmatch.h + subst.o: ${BASHINCDIR}/chartypes.h + subst.o: ${BASHINCDIR}/shmbutil.h ++subst.o: ${DEFDIR}/builtext.h + test.o: bashtypes.h ${BASHINCDIR}/posixstat.h ${BASHINCDIR}/filecntl.h + test.o: shell.h syntax.h config.h bashjmp.h ${BASHINCDIR}/posixjmp.h command.h ${BASHINCDIR}/stdc.h error.h + test.o: general.h xmalloc.h bashtypes.h variables.h arrayfunc.h conftypes.h array.h hashlib.h + test.o: quit.h ${BASHINCDIR}/maxpath.h unwind_prot.h dispose_cmd.h + test.o: make_cmd.h subst.h sig.h pathnames.h externs.h test.h + +http://bugs.gentoo.org/284633 + +and another ... + +--- bash-4.0/lib/sh/Makefile.in ++++ bash-4.0/lib/sh/Makefile.in +@@ -136,6 +136,9 @@ + ${BUILD_DIR}/version.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile + -( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} version.h ) + ++${BUILD_DIR}/pathnames.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile ++ -( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} pathnames.h ) ++ + # rules for losing makes, like SunOS + casemod.o: casemod.c + clktck.o: clktck.c + +http://bugs.gentoo.org/300143 + +and another ... + +--- bash-4.0/lib/glob/Makefile.in ++++ bash-4.0/lib/glob/Makefile.in +@@ -119,6 +119,11 @@ + mostlyclean: clean + -( cd doc && $(MAKE) $(MFLAGS) $@ ) + ++# Dependencies ++ ++${BUILD_DIR}/pathnames.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile ++ -( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} pathnames.h ) ++ + ###################################################################### + # # + # Dependencies for the object files which make up this library. # +@@ -136,7 +141,7 @@ + strmatch.o: $(BUILD_DIR)/config.h + strmatch.o: $(BASHINCDIR)/stdc.h + +-glob.o: $(BUILD_DIR)/config.h ++glob.o: $(BUILD_DIR)/config.h $(topdir)/shell.h $(BUILD_DIR)/pathnames.h + glob.o: $(topdir)/bashtypes.h $(BASHINCDIR)/ansi_stdlib.h $(topdir)/bashansi.h + glob.o: $(BASHINCDIR)/posixstat.h $(BASHINCDIR)/memalloc.h + glob.o: strmatch.h glob.h diff --git a/app-shells/bash/files/bash-4.1-fbsd-eaccess.patch b/app-shells/bash/files/bash-4.1-fbsd-eaccess.patch new file mode 100644 index 000000000000..576a8a47a619 --- /dev/null +++ b/app-shells/bash/files/bash-4.1-fbsd-eaccess.patch @@ -0,0 +1,29 @@ +Bash built-in test fails to correctly report exeuctable status for non- +executable files when run by root on FreeBSD. + +See http://bugs.gentoo.org/303411 + +Patch from Johan Hattne +--- lib/sh/eaccess.c.orig ++++ lib/sh/eaccess.c +@@ -198,11 +198,19 @@ + char *path; + int mode; + { ++ struct stat s; ++ int ret; ++ + if (path_is_devfd (path)) + return (sh_stataccess (path, mode)); + + #if defined (HAVE_EACCESS) /* FreeBSD */ +- return (eaccess (path, mode)); ++ if (stat (path, &s) != 0) ++ return (-1); ++ ret = eaccess (path, mode); ++ if (mode == X_OK && ret == 0 && !S_ISDIR(s.st_mode) && geteuid() == 0) ++ return ((s.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) == 0 ? -1 : 0); ++ return (ret); + #elif defined (EFF_ONLY_OK) /* SVR4(?), SVR4.2 */ + return access (path, mode|EFF_ONLY_OK); + #else diff --git a/app-shells/bash/files/bash-4.1-parallel-build.patch b/app-shells/bash/files/bash-4.1-parallel-build.patch new file mode 100644 index 000000000000..ae44bcc0cf6d --- /dev/null +++ b/app-shells/bash/files/bash-4.1-parallel-build.patch @@ -0,0 +1,23 @@ +--- bash-4.1/lib/glob/Makefile.in ++++ bash-4.1/lib/glob/Makefile.in +@@ -119,6 +119,11 @@ + mostlyclean: clean + -( cd doc && $(MAKE) $(MFLAGS) $@ ) + ++# Dependencies ++ ++${BUILD_DIR}/pathnames.h: ${BUILD_DIR}/config.h ${BUILD_DIR}/Makefile Makefile ++ -( cd ${BUILD_DIR} && ${MAKE} ${MFLAGS} pathnames.h ) ++ + ###################################################################### + # # + # Dependencies for the object files which make up this library. # +@@ -136,7 +141,7 @@ + strmatch.o: $(BUILD_DIR)/config.h + strmatch.o: $(BASHINCDIR)/stdc.h + +-glob.o: $(BUILD_DIR)/config.h ++glob.o: $(BUILD_DIR)/config.h $(topdir)/shell.h $(BUILD_DIR)/pathnames.h + glob.o: $(topdir)/bashtypes.h $(BASHINCDIR)/ansi_stdlib.h $(topdir)/bashansi.h + glob.o: $(BASHINCDIR)/posixstat.h $(BASHINCDIR)/memalloc.h + glob.o: strmatch.h glob.h diff --git a/app-shells/bash/files/bash-4.2-dev-fd-buffer-overflow.patch b/app-shells/bash/files/bash-4.2-dev-fd-buffer-overflow.patch new file mode 100644 index 000000000000..bef960ab980c --- /dev/null +++ b/app-shells/bash/files/bash-4.2-dev-fd-buffer-overflow.patch @@ -0,0 +1,46 @@ +https://bugs.gentoo.org/431850 + +this is a minor tweak to the upstream patch to also apply to bash 4.1/4.0/3.2 + + BASH PATCH REPORT + ================= + +Bash-Release: 4.2 +Patch-ID: bash42-033 + +Bug-Reported-by: David Leverton +Bug-Reference-ID: <4FCCE737.1060603@googlemail.com> +Bug-Reference-URL: + +Bug-Description: + +Bash uses a static buffer when expanding the /dev/fd prefix for the test +and conditional commands, among other uses, when it should use a dynamic +buffer to avoid buffer overflow. + +Patch (apply with `patch -p0'): + +*** ../bash-4.2-patched/lib/sh/eaccess.c 2011-01-08 20:50:10.000000000 -0500 +--- lib/sh/eaccess.c 2012-06-04 21:06:43.000000000 -0400 +*************** +*** 83,86 **** +--- 83,88 ---- + struct stat *finfo; + { ++ static char *pbuf = 0; ++ + if (*path == '\0') + { +*************** +*** 107,111 **** + On most systems, with the notable exception of linux, this is + effectively a no-op. */ +! char pbuf[32]; + strcpy (pbuf, DEV_FD_PREFIX); + strcat (pbuf, path + 8); +--- 109,113 ---- + On most systems, with the notable exception of linux, this is + effectively a no-op. */ +! pbuf = xrealloc (pbuf, sizeof (DEV_FD_PREFIX) + strlen (path + 8)); + strcpy (pbuf, DEV_FD_PREFIX); + strcat (pbuf, path + 8); diff --git a/app-shells/bash/files/bash-4.2-execute-job-control.patch b/app-shells/bash/files/bash-4.2-execute-job-control.patch new file mode 100644 index 000000000000..82b73e5157ca --- /dev/null +++ b/app-shells/bash/files/bash-4.2-execute-job-control.patch @@ -0,0 +1,24 @@ +fix build when job control is disabled + +http://lists.gnu.org/archive/html/bug-bash/2011-06/msg00110.html +http://lists.gnu.org/archive/html/bug-bash/2011-07/msg00057.html +http://lists.gnu.org/archive/html/bug-bash/2011-09/msg00039.html +https://bugs.gentoo.org/383237 + +should be fixed in next release of bash ... + +--- a/execute_cmd.c ++++ b/execute_cmd.c +@@ -2202,7 +2202,11 @@ + /* If the `lastpipe' option is set with shopt, and job control is not + enabled, execute the last element of non-async pipelines in the + current shell environment. */ +- if (lastpipe_opt && job_control == 0 && asynchronous == 0 && pipe_out == NO_PIPE && prev > 0) ++ if (lastpipe_opt && ++#if defined(JOB_CONTROL) ++ job_control == 0 && ++#endif ++ asynchronous == 0 && pipe_out == NO_PIPE && prev > 0) + { + lstdin = move_to_high_fd (0, 0, 255); + if (lstdin > 0) diff --git a/app-shells/bash/files/bash-4.2-no-readline.patch b/app-shells/bash/files/bash-4.2-no-readline.patch new file mode 100644 index 000000000000..14eb6bf421e9 --- /dev/null +++ b/app-shells/bash/files/bash-4.2-no-readline.patch @@ -0,0 +1,19 @@ +fix building when readline is disabled + +--- a/builtins/complete.def ++++ b/builtins/complete.def +@@ -49,6 +49,8 @@ $END + + #include + ++#ifdef READLINE ++ + #include + + #include "../bashtypes.h" +@@ -867,3 +869,5 @@ compopt_builtin (list) + + return (ret); + } ++ ++#endif diff --git a/app-shells/bash/files/bash-4.2-parallel-build.patch b/app-shells/bash/files/bash-4.2-parallel-build.patch new file mode 100644 index 000000000000..ab2de86206a3 --- /dev/null +++ b/app-shells/bash/files/bash-4.2-parallel-build.patch @@ -0,0 +1,106 @@ +https://lists.gnu.org/archive/html/bug-bash/2011-10/msg00036.html + +the current yacc rules allow multiple runs to generate the same files. usually +this doesn't come up as the generated files are shipped in the tarball, but +when you modify parse.y (applying a patch or developing or whatever), you can +hit this problem. + +simple way of showing this: + make -j y.tab.{c,h} +a correct system would not show the yacc parser running twice :) + +simple patch is to have the .h file depend on the .c file, and have the .h file +itself issue a dummy rule (to avoid make thinking things changed). + +--- a/Makefile.in ++++ b/Makefile.in +@@ -579,16 +579,17 @@ + + # old rules + GRAM_H = parser-built +-y.tab.o: y.tab.c ${GRAM_H} command.h ${BASHINCDIR}/stdc.h input.h ++y.tab.o: y.tab.h y.tab.c ${GRAM_H} command.h ${BASHINCDIR}/stdc.h input.h + ${GRAM_H}: y.tab.h + @-if test -f y.tab.h ; then \ + cmp -s $@ y.tab.h 2>/dev/null || cp -p y.tab.h $@; \ + fi +-y.tab.c y.tab.h: parse.y ++y.tab.c: parse.y + # -if test -f y.tab.h; then mv -f y.tab.h old-y.tab.h; fi + $(YACC) -d $(srcdir)/parse.y + touch parser-built + # -if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; else cp -p y.tab.h ${GRAM_H}; fi ++y.tab.h: y.tab.c ; @true + + # experimental new rules - work with GNU make but not BSD (or OSF) make + #y.tab.o: y.tab.c y.tab.h + +https://lists.gnu.org/archive/html/bug-bash/2011-10/msg00037.html + +the current code generates a bunch of local libraries in subdirs and then +links bash against that. those subdirs sometimes need version.h. so they +have a rule to change back up to the parent dir and build version.h (which is +fine). the trouble is that the top level objects and the subdirs are allowed +to build in parallel, so it's possible for multiple children to see that +version.h is not available and that it needs to be created, so they all do. + +there is even more trouble is that version.h depends on all the top level +sources, some of which are compiled (like syntax.c). so these parallel +children all kick off a job to generate syntax.c which in turn requires the +mksyntax helper executable. obviously multiple processes rm-ing, compiling, +and linking the same files quickly falls apart. + +so tweak the subdirs to all depend on the .build target which in turn depends +on all of these top level files being generated. now the subdirs won't try and +recursively enter the top level. + +(noticed by David James) + +--- a/Makefile.in ++++ b/Makefile.in +@@ -597,6 +598,11 @@ + # $(YACC) -d $(srcdir)/parse.y + # -if cmp -s old-y.tab.h y.tab.h; then mv old-y.tab.h y.tab.h; fi + ++# Subdirs will often times want version.h, so they'll change back up to ++# the top level and try to create it. This causes parallel build issues ++# so just force top level sanity before we descend. ++$(LIBDEP): .build ++ + $(READLINE_LIBRARY): config.h $(READLINE_SOURCE) + @echo making $@ in ${RL_LIBDIR} + @( { test "${RL_LIBDIR}" = "${libdir}" && exit 0; } || \ + +http://lists.gnu.org/archive/html/bug-bash/2011-10/msg00107.html + +the top level Makefile will recurse into the defdir for multiple targets +(libbuiltins.a, common.o, bashgetopt.o, builtext.h), and since these do +not have any declared interdependencies, parallel makes will recurse into +the subdir and build the respective targets. + +nothing depends on common.o or bashgetopt.o, so those targets don't get +used normally. this leaves libbuiltins.a and builtext.h. at a glance, +this shouldn't be a big deal, but when we look closer, there's a subtle +failure lurking. + +most of the objects in the defdir need to be generated which means they +need to build+link the local mkbuiltins helper. the builtext.h header +also needs to be generated by the mkbuiltins helper. so when the top +level launches a child for libbuiltins.a and a child for builtext.h, we +can hit a race condition where the two try to generate mkbuiltins, and +the build randomly fails. + +so update libbuiltins.a to depend on builtext.h. this should be fairly +simple since it's only a single target. + +--- a/Makefile.in ++++ b/Makefile.in +@@ -674,7 +674,7 @@ + $(RM) $@ + ./mksyntax$(EXEEXT) -o $@ + +-$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h version.h ++$(BUILTINS_LIBRARY): $(BUILTIN_DEFS) $(BUILTIN_C_SRC) config.h ${BASHINCDIR}/memalloc.h ${DEFDIR}/builtext.h version.h + @(cd $(DEFDIR) && $(MAKE) $(MFLAGS) DEBUG=${DEBUG} libbuiltins.a ) || exit 1 + + # these require special rules to circumvent make builtin rules diff --git a/app-shells/bash/files/bash-4.2-read-retry.patch b/app-shells/bash/files/bash-4.2-read-retry.patch new file mode 100644 index 000000000000..44903c68afe1 --- /dev/null +++ b/app-shells/bash/files/bash-4.2-read-retry.patch @@ -0,0 +1,41 @@ +https://bugs.gentoo.org/447810 + +fix from upstream to workaround broken BSD kernels + +commit 208fdb509e072977ae7a621e916dfcd32c76047d +Author: Chet Ramey +Date: Mon Mar 4 08:09:29 2013 -0500 + + commit bash-20130201 snapshot + +diff --git a/redir.c b/redir.c +index d7da2f3..aa3d16d 100644 +--- a/redir.c ++++ b/redir.c +@@ -650,7 +650,7 @@ redir_open (filename, flags, mode, ri) + int flags, mode; + enum r_instruction ri; + { +- int fd, r; ++ int fd, r, e; + + r = find_string_in_alist (filename, _redir_special_filenames, 1); + if (r >= 0) +@@ -666,7 +666,16 @@ redir_open (filename, flags, mode, ri) + } + else + { +- fd = open (filename, flags, mode); ++ do ++ { ++ fd = open (filename, flags, mode); ++ e = errno; ++ if (fd < 0 && e == EINTR) ++ QUIT; ++ errno = e; ++ } ++ while (fd < 0 && errno == EINTR); ++ + #if defined (AFS) + if ((fd < 0) && (errno == EACCES)) + { diff --git a/app-shells/bash/files/bash-4.2-speed-up-read-N.patch b/app-shells/bash/files/bash-4.2-speed-up-read-N.patch new file mode 100644 index 000000000000..b96ad0c887e1 --- /dev/null +++ b/app-shells/bash/files/bash-4.2-speed-up-read-N.patch @@ -0,0 +1,112 @@ +http://lists.gnu.org/archive/html/bug-bash/2012-11/msg00034.html + +From 530d4988afd68ea9d2cf1b0267d4dc821d0d204f Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Mon, 19 Nov 2012 17:58:51 -0500 +Subject: [PATCH] bash: speed up `read -N` + +Rather than using 1 byte reads, use the existing cache read logic. +This could be sped up more, but this change is not as invasive and +should (hopefully) be fairly safe. + +Signed-off-by: Mike Frysinger +--- + builtins/read.def | 21 ++++++++++++++++----- + externs.h | 1 + + lib/sh/zread.c | 15 +++++++++++++-- + 3 files changed, 30 insertions(+), 7 deletions(-) + +diff --git a/builtins/read.def b/builtins/read.def +index e32dec7..81a1b3f 100644 +--- a/builtins/read.def ++++ b/builtins/read.def +@@ -457,7 +457,10 @@ read_builtin (list) + interrupt_immediately++; + terminate_immediately++; + +- unbuffered_read = (nchars > 0) || (delim != '\n') || input_is_pipe; ++ if ((nchars > 0) && !input_is_tty && ignore_delim) ++ unbuffered_read = 2; ++ else if ((nchars > 0) || (delim != '\n') || input_is_pipe) ++ unbuffered_read = 1; + + if (prompt && edit == 0) + { +@@ -505,10 +508,18 @@ read_builtin (list) + print_ps2 = 0; + } + +- if (unbuffered_read) +- retval = zread (fd, &c, 1); +- else +- retval = zreadc (fd, &c); ++ switch (unbuffered_read) ++ { ++ case 2: ++ retval = zreadcn (fd, &c, nchars - nr); ++ break; ++ case 1: ++ retval = zread (fd, &c, 1); ++ break; ++ default: ++ retval = zreadc (fd, &c); ++ break; ++ } + + if (retval <= 0) + { +diff --git a/externs.h b/externs.h +index 09244fa..a5ad645 100644 +--- a/externs.h ++++ b/externs.h +@@ -479,6 +479,7 @@ extern ssize_t zread __P((int, char *, size_t)); + extern ssize_t zreadretry __P((int, char *, size_t)); + extern ssize_t zreadintr __P((int, char *, size_t)); + extern ssize_t zreadc __P((int, char *)); ++extern ssize_t zreadcn __P((int, char *, int)); + extern ssize_t zreadcintr __P((int, char *)); + extern void zreset __P((void)); + extern void zsyncfd __P((int)); +diff --git a/lib/sh/zread.c b/lib/sh/zread.c +index 5db21a9..af7d02b 100644 +--- a/lib/sh/zread.c ++++ b/lib/sh/zread.c +@@ -101,15 +101,18 @@ static char lbuf[128]; + static size_t lind, lused; + + ssize_t +-zreadc (fd, cp) ++zreadcn (fd, cp, len) + int fd; + char *cp; ++ int len; + { + ssize_t nr; + + if (lind == lused || lused == 0) + { +- nr = zread (fd, lbuf, sizeof (lbuf)); ++ if (len > sizeof (lbuf)) ++ len = sizeof (lbuf); ++ nr = zread (fd, lbuf, len); + lind = 0; + if (nr <= 0) + { +@@ -123,6 +126,14 @@ zreadc (fd, cp) + return 1; + } + ++ssize_t ++zreadc (fd, cp) ++ int fd; ++ char *cp; ++{ ++ return zreadcn (fd, cp, sizeof (lbuf)); ++} ++ + /* Don't mix calls to zreadc and zreadcintr in the same function, since they + use the same local buffer. */ + ssize_t +-- +1.7.12.4 + diff --git a/app-shells/bash/files/bash-4.3-append-process-segfault.patch b/app-shells/bash/files/bash-4.3-append-process-segfault.patch new file mode 100644 index 000000000000..6c9b2e83067a --- /dev/null +++ b/app-shells/bash/files/bash-4.3-append-process-segfault.patch @@ -0,0 +1,18 @@ +https://lists.gnu.org/archive/html/bug-bash/2014-08/msg00048.html + +*** ../bash-4.3-patched/execute_cmd.c 2014-07-30 10:26:52.000000000 -0400 +--- execute_cmd.c 2014-08-11 16:55:57.000000000 -0400 +*************** +*** 2406,2410 **** + { + #if defined (JOB_CONTROL) +! append_process (savestring (the_printed_command), dollar_dollar_pid, exec_result, lastpipe_jid); + #endif + lstdin = wait_for (lastpid); +--- 2433,2438 ---- + { + #if defined (JOB_CONTROL) +! if (INVALID_JOB (lastpipe_jid) == 0) +! append_process (savestring (the_printed_command_except_trap), dollar_dollar_pid, exec_result, lastpipe_jid); + #endif + lstdin = wait_for (lastpid); diff --git a/app-shells/bash/files/bash-4.3-arrayfunc.patch b/app-shells/bash/files/bash-4.3-arrayfunc.patch new file mode 100644 index 000000000000..f44d18478454 --- /dev/null +++ b/app-shells/bash/files/bash-4.3-arrayfunc.patch @@ -0,0 +1,15 @@ +http://lists.gnu.org/archive/html/bug-bash/2014-11/msg00178.html + +diff --git a/arrayfunc.c b/arrayfunc.c +index 804e6da..0f900aa 100644 +--- a/arrayfunc.c ++++ b/arrayfunc.c +@@ -498,7 +498,7 @@ assign_compound_array_list (var, nlist, flags) + + for (list = nlist; list; list = list->next) + { +- iflags = flags; ++ iflags = (flags & ~ASS_APPEND); + w = list->word->word; + + /* We have a word of the form [ind]=value */ diff --git a/app-shells/bash/files/bash-4.3-compat-lvl.patch b/app-shells/bash/files/bash-4.3-compat-lvl.patch new file mode 100644 index 000000000000..5734687ffeb9 --- /dev/null +++ b/app-shells/bash/files/bash-4.3-compat-lvl.patch @@ -0,0 +1,13 @@ +https://lists.gnu.org/archive/html/bug-bash/2014-06/msg00046.html + +--- a/builtins/shopt.def ++++ b/builtins/shopt.def +@@ -160,7 +160,7 @@ static struct { + { "compat32", &shopt_compat32, set_compatibility_level }, + { "compat40", &shopt_compat40, set_compatibility_level }, + { "compat41", &shopt_compat41, set_compatibility_level }, +- { "compat42", &shopt_compat41, set_compatibility_level }, ++ { "compat42", &shopt_compat42, set_compatibility_level }, + #if defined (READLINE) + { "complete_fullquote", &complete_fullquote, (shopt_set_func_t *)NULL}, + { "direxpand", &dircomplete_expand, shopt_set_complete_direxpand }, diff --git a/app-shells/bash/files/bash-4.3-mapfile-improper-array-name-validation.patch b/app-shells/bash/files/bash-4.3-mapfile-improper-array-name-validation.patch new file mode 100644 index 000000000000..20bf340fdbd3 --- /dev/null +++ b/app-shells/bash/files/bash-4.3-mapfile-improper-array-name-validation.patch @@ -0,0 +1,13 @@ +http://lists.gnu.org/archive/html/bug-bash/2014-11/msg00097.html + +--- bash-4.3/builtins/mapfile.def ++++ bash-4.3/builtins/mapfile.def +@@ -339,7 +339,7 @@ + else + array_name = list->word->word; + +- if (legal_identifier (array_name) == 0 && valid_array_reference (array_name) == 0) ++ if (legal_identifier (array_name) == 0) + { + sh_invalidid (array_name); + return (EXECUTION_FAILURE); diff --git a/app-shells/bash/files/bash-4.3-protos.patch b/app-shells/bash/files/bash-4.3-protos.patch new file mode 100644 index 000000000000..7af84ff707f3 --- /dev/null +++ b/app-shells/bash/files/bash-4.3-protos.patch @@ -0,0 +1,10 @@ +--- a/redir.c ++++ b/redir.c +@@ -31,6 +31,7 @@ + #endif + #include "filecntl.h" + #include "posixstat.h" ++#include "trap.h" + + #if defined (HAVE_UNISTD_H) + # include diff --git a/app-shells/bash/files/bash-4.4-popd-offset-overflow.patch b/app-shells/bash/files/bash-4.4-popd-offset-overflow.patch new file mode 100644 index 000000000000..c6ef19d03f5a --- /dev/null +++ b/app-shells/bash/files/bash-4.4-popd-offset-overflow.patch @@ -0,0 +1,30 @@ +https://bugs.gentoo.org/600174 +https://lists.gnu.org/archive/html/bug-bash/2016-11/msg00099.html + +*** ../bash-4.4-patched/builtins/pushd.def 2016-01-25 13:31:49.000000000 -0500 +--- builtins/pushd.def 2016-10-28 10:46:49.000000000 -0400 +*************** +*** 366,370 **** + } + +! if (which > directory_list_offset || (directory_list_offset == 0 && which == 0)) + { + pushd_error (directory_list_offset, which_word ? which_word : ""); +--- 366,370 ---- + } + +! if (which > directory_list_offset || (which < -directory_list_offset) || (directory_list_offset == 0 && which == 0)) + { + pushd_error (directory_list_offset, which_word ? which_word : ""); +*************** +*** 388,391 **** +--- 388,396 ---- + of the list into place. */ + i = (direction == '+') ? directory_list_offset - which : which; ++ if (i < 0 || i > directory_list_offset) ++ { ++ pushd_error (directory_list_offset, which_word ? which_word : ""); ++ return (EXECUTION_FAILURE); ++ } + free (pushd_directory_list[i]); + directory_list_offset--; diff --git a/app-shells/bash/files/bash-4.x-deferred-heredocs.patch b/app-shells/bash/files/bash-4.x-deferred-heredocs.patch new file mode 100644 index 000000000000..698d277a3db5 --- /dev/null +++ b/app-shells/bash/files/bash-4.x-deferred-heredocs.patch @@ -0,0 +1,47 @@ +http://bugs.gentoo.org/310197 +http://lists.gnu.org/archive/html/bug-bash/2010-03/msg00063.html + +fix heredocs handling in `set` output + +*** ../bash-4.1-patched/print_cmd.c 2009-09-16 15:32:26.000000000 -0400 +--- print_cmd.c 2010-03-22 21:15:30.000000000 -0400 +*************** +*** 114,117 **** +--- 114,123 ---- + #define CHECK_XTRACE_FP xtrace_fp = (xtrace_fp ? xtrace_fp : stderr) + ++ #define PRINT_DEFERRED_HEREDOCS(x) \ ++ do { \ ++ if (deferred_heredocs) \ ++ print_deferred_heredocs (x); \ ++ } while (0) ++ + /* Non-zero means the stuff being printed is inside of a function def. */ + static int inside_function_def; +*************** +*** 561,571 **** + { + print_for_command_head (for_command); +- + cprintf (";"); + newline ("do\n"); + indentation += indentation_amount; + make_command_string_internal (for_command->action); + semicolon (); + indentation -= indentation_amount; + newline ("done"); + } +--- 566,578 ---- + { + print_for_command_head (for_command); + cprintf (";"); + newline ("do\n"); ++ + indentation += indentation_amount; + make_command_string_internal (for_command->action); ++ PRINT_DEFERRED_HEREDOCS (""); + semicolon (); + indentation -= indentation_amount; ++ + newline ("done"); + } diff --git a/app-shells/bash/files/bash_logout b/app-shells/bash/files/bash_logout new file mode 100644 index 000000000000..50a79331c08e --- /dev/null +++ b/app-shells/bash/files/bash_logout @@ -0,0 +1,9 @@ +# /etc/bash/bash_logout + +# This file is sourced when a login shell terminates. + +# You may wish to clear everyone's screen when they logout. +#clear + +# Or maybe you want to leave a thoughtful note. +#fortune diff --git a/app-shells/bash/files/bashrc b/app-shells/bash/files/bashrc new file mode 100644 index 000000000000..03694691d4a7 --- /dev/null +++ b/app-shells/bash/files/bashrc @@ -0,0 +1,113 @@ +# /etc/bash/bashrc +# +# This file is sourced by all *interactive* bash shells on startup, +# including some apparently interactive shells such as scp and rcp +# that can't tolerate any output. So make sure this doesn't display +# anything or bad things will happen ! + + +# Test for an interactive shell. There is no need to set anything +# past this point for scp and rcp, and it's important to refrain from +# outputting anything in those cases. +if [[ $- != *i* ]] ; then + # Shell is non-interactive. Be done now! + return +fi + +# Bash won't get SIGWINCH if another process is in the foreground. +# Enable checkwinsize so that bash will check the terminal size when +# it regains control. #65623 +# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11) +shopt -s checkwinsize + +# Disable completion when the input buffer is empty. i.e. Hitting tab +# and waiting a long time for bash to expand all of $PATH. +shopt -s no_empty_cmd_completion + +# Enable history appending instead of overwriting when exiting. #139609 +shopt -s histappend + +# Save each command to the history file as it's executed. #517342 +# This does mean sessions get interleaved when reading later on, but this +# way the history is always up to date. History is not synced across live +# sessions though; that is what `history -n` does. +# Disabled by default due to concerns related to system recovery when $HOME +# is under duress, or lives somewhere flaky (like NFS). Constantly syncing +# the history will halt the shell prompt until it's finished. +#PROMPT_COMMAND='history -a' + +# Change the window title of X terminals +case ${TERM} in + [aEkx]term*|rxvt*|gnome*|konsole*|interix) + PS1='\[\033]0;\u@\h:\w\007\]' + ;; + screen*) + PS1='\[\033k\u@\h:\w\033\\\]' + ;; + *) + unset PS1 + ;; +esac + +# Set colorful PS1 only on colorful terminals. +# dircolors --print-database uses its own built-in database +# instead of using /etc/DIR_COLORS. Try to use the external file +# first to take advantage of user additions. +# We run dircolors directly due to its changes in file syntax and +# terminal name patching. +use_color=false +if type -P dircolors >/dev/null ; then + # Enable colors for ls, etc. Prefer ~/.dir_colors #64489 + LS_COLORS= + if [[ -f ~/.dir_colors ]] ; then + eval "$(dircolors -b ~/.dir_colors)" + elif [[ -f /etc/DIR_COLORS ]] ; then + eval "$(dircolors -b /etc/DIR_COLORS)" + else + eval "$(dircolors -b)" + fi + # Note: We always evaluate the LS_COLORS setting even when it's the + # default. If it isn't set, then `ls` will only colorize by default + # based on file attributes and ignore extensions (even the compiled + # in defaults of dircolors). #583814 + if [[ -n ${LS_COLORS:+set} ]] ; then + use_color=true + else + # Delete it if it's empty as it's useless in that case. + unset LS_COLORS + fi +else + # Some systems (e.g. BSD & embedded) don't typically come with + # dircolors so we need to hardcode some terminals in here. + case ${TERM} in + [aEkx]term*|rxvt*|gnome*|konsole*|screen|cons25|*color) use_color=true;; + esac +fi + +if ${use_color} ; then + if [[ ${EUID} == 0 ]] ; then + PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \w \$\[\033[00m\] ' + else + PS1+='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' + fi + + #BSD#@export CLICOLOR=1 + #GNU#@alias ls='ls --color=auto' + alias grep='grep --colour=auto' + alias egrep='egrep --colour=auto' + alias fgrep='fgrep --colour=auto' +else + if [[ ${EUID} == 0 ]] ; then + # show root@ when we don't have colors + PS1+='\u@\h \w \$ ' + else + PS1+='\u@\h \w \$ ' + fi +fi + +for sh in /etc/bash/bashrc.d/* ; do + [[ -r ${sh} ]] && source "${sh}" +done + +# Try to keep environment pollution down, EPA loves us. +unset use_color sh diff --git a/app-shells/bash/files/dot-bash_logout b/app-shells/bash/files/dot-bash_logout new file mode 100644 index 000000000000..44b6f79ca8eb --- /dev/null +++ b/app-shells/bash/files/dot-bash_logout @@ -0,0 +1,6 @@ +# /etc/skel/.bash_logout + +# This file is sourced when a login shell terminates. + +# Clear the screen for security's sake. +clear diff --git a/app-shells/bash/files/dot-bash_profile b/app-shells/bash/files/dot-bash_profile new file mode 100644 index 000000000000..1de05a45e34a --- /dev/null +++ b/app-shells/bash/files/dot-bash_profile @@ -0,0 +1,7 @@ +# /etc/skel/.bash_profile + +# This file is sourced by bash for login shells. The following line +# runs your .bashrc and is recommended by the bash info pages. +if [[ -f ~/.bashrc ]] ; then + . ~/.bashrc +fi diff --git a/app-shells/bash/files/dot-bashrc b/app-shells/bash/files/dot-bashrc new file mode 100644 index 000000000000..34dbd8c892f6 --- /dev/null +++ b/app-shells/bash/files/dot-bashrc @@ -0,0 +1,18 @@ +# /etc/skel/.bashrc +# +# This file is sourced by all *interactive* bash shells on startup, +# including some apparently interactive shells such as scp and rcp +# that can't tolerate any output. So make sure this doesn't display +# anything or bad things will happen ! + + +# Test for an interactive shell. There is no need to set anything +# past this point for scp and rcp, and it's important to refrain from +# outputting anything in those cases. +if [[ $- != *i* ]] ; then + # Shell is non-interactive. Be done now! + return +fi + + +# Put your fun stuff here. -- cgit v1.2.3