New patch adds a knob to select needed shell interpreter for tzselect script, which then we excercise via EXTRA_OEMAKE
Signed-off-by: Khem Raj <raj.k...@gmail.com> Cc: Hongxu Jia <hongxu....@windriver.com> --- meta/recipes-core/glibc/glibc.inc | 4 ++ ...erpreter-overridable-in-tzselect.ksh.patch | 50 +++++++++++++++++++ ...zone-re-written-tzselect-as-posix-sh.patch | 34 ------------- meta/recipes-core/glibc/glibc_2.34.bb | 2 +- 4 files changed, 55 insertions(+), 35 deletions(-) create mode 100644 meta/recipes-core/glibc/glibc/0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch delete mode 100644 meta/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc index 80a3e0b493d..fdd241d973b 100644 --- a/meta/recipes-core/glibc/glibc.inc +++ b/meta/recipes-core/glibc/glibc.inc @@ -41,6 +41,10 @@ PARALLEL_MAKE = "" # ensure make uses /bin/bash EXTRA_OEMAKE += "SHELL=/bin/bash" +# We do not need bash to run tzselect script, the default is to use +# bash but it can be configured by setting KSHELL Makefile variable +EXTRA_OEMAKE += "KSHELL=/bin/sh" + do_configure:prepend() { sed -e "s#/bin/bash#/bin/sh#" -i ${S}/elf/ldd.bash.in } diff --git a/meta/recipes-core/glibc/glibc/0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch b/meta/recipes-core/glibc/glibc/0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch new file mode 100644 index 00000000000..0480c47b498 --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch @@ -0,0 +1,50 @@ +From 76d170fbbfd07b26a0288212201e5d15558db36f Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.k...@gmail.com> +Date: Thu, 9 Dec 2021 15:14:42 -0800 +Subject: [PATCH] Make shell interpreter overridable in tzselect.ksh + +define new macro called KSHELL which can be used to define default shell +use Bash by default + +Upstream-Status: Submitted [https://patchwork.sourceware.org/project/glibc/patch/20211209234015.1554552-1-raj.k...@gmail.com/] +Signed-off-by: Khem Raj <raj.k...@gmail.com> +--- + Makeconfig | 9 +++++++++ + timezone/Makefile | 1 + + 2 files changed, 10 insertions(+) + +diff --git a/Makeconfig b/Makeconfig +index 3fa2f13003..a1ea5d5571 100644 +--- a/Makeconfig ++++ b/Makeconfig +@@ -292,6 +292,15 @@ ifndef sysincludedir + sysincludedir = /usr/include + endif + ++# The full path name of a Posix-compliant shell, preferably one that supports ++# the Korn shell's 'select' statement as an extension. ++# These days, Bash is the most popular. ++# It should be OK to set this to /bin/sh, on platforms where /bin/sh ++# lacks 'select' or doesn't completely conform to Posix, but /bin/bash ++# is typically nicer if it works. ++ifndef KSHELL ++KSHELL = /bin/bash ++endif + + # Commands to install files. + ifndef INSTALL_DATA +diff --git a/timezone/Makefile b/timezone/Makefile +index c624a189b3..dc8f5277de 100644 +--- a/timezone/Makefile ++++ b/timezone/Makefile +@@ -127,6 +127,7 @@ $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make + -e '/TZVERSION=/s|see_Makefile|"$(version)"|' \ + -e '/PKGVERSION=/s|=.*|="$(PKGVERSION)"|' \ + -e '/REPORT_BUGS_TO=/s|=.*|="$(REPORT_BUGS_TO)"|' \ ++ -e 's|#!/bin/bash|#!$(KSHELL)|g' \ + < $< > $@.new + chmod 555 $@.new + mv -f $@.new $@ +-- +2.34.1 + diff --git a/meta/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch b/meta/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch deleted file mode 100644 index 100d08599c9..00000000000 --- a/meta/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 2731fa0c7463cd160361a8ac92f3bd7f984d953d Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.k...@gmail.com> -Date: Wed, 18 Mar 2015 00:33:03 +0000 -Subject: [PATCH] timezone: re-written tzselect as posix sh - -To avoid the bash dependency. - -Upstream-Status: Pending - -Signed-off-by: Hongxu Jia <hongxu....@windriver.com> -Signed-off-by: Khem Raj <raj.k...@gmail.com> ---- - timezone/tzselect.ksh | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/timezone/tzselect.ksh b/timezone/tzselect.ksh -index 18fce27e24..7705df83d7 100755 ---- a/timezone/tzselect.ksh -+++ b/timezone/tzselect.ksh -@@ -1,4 +1,4 @@ --#!/bin/bash -+#!/bin/sh - # Ask the user about the time zone, and output the resulting TZ value to stdout. - # Interact with the user via stderr and stdin. - -@@ -34,7 +34,7 @@ REPORT_BUGS_TO=t...@iana.org - - # Specify default values for environment variables if they are unset. - : ${AWK=awk} --: ${TZDIR=`pwd`} -+: ${TZDIR=$(pwd)} - - # Output one argument as-is to standard output. - # Safer than 'echo', which can mishandle '\' or leading '-'. diff --git a/meta/recipes-core/glibc/glibc_2.34.bb b/meta/recipes-core/glibc/glibc_2.34.bb index 09d8b0780f6..faef42fd5e3 100644 --- a/meta/recipes-core/glibc/glibc_2.34.bb +++ b/meta/recipes-core/glibc/glibc_2.34.bb @@ -32,7 +32,6 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ ${NATIVESDKFIXES} \ file://0015-sysdeps-gnu-configure.ac-handle-correctly-libc_cv_ro.patch \ file://0016-yes-within-the-path-sets-wrong-config-variables.patch \ - file://0017-timezone-re-written-tzselect-as-posix-sh.patch \ file://0018-Remove-bash-dependency-for-nscd-init-script.patch \ file://0019-eglibc-Cross-building-and-testing-instructions.patch \ file://0020-eglibc-Help-bootstrap-cross-toolchain.patch \ @@ -49,6 +48,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ file://0002-CVE-2021-38604.patch \ file://0001-fix-create-thread-failed-in-unprivileged-process-BZ-.patch \ file://CVE-2021-43396.patch \ + file://0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch \ " # Use append instead of += that way patch is applied with devupstream too SRC_URI:append = "\ -- 2.34.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#159486): https://lists.openembedded.org/g/openembedded-core/message/159486 Mute This Topic: https://lists.openembedded.org/mt/87625862/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-