diff options
Diffstat (limited to 'meta/recipes-extended/bash/bash')
10 files changed, 351 insertions, 140 deletions
diff --git a/meta/recipes-extended/bash/bash/0001-changes-to-SIGINT-handler-while-waiting-for-a-child-.patch b/meta/recipes-extended/bash/bash/0001-changes-to-SIGINT-handler-while-waiting-for-a-child-.patch new file mode 100644 index 0000000000..77d770b364 --- /dev/null +++ b/meta/recipes-extended/bash/bash/0001-changes-to-SIGINT-handler-while-waiting-for-a-child-.patch @@ -0,0 +1,226 @@ +From 721d5be99eb37d31e48bd66d61808a66a4c5ab84 Mon Sep 17 00:00:00 2001 +From: Chet Ramey <chet.ramey@case.edu> +Date: Mon, 30 Oct 2023 12:16:07 -0400 +Subject: [PATCH] changes to SIGINT handler while waiting for a child; skip + vertical whitespace after translating an integer + +Upstream-Status: Backport from +[https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=fe24a6a55e8850298b496c5b9d82f1866eba190e] + +[Adjust and drop some codes to be applicable the tree] + +Signed-off-by: Xiangyu Chen <xiangyu.chen@windriver.com> +--- + general.c | 5 +++-- + jobs.c | 24 ++++++++++++++++-------- + tests/redir.right | 4 ++-- + tests/redir11.sub | 2 ++ + tests/type.right | 16 ++++++++-------- + tests/type.tests | 24 ++++++++++++------------ + 6 files changed, 43 insertions(+), 32 deletions(-) + +diff --git a/general.c b/general.c +index 85c5a8b6..65e2ee06 100644 +--- a/general.c ++++ b/general.c +@@ -262,8 +262,9 @@ legal_number (string, result) + if (errno || ep == string) + return 0; /* errno is set on overflow or underflow */ + +- /* Skip any trailing whitespace, since strtoimax does not. */ +- while (whitespace (*ep)) ++ /* Skip any trailing whitespace, since strtoimax does not, using the same ++ test that strtoimax uses for leading whitespace. */ ++ while (isspace ((unsigned char) *ep)) + ep++; + + /* If *string is not '\0' but *ep is '\0' on return, the entire string +diff --git a/jobs.c b/jobs.c +index 6b986ed7..262d78de 100644 +--- a/jobs.c ++++ b/jobs.c +@@ -2718,6 +2718,10 @@ wait_for_background_pids (ps) + #define INVALID_SIGNAL_HANDLER (SigHandler *)wait_for_background_pids + static SigHandler *old_sigint_handler = INVALID_SIGNAL_HANDLER; + ++/* The current SIGINT handler as set by restore_sigint_handler. Only valid ++ immediately after restore_sigint_handler, used for continuations. */ ++static SigHandler *cur_sigint_handler = INVALID_SIGNAL_HANDLER; ++ + static int wait_sigint_received; + static int child_caught_sigint; + +@@ -2735,6 +2739,7 @@ wait_sigint_cleanup () + static void + restore_sigint_handler () + { ++ cur_sigint_handler = old_sigint_handler; + if (old_sigint_handler != INVALID_SIGNAL_HANDLER) + { + set_signal_handler (SIGINT, old_sigint_handler); +@@ -2758,8 +2763,7 @@ wait_sigint_handler (sig) + restore_sigint_handler (); + /* If we got a SIGINT while in `wait', and SIGINT is trapped, do + what POSIX.2 says (see builtins/wait.def for more info). */ +- if (this_shell_builtin && this_shell_builtin == wait_builtin && +- signal_is_trapped (SIGINT) && ++ if (signal_is_trapped (SIGINT) && + ((sigint_handler = trap_to_sighandler (SIGINT)) == trap_handler)) + { + trap_handler (SIGINT); /* set pending_traps[SIGINT] */ +@@ -2782,6 +2786,8 @@ wait_sigint_handler (sig) + { + set_exit_status (128+SIGINT); + restore_sigint_handler (); ++ if (cur_sigint_handler == INVALID_SIGNAL_HANDLER) ++ set_sigint_handler (); /* XXX - only do this in one place */ + kill (getpid (), SIGINT); + } + +@@ -2926,11 +2932,13 @@ wait_for (pid, flags) + { + SigHandler *temp_sigint_handler; + +- temp_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler); +- if (temp_sigint_handler == wait_sigint_handler) +- internal_debug ("wait_for: recursively setting old_sigint_handler to wait_sigint_handler: running_trap = %d", running_trap); +- else +- old_sigint_handler = temp_sigint_handler; ++ temp_sigint_handler = old_sigint_handler; ++ old_sigint_handler = set_signal_handler (SIGINT, wait_sigint_handler); ++ if (old_sigint_handler == wait_sigint_handler) ++ { ++ internal_debug ("wait_for: recursively setting old_sigint_handler to wait_sigint_handler: running_trap = %d", running_trap); ++ old_sigint_handler = temp_sigint_handler; ++ } + waiting_for_child = 0; + if (old_sigint_handler == SIG_IGN) + set_signal_handler (SIGINT, old_sigint_handler); +@@ -4136,7 +4144,7 @@ set_job_status_and_cleanup (job) + SIGINT (if we reset the sighandler to the default). + In this case, we have to fix things up. What a crock. */ + if (temp_handler == trap_handler && signal_is_trapped (SIGINT) == 0) +- temp_handler = trap_to_sighandler (SIGINT); ++ temp_handler = trap_to_sighandler (SIGINT); + restore_sigint_handler (); + if (temp_handler == SIG_DFL) + termsig_handler (SIGINT); /* XXX */ +diff --git a/tests/redir.right b/tests/redir.right +index 8db10414..9e1403c8 100644 +--- a/tests/redir.right ++++ b/tests/redir.right +@@ -154,10 +154,10 @@ foo + 1 + 7 + after: 42 +-./redir11.sub: line 53: $(ss= declare -i ss): ambiguous redirect ++./redir11.sub: line 55: $(ss= declare -i ss): ambiguous redirect + after: 42 + a+=3 + foo + foo +-./redir11.sub: line 75: 42: No such file or directory ++./redir11.sub: line 77: 42: No such file or directory + 42 +diff --git a/tests/redir11.sub b/tests/redir11.sub +index d417cdb6..ca9854cd 100644 +--- a/tests/redir11.sub ++++ b/tests/redir11.sub +@@ -34,6 +34,8 @@ a=4 b=7 ss=4 declare -i ss + a=4 b=7 foo + echo after: $a + ++exec 7>&- 4>&- ++ + unset a + a=4 echo foo 2>&1 >&$(foo) | { grep -q 'Bad file' || echo 'redir11 bad 3'; } + a=1 echo foo 2>&1 >&$(foo) | { grep -q 'Bad file' || echo 'redir11 bad 4'; } +diff --git a/tests/type.right b/tests/type.right +index bbc228e8..e0a66745 100644 +--- a/tests/type.right ++++ b/tests/type.right +@@ -24,15 +24,15 @@ func () + } + while + while is a shell keyword +-./type.tests: line 56: type: m: not found +-alias m='more' +-alias m='more' +-m is aliased to `more' ++./type.tests: line 56: type: morealias: not found ++alias morealias='more' ++alias morealias='more' ++morealias is aliased to `more' + alias +-alias m='more' +-alias m='more' +-alias m='more' +-m is aliased to `more' ++alias morealias='more' ++alias morealias='more' ++alias morealias='more' ++morealias is aliased to `more' + builtin + builtin is a shell builtin + /bin/sh +diff --git a/tests/type.tests b/tests/type.tests +index fd39c18a..ddc15407 100644 +--- a/tests/type.tests ++++ b/tests/type.tests +@@ -25,8 +25,6 @@ type -r ${THIS_SH} + type notthere + command -v notthere + +-alias m=more +- + unset -f func 2>/dev/null + func() { echo this is func; } + +@@ -49,24 +47,26 @@ command -V func + command -v while + command -V while + ++alias morealias=more ++ + # the following two lines should produce the same output + # post-3.0 patch makes command -v silent, as posix specifies + # first test with alias expansion off (should all fail or produce no output) +-type -t m +-type m +-command -v m ++type -t morealias ++type morealias ++command -v morealias + alias -p +-alias m ++alias morealias + + # then test with alias expansion on + shopt -s expand_aliases +-type m +-type -t m +-command -v m ++type morealias ++type -t morealias ++command -v morealias + alias -p +-alias m ++alias morealias + +-command -V m ++command -V morealias + shopt -u expand_aliases + + command -v builtin +@@ -76,7 +76,7 @@ command -V /bin/sh + + unset -f func + type func +-unalias m ++unalias morealias + type m + + hash -r +-- +2.35.5 + diff --git a/meta/recipes-extended/bash/bash/0001-help-fix-printf-format-security-warning.patch b/meta/recipes-extended/bash/bash/0001-help-fix-printf-format-security-warning.patch deleted file mode 100644 index 5405c84c78..0000000000 --- a/meta/recipes-extended/bash/bash/0001-help-fix-printf-format-security-warning.patch +++ /dev/null @@ -1,35 +0,0 @@ -From e5837a42f8f48a6a721805ff8f7fcd32861d09ca Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <adraszik@tycoint.com> -Date: Tue, 26 Jul 2016 13:09:47 +0100 -Subject: [PATCH] help: fix printf() format security warning -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -| ../../bash-4.3.30/builtins/../../bash-4.3.30/builtins/help.def: In function 'help_builtin': -| ../../bash-4.3.30/builtins/../../bash-4.3.30/builtins/help.def:130:7: error: format not a string literal and no format arguments [-Werror=format-security] -| printf (ngettext ("Shell commands matching keyword `", "Shell commands matching keywords `", (list->next ? 2 : 1))); -| ^~~~~~ - -Signed-off-by: André Draszik <adraszik@tycoint.com> ---- -Upstream-Status: Pending - builtins/help.def | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/builtins/help.def b/builtins/help.def -index 1894f17..cf624c6 100644 ---- a/builtins/help.def -+++ b/builtins/help.def -@@ -127,7 +127,7 @@ help_builtin (list) - - if (glob_pattern_p (list->word->word)) - { -- printf (ngettext ("Shell commands matching keyword `", "Shell commands matching keywords `", (list->next ? 2 : 1))); -+ printf ("%s", ngettext ("Shell commands matching keyword `", "Shell commands matching keywords `", (list->next ? 2 : 1))); - print_word_list (list, ", "); - printf ("'\n\n"); - } --- -2.8.1 - diff --git a/meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch b/meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch deleted file mode 100644 index 9fb6ba972b..0000000000 --- a/meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch +++ /dev/null @@ -1,35 +0,0 @@ -From d3b6303a6853f612a56848ee4e59eaa0b0ab9489 Mon Sep 17 00:00:00 2001 -From: Zhang Xiao <xiao.zhang@windriver.com> -Date: Tue, 21 Feb 2017 11:30:14 +0800 -Subject: [PATCH] bash: memleak bug fix for builtin command read - -Built in command "read" with "-e" use Readline to obtain the line -in an interactive shell. In this process, a string "rlbuf" is -just allocated without free operation thus cause memory leak. Fix it. - -Upstream-Status: Submitted [http://lists.gnu.org/archive/html/bug-bash/2017-02/msg00061.html] - -Signed-off-by: Zhang Xiao <xiao.zhang@windriver.com> ---- - builtins/read.def | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/builtins/read.def b/builtins/read.def -index 4397154..ee0c5a6 100644 ---- a/builtins/read.def -+++ b/builtins/read.def -@@ -674,6 +674,11 @@ add_char: - input_string[i] = '\0'; - CHECK_ALRM; - -+#if defined (READLINE) -+ if (edit) -+ xfree (rlbuf); -+#endif -+ - if (retval < 0) - { - t_errno = errno; --- -1.9.1 - diff --git a/meta/recipes-extended/bash/bash/build-tests.patch b/meta/recipes-extended/bash/bash/build-tests.patch index 73a81b60da..c1b9b8261f 100644 --- a/meta/recipes-extended/bash/bash/build-tests.patch +++ b/meta/recipes-extended/bash/bash/build-tests.patch @@ -1,16 +1,24 @@ -Add 'ptest' target to Makefile, to run tests without checking dependencies. +From 318b762837c2ad25319caeaf0320eff613b64daf Mon Sep 17 00:00:00 2001 +From: Anders Roxell <anders.roxell@enea.com> +Date: Wed, 19 Dec 2012 17:18:31 +0100 +Subject: [PATCH] Add 'ptest' target to Makefile, to run tests without checking + dependencies. -Upstream-Status: Pending +Upstream-Status: Inappropriate [ptest specific] Signed-off-by: Anders Roxell <anders.roxell@enea.com> + +Rebase to 5.0 Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> + --- Makefile.in | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Makefile.in b/Makefile.in +index bc97049..937ce39 100644 --- a/Makefile.in +++ b/Makefile.in -@@ -848,20 +848,34 @@ maybe-clean: +@@ -943,20 +943,34 @@ maybe-clean: fi recho$(EXEEXT): $(SUPPORT_SRC)recho.c @@ -48,8 +56,5 @@ diff --git a/Makefile.in b/Makefile.in + +runtest: @( cd $(srcdir)/tests && \ - PATH=$(BUILD_DIR)/tests:$$PATH THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} ) + BUILD_DIR=$(BUILD_DIR) PATH=$(BUILD_DIR)/tests:$$PATH THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} ) --- -1.8.1.2 - diff --git a/meta/recipes-extended/bash/bash/execute_cmd.patch b/meta/recipes-extended/bash/bash/execute_cmd.patch deleted file mode 100644 index 81f8f0a9cd..0000000000 --- a/meta/recipes-extended/bash/bash/execute_cmd.patch +++ /dev/null @@ -1,17 +0,0 @@ -Upstream-Status: Inappropriate [embedded specific] - ---- execute_cmd.c.orig Fri Jun 3 13:34:42 2011 -+++ execute_cmd.c Fri Jun 3 13:36:41 2011 -@@ -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/meta/recipes-extended/bash/bash/fix-filesubst-errexit.patch b/meta/recipes-extended/bash/bash/fix-filesubst-errexit.patch new file mode 100644 index 0000000000..60f1852316 --- /dev/null +++ b/meta/recipes-extended/bash/bash/fix-filesubst-errexit.patch @@ -0,0 +1,34 @@ +From 59ddfda14e3c9aa6286bb4c4c0748f7c1324a65a Mon Sep 17 00:00:00 2001 +From: Chet Ramey <chet.ramey@case.edu> +Date: Fri, 7 Apr 2023 00:28:46 -0700 +Subject: [PATCH] $(<nosuchfile) is no longer a fatal error with errexit + enabled + +This is a trimmed-down version of a commit in the bash 'devel' branch +[1] that contains this fix as well as other unrelated ones. + +[1] https://git.savannah.gnu.org/cgit/bash.git/commit/?h=devel&id=ec9447ce9392a0f93d96789c3741285fede8a150 + +Upstream-Status: Backport + +Signed-off-by: Zev Weiss <zev@bewilderbeest.net> +--- + builtins/evalstring.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/builtins/evalstring.c b/builtins/evalstring.c +index df3dd68e2a7e..6612081cd646 100644 +--- a/builtins/evalstring.c ++++ b/builtins/evalstring.c +@@ -753,7 +753,7 @@ open_redir_file (r, fnp) + fd = open(fn, O_RDONLY); + if (fd < 0) + { +- file_error (fn); ++ internal_error ("%s: %s", fn, strerror (errno)); + free (fn); + if (fnp) + *fnp = 0; +-- +2.40.0 + diff --git a/meta/recipes-extended/bash/bash/fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch b/meta/recipes-extended/bash/bash/fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch deleted file mode 100644 index 9ac2461ab6..0000000000 --- a/meta/recipes-extended/bash/bash/fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch +++ /dev/null @@ -1,45 +0,0 @@ -From d1cd4c31ea0ed7406a3ad4bdaa211f581063f655 Mon Sep 17 00:00:00 2001 -From: Hongxu Jia <hongxu.jia@windriver.com> -Date: Tue, 15 Aug 2017 10:21:21 +0800 -Subject: [PATCH 2/2] fix run-execscript/run-test/ failed - -FAIL: run-execscript: -the test suite should not be run as root - -FAIL: run-test -the test suite should not be run as root - -Upstream-Status: Pending - -Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> ---- - tests/run-execscript | 3 ++- - tests/run-test | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/tests/run-execscript b/tests/run-execscript -index de78644..38397c1 100644 ---- a/tests/run-execscript -+++ b/tests/run-execscript -@@ -5,5 +5,6 @@ echo "warning: \`/tmp/bash-notthere' not being found or \`/' being a directory" - echo "warning: produce diff output, please do not consider this a test failure" >&2 - echo "warning: if diff output differing only in the location of the bash" >&2 - echo "warning: binary appears, please do not consider this a test failure" >&2 --${THIS_SH} ./execscript > ${BASH_TSTOUT} 2>&1 -+rm -f ${BASH_TSTOUT} -+su -c "${THIS_SH} ./execscript > ${BASH_TSTOUT} 2>&1" test - diff ${BASH_TSTOUT} exec.right && rm -f ${BASH_TSTOUT} -diff --git a/tests/run-test b/tests/run-test -index d68791c..d6317d2 100644 ---- a/tests/run-test -+++ b/tests/run-test -@@ -1,4 +1,5 @@ - unset GROUPS UID 2>/dev/null - --${THIS_SH} ./test.tests >${BASH_TSTOUT} 2>&1 -+rm -f ${BASH_TSTOUT} -+su -c "${THIS_SH} ./test.tests > ${BASH_TSTOUT} 2>&1" test - diff ${BASH_TSTOUT} test.right && rm -f ${BASH_TSTOUT} --- -1.8.3.1 - diff --git a/meta/recipes-extended/bash/bash/run-bash-ptests b/meta/recipes-extended/bash/bash/run-bash-ptests new file mode 100644 index 0000000000..d73a27224d --- /dev/null +++ b/meta/recipes-extended/bash/bash/run-bash-ptests @@ -0,0 +1,4 @@ +#!/bin/sh +cd "$(dirname "$0")" +make -k THIS_SH=/bin/bash BUILD_DIR=`pwd` srcdir=`pwd` runtest + diff --git a/meta/recipes-extended/bash/bash/run-ptest b/meta/recipes-extended/bash/bash/run-ptest index c61fabd020..738ad3c42c 100644 --- a/meta/recipes-extended/bash/bash/run-ptest +++ b/meta/recipes-extended/bash/bash/run-ptest @@ -19,4 +19,8 @@ then echo "Warning: The de_DE* locales is needed to run the intl.tests, please add it." fi -make -k THIS_SH=/bin/bash BUILD_DIR=`pwd` srcdir=`pwd` runtest +useradd bashtest +chown -R bashtest:bashtest tests +setpriv --reuid bashtest --rgid bashtest --clear-groups --reset-env $(dirname "$0")/run-bash-ptests +chown -R root:root tests +userdel -r bashtest diff --git a/meta/recipes-extended/bash/bash/use_aclocal.patch b/meta/recipes-extended/bash/bash/use_aclocal.patch new file mode 100644 index 0000000000..bd6870b386 --- /dev/null +++ b/meta/recipes-extended/bash/bash/use_aclocal.patch @@ -0,0 +1,70 @@ +From d1bf23817afffd5917b74da6946e0c3b7e63e336 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex.kanavin@gmail.com> +Date: Mon, 28 Dec 2020 21:04:27 +0100 +Subject: [PATCH] bash: update 5.0 -> 5.1 + +Including m4 files directly like this confuses autotools.bbclass, remove +the references and rely upon aclocal to collect the m4 files together +as needed instead making it work like other autotools based projects. + +Upstream-Status: Inappropriate [OE configuration specific] +RP 2021/1/20 + +--- + configure.ac | 43 ------------------------------------------- + 1 file changed, 43 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 50a6e20..a3b5bd7 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -710,49 +710,6 @@ if test x$SIZE = x; then + fi + AC_SUBST(SIZE) + +-m4_include([m4/stat-time.m4]) +-m4_include([m4/timespec.m4]) +- +-m4_include([m4/strtoimax.m4]) +- +-dnl include files for gettext +- +-m4_include([m4/codeset.m4]) +-m4_include([m4/extern-inline.m4]) +-m4_include([m4/fcntl-o.m4]) +-m4_include([m4/gettext.m4]) +-m4_include([m4/glibc2.m4]) +-m4_include([m4/glibc21.m4]) +-m4_include([m4/host-cpu-c-abi.m4]) +-m4_include([m4/iconv.m4]) +-m4_include([m4/intdiv0.m4]) +-m4_include([m4/intl.m4]) +-m4_include([m4/intlmacosx.m4]) +-m4_include([m4/intl-thread-locale.m4]) +-m4_include([m4/intmax.m4]) +-m4_include([m4/inttypes-pri.m4]) +-m4_include([m4/inttypes.m4]) +-m4_include([m4/inttypes_h.m4]) +-m4_include([m4/lcmessage.m4]) +-m4_include([m4/lib-ld.m4]) +-m4_include([m4/lib-link.m4]) +-m4_include([m4/lib-prefix.m4]) +-m4_include([m4/lock.m4]) +-m4_include([m4/nls.m4]) +-m4_include([m4/po.m4]) +-m4_include([m4/printf-posix.m4]) +-m4_include([m4/progtest.m4]) +-m4_include([m4/pthread_rwlock_rdlock.m4]) +-m4_include([m4/size_max.m4]) +-m4_include([m4/stdint_h.m4]) +-m4_include([m4/threadlib.m4]) +-m4_include([m4/uintmax_t.m4]) +-m4_include([m4/ulonglong.m4]) +-m4_include([m4/visibility.m4]) +-m4_include([m4/wchar_t.m4]) +-m4_include([m4/wint_t.m4]) +-m4_include([m4/xsize.m4]) +- + dnl C compiler characteristics + AC_C_CONST + AC_C_INLINE |