diff options
Diffstat (limited to 'poky/meta/recipes-extended/bash')
12 files changed, 441 insertions, 0 deletions
diff --git a/poky/meta/recipes-extended/bash/bash.inc b/poky/meta/recipes-extended/bash/bash.inc new file mode 100644 index 000000000..9c2b065f9 --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash.inc @@ -0,0 +1,92 @@ +SUMMARY = "An sh-compatible command language interpreter" +HOMEPAGE = "http://tiswww.case.edu/php/chet/bash/bashtop.html" +SECTION = "base/shell" + +DEPENDS = "ncurses bison-native virtual/libiconv" + +inherit autotools gettext texinfo update-alternatives ptest + +EXTRA_AUTORECONF += "--exclude=autoheader --exclude=aclocal" +EXTRA_OECONF = "--enable-job-control --without-bash-malloc" + +# If NON_INTERACTIVE_LOGIN_SHELLS is defined, all login shells read the +# startup files, even if they are not interactive. +# This is what other major distros do. And this is what we wanted. See bug#5359 and bug#7137. +CFLAGS += "-DNON_INTERACTIVE_LOGIN_SHELLS" + +ALTERNATIVE_${PN} = "bash sh" +ALTERNATIVE_LINK_NAME[bash] = "${base_bindir}/bash" +ALTERNATIVE_TARGET[bash] = "${base_bindir}/bash" +ALTERNATIVE_LINK_NAME[sh] = "${base_bindir}/sh" +ALTERNATIVE_TARGET[sh] = "${base_bindir}/bash.${BPN}" +ALTERNATIVE_PRIORITY = "100" + +RDEPENDS_${PN} += "base-files" +RDEPENDS_${PN}_class-nativesdk = "" +RDEPENDS_${PN}-ptest += "make" + +DEPENDS_append_libc-glibc = " virtual/libc-locale" +RDEPENDS_${PN}-ptest_append_libc-glibc = " locale-base-fr-fr locale-base-de-de" + +USERADD_PACKAGES = "${PN}-ptest" +USERADD_PARAM_${PN}-ptest = "--create-home --user-group test" + +CACHED_CONFIGUREVARS += "headersdir=${includedir}/${PN}" + +do_compile_ptest () { + oe_runmake buildtest +} + +do_install_append () { + # Move /usr/bin/bash to /bin/bash, if need + if [ "${base_bindir}" != "${bindir}" ]; then + mkdir -p ${D}${base_bindir} + mv ${D}${bindir}/bash ${D}${base_bindir} + fi +} +do_install_append_class-target () { + # Clean buildhost references in bashbug + sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ + -e "s,-I${WORKDIR}/\S* ,,g" \ + -e 's|${DEBUG_PREFIX_MAP}||g' \ + ${D}${bindir}/bashbug + + # Clean buildhost references in bash.pc + sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ + ${D}${libdir}/pkgconfig/bash.pc + + # Clean buildhost references in Makefile.inc + sed -i -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ + -e 's|${DEBUG_PREFIX_MAP}||g' \ + -e 's:${HOSTTOOLS_DIR}/::g' \ + -e 's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g' \ + ${D}${libdir}/bash/Makefile.inc +} + +do_install_ptest () { + make INSTALL_TEST_DIR=${D}${PTEST_PATH}/tests install-test + cp ${B}/Makefile ${D}${PTEST_PATH} + sed -i -e 's/^Makefile/_Makefile/' -e "s,--sysroot=${STAGING_DIR_TARGET},,g" \ + -e 's|${DEBUG_PREFIX_MAP}||g' \ + -e "s,${S},,g" -e "s,${B},,g" -e "s,${STAGING_DIR_NATIVE},,g" \ + -e 's:${HOSTTOOLS_DIR}/::g' \ + ${D}${PTEST_PATH}/Makefile +} + +pkg_postinst_${PN} () { + grep -q "^${base_bindir}/bash$" $D${sysconfdir}/shells || echo ${base_bindir}/bash >> $D${sysconfdir}/shells +} + +pkg_postrm_${PN} () { + printf "$(grep -v "^${base_bindir}/bash$" $D${sysconfdir}/shells)\n" > $D${sysconfdir}/shells +} + +PACKAGES += "${PN}-bashbug" +FILES_${PN} = "${bindir}/bash ${base_bindir}/bash.bash" +FILES_${PN}-bashbug = "${bindir}/bashbug" + +PACKAGE_BEFORE_PN += "${PN}-loadable" +RDEPENDS_${PN}-loadable += "${PN}" +FILES_${PN}-loadable += "${libdir}/bash/*" + +RPROVIDES_${PN} += "${@bb.utils.contains('DISTRO_FEATURES', 'usrmerge', '/bin/sh /bin/bash', '', d)}" diff --git a/poky/meta/recipes-extended/bash/bash/0001-help-fix-printf-format-security-warning.patch b/poky/meta/recipes-extended/bash/bash/0001-help-fix-printf-format-security-warning.patch new file mode 100644 index 000000000..5405c84c7 --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash/0001-help-fix-printf-format-security-warning.patch @@ -0,0 +1,35 @@ +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/poky/meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch b/poky/meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch new file mode 100644 index 000000000..9fb6ba972 --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash/bash-memleak-bug-fix-for-builtin-command-read.patch @@ -0,0 +1,35 @@ +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/poky/meta/recipes-extended/bash/bash/build-tests.patch b/poky/meta/recipes-extended/bash/bash/build-tests.patch new file mode 100644 index 000000000..73a81b60d --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash/build-tests.patch @@ -0,0 +1,55 @@ +Add 'ptest' target to Makefile, to run tests without checking dependencies. + +Upstream-Status: Pending +Signed-off-by: Anders Roxell <anders.roxell@enea.com> +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 +--- a/Makefile.in ++++ b/Makefile.in +@@ -848,20 +848,34 @@ maybe-clean: + fi + + recho$(EXEEXT): $(SUPPORT_SRC)recho.c +- @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)recho.c ${LIBS_FOR_BUILD} ++ @$(CC) $(CCFLAGS) ${LDFLAGS} -o $@ $< + + zecho$(EXEEXT): $(SUPPORT_SRC)zecho.c +- @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)zecho.c ${LIBS_FOR_BUILD} ++ @$(CC) $(CCFLAGS) ${LDFLAGS} -o $@ $< + + printenv$(EXEEXT): $(SUPPORT_SRC)printenv.c +- @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)printenv.c ${LIBS_FOR_BUILD} ++ @$(CC) $(CCFLAGS) ${LDFLAGS} -o $@ $< + + xcase$(EXEEXT): $(SUPPORT_SRC)xcase.c +- @$(CC_FOR_BUILD) $(CCFLAGS_FOR_BUILD) ${LDFLAGS_FOR_BUILD} -o $@ $(SUPPORT_SRC)xcase.c ${LIBS_FOR_BUILD} ++ @$(CC) $(CCFLAGS) ${LDFLAGS} -o $@ $< + +-test tests check: force $(Program) $(TESTS_SUPPORT) ++test tests check: ++ @$(MAKE) install-test ++ @$(MAKE) runtest ++ ++install-test: buildtest ++ifeq ($(origin INSTALL_TEST_DIR), undefined) + @-test -d tests || mkdir tests + @cp $(TESTS_SUPPORT) tests ++else ++ @-test -d $(INSTALL_TEST_DIR) || mkdir -p $(INSTALL_TEST_DIR) ++ @cp -r $(srcdir)/tests/* $(INSTALL_TEST_DIR)/ ++ @cp $(TESTS_SUPPORT) $(INSTALL_TEST_DIR) ++endif ++ ++buildtest: force $(Program) $(TESTS_SUPPORT) ++ ++runtest: + @( cd $(srcdir)/tests && \ + PATH=$(BUILD_DIR)/tests:$$PATH THIS_SH=$(THIS_SH) $(SHELL) ${TESTSCRIPT} ) + +-- +1.8.1.2 + diff --git a/poky/meta/recipes-extended/bash/bash/execute_cmd.patch b/poky/meta/recipes-extended/bash/bash/execute_cmd.patch new file mode 100644 index 000000000..9970b4d8f --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash/execute_cmd.patch @@ -0,0 +1,19 @@ +Upstream-Status: Inappropriate [embedded specific] + +Index: execute_cmd.c +=================================================================== +--- execute_cmd.c.orig ++++ execute_cmd.c +@@ -2459,7 +2459,11 @@ execute_pipeline (command, asynchronous, + /* 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, 1, -1); + if (lstdin > 0) diff --git a/poky/meta/recipes-extended/bash/bash/fix-run-builtins.patch b/poky/meta/recipes-extended/bash/bash/fix-run-builtins.patch new file mode 100644 index 000000000..2fa388302 --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash/fix-run-builtins.patch @@ -0,0 +1,33 @@ +From 0c4cab9594c96c2dc435a8d9724605824bcbf917 Mon Sep 17 00:00:00 2001 +From: Dengke Du <dengke.du@windriver.com> +Date: Tue, 19 Apr 2016 02:57:45 -0400 +Subject: [PATCH] fix run-builtins failed + +FAIL: run-builtins +1. redirect the stderr output of command exec with -l option in + builtins.tests to /dev/null +2. ensure the system contain the locales "en_US.UTF-8" + +Upstream-Status: Pending + +Signed-off-by: Dengke Du <dengke.du@windriver.com> +--- + tests/builtins.tests | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tests/builtins.tests b/tests/builtins.tests +index 9d77520..63f3af8 100644 +--- a/tests/builtins.tests ++++ b/tests/builtins.tests +@@ -109,7 +109,7 @@ esac + + # test options to exec + (exec -a specialname ${THIS_SH} -c 'echo $0' ) +-(exec -l -a specialname ${THIS_SH} -c 'echo $0' ) ++(exec -l -a specialname ${THIS_SH} -c 'echo $0' ) 2> /dev/null + # test `clean' environment. if /bin/sh is bash, and the script version of + # printenv is run, there will be variables in the environment that bash + # sets on startup. Also test code that prefixes argv[0] with a dash. +-- +2.8.1 + diff --git a/poky/meta/recipes-extended/bash/bash/fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch b/poky/meta/recipes-extended/bash/bash/fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch new file mode 100644 index 000000000..9ac2461ab --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash/fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch @@ -0,0 +1,45 @@ +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/poky/meta/recipes-extended/bash/bash/mkbuiltins_have_stringize.patch b/poky/meta/recipes-extended/bash/bash/mkbuiltins_have_stringize.patch new file mode 100644 index 000000000..a9391d6ca --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash/mkbuiltins_have_stringize.patch @@ -0,0 +1,26 @@ +On hosts with FORTIFY_SOURCES, stringize support is required, as it's used by +the macros to wrap functions (e.g. read and open in unistd.h). Those wrappers +use the STRING() macro from unistd.h. A header in the bash sources overrides +the unistd.h macro to 'x' when HAVE_STRINGIZE is not defined, causing the +wrappers to generate calls to 'xread' and 'xopen', which do not exist, +resulting in a failure to link. + +Assume we have stringize support when cross-compiling, which works around the +issue. + +It may be best for upstream to either give up on supporting compilers without +stringize support, or to not define STRING() at all when FORTIFY_SOURCES is +defined, letting the unistd.h one be used, instead. + +Upstream-Status: Pending + +--- bash-4.2.orig/builtins/mkbuiltins.c ++++ bash-4.2/builtins/mkbuiltins.c +@@ -28,6 +28,7 @@ + # define HAVE_STDLIB_H + + # define HAVE_RENAME ++# define HAVE_STRINGIZE + #endif /* CROSS_COMPILING */ + + #if defined (HAVE_UNISTD_H) diff --git a/poky/meta/recipes-extended/bash/bash/pathexp-dep.patch b/poky/meta/recipes-extended/bash/bash/pathexp-dep.patch new file mode 100644 index 000000000..e05bbda31 --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash/pathexp-dep.patch @@ -0,0 +1,13 @@ +pathexp includes libintl.h but doesn't depend on it, thus a build race can occur. + +Upstream-Status: Submitted (https://savannah.gnu.org/patch/index.php?9503) +Signed-off-by: Ross Burton <ross.burton@intel.com> + +diff --git a/Makefile.in b/Makefile.in +index c7b62bc0..241cbf12 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -1281,2 +1281,3 @@ nojobs.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h + y.tab.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h ++pathexp.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h + pcomplete.o: bashintl.h ${LIBINTL_H} $(BASHINCDIR)/gettext.h diff --git a/poky/meta/recipes-extended/bash/bash/run-ptest b/poky/meta/recipes-extended/bash/bash/run-ptest new file mode 100644 index 000000000..c61fabd02 --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash/run-ptest @@ -0,0 +1,22 @@ +#!/bin/sh + +en_US=`locale -a | grep en_US*` +fr_FR=`locale -a | grep fr_FR*` +de_DE=`locale -a | grep de_DE*` + +if [ -z "$en_US" ] +then + echo "Warning: The en_US* locales is needed to run the intl.tests, please add it." +fi + +if [ -z "$fr_FR" ] +then + echo "Warning: The fr_FR* locales is needed to run the intl.tests, please add it." +fi + +if [ -z "$de_DE" ] +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 diff --git a/poky/meta/recipes-extended/bash/bash/test-output.patch b/poky/meta/recipes-extended/bash/bash/test-output.patch new file mode 100644 index 000000000..0ffcc2458 --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash/test-output.patch @@ -0,0 +1,42 @@ +From 28eb06047ebd2deaa8c7cd2bf6655ef6a469dc14 Mon Sep 17 00:00:00 2001 +From: Hongxu Jia <hongxu.jia@windriver.com> +Date: Tue, 15 Aug 2017 10:01:56 +0800 +Subject: [PATCH 1/2] Add FAIL/PASS output to test output. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Björn Stenberg <bjst@enea.com> +Upstream-Status: Pending + +Rebase to 4.4 +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> +--- + tests/run-all | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/tests/run-all b/tests/run-all +index 2882fe0..e21d026 100644 +--- a/tests/run-all ++++ b/tests/run-all +@@ -33,7 +33,16 @@ do + case $x in + $0|run-minimal|run-gprof) ;; + *.orig|*~) ;; +- *) echo $x ; sh $x ; rm -f ${BASH_TSTOUT} ;; ++ *) echo $x ++ output=`sh $x` ++ if [ -n "$output" ]; then ++ echo "$output" ++ echo "FAIL: $x" ++ else ++ echo "PASS: $x" ++ fi ++ rm -f ${BASH_TSTOUT} ++ ;; + esac + done + +-- +1.8.3.1 + diff --git a/poky/meta/recipes-extended/bash/bash_4.4.12.bb b/poky/meta/recipes-extended/bash/bash_4.4.12.bb new file mode 100644 index 000000000..9382a77af --- /dev/null +++ b/poky/meta/recipes-extended/bash/bash_4.4.12.bb @@ -0,0 +1,24 @@ +require bash.inc + +# GPLv2+ (< 4.0), GPLv3+ (>= 4.0) +LICENSE = "GPLv3+" +LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" + +SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \ + file://execute_cmd.patch;striplevel=0 \ + file://mkbuiltins_have_stringize.patch \ + file://build-tests.patch \ + file://test-output.patch \ + file://fix-run-coproc-run-heredoc-run-execscript-run-test-f.patch \ + file://run-ptest \ + file://fix-run-builtins.patch \ + file://0001-help-fix-printf-format-security-warning.patch \ + file://bash-memleak-bug-fix-for-builtin-command-read.patch \ + file://pathexp-dep.patch \ + " + +SRC_URI[tarball.md5sum] = "7c112970cbdcadfc331e10eeb5f6aa41" +SRC_URI[tarball.sha256sum] = "57d8432be54541531a496fd4904fdc08c12542f43605a9202594fa5d5f9f2331" + + +BBCLASSEXTEND = "nativesdk" |