summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2021-12-09 17:06:13 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-12-12 11:27:20 +0000
commit28adfbbcf42d15eabdd7fe3a5dea486bd5049f09 (patch)
treedd5776c43cc3962d816e4e834fdfef0d749afb38
parentdc3fcb6f9f6b4f54519265a95d59279fceb5cc97 (diff)
downloadopenembedded-core-contrib-28adfbbcf42d15eabdd7fe3a5dea486bd5049f09.tar.gz
glibc: Redo tzselect bash dependency problem
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.khem@gmail.com> Cc: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/glibc/cross-localedef-native_2.34.bb7
-rw-r--r--meta/recipes-core/glibc/glibc.inc4
-rw-r--r--meta/recipes-core/glibc/glibc/0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch50
-rw-r--r--meta/recipes-core/glibc/glibc/0017-timezone-re-written-tzselect-as-posix-sh.patch34
-rw-r--r--meta/recipes-core/glibc/glibc_2.34.bb2
5 files changed, 61 insertions, 36 deletions
diff --git a/meta/recipes-core/glibc/cross-localedef-native_2.34.bb b/meta/recipes-core/glibc/cross-localedef-native_2.34.bb
index 482e53cf5d..c37814ee24 100644
--- a/meta/recipes-core/glibc/cross-localedef-native_2.34.bb
+++ b/meta/recipes-core/glibc/cross-localedef-native_2.34.bb
@@ -25,13 +25,13 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \
file://0001-localedef-Add-hardlink-resolver-from-util-linux.patch \
file://0002-localedef-fix-ups-hardlink-to-make-it-compile.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 \
file://0021-eglibc-Resolve-__fpscr_values-on-SH4.patch \
file://0022-eglibc-Forward-port-cross-locale-generation-support.patch \
file://0024-localedef-add-to-archive-uses-a-hard-coded-locale-pa.patch \
+ file://0001-Make-shell-interpreter-overridable-in-tzselect.ksh.patch \
"
# Makes for a rather long rev (22 characters), but...
#
@@ -40,6 +40,11 @@ SRCREV_FORMAT = "glibc_localedef"
S = "${WORKDIR}/git"
EXTRA_OECONF = "--with-glibc=${S}"
+
+# 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"
+
CFLAGS += "-fgnu89-inline -std=gnu99 -DIS_IN\(x\)='0'"
do_install() {
diff --git a/meta/recipes-core/glibc/glibc.inc b/meta/recipes-core/glibc/glibc.inc
index 80a3e0b493..fdd241d973 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 0000000000..0480c47b49
--- /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.khem@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.khem@gmail.com/]
+Signed-off-by: Khem Raj <raj.khem@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 100d08599c..0000000000
--- 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.khem@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.jia@windriver.com>
-Signed-off-by: Khem Raj <raj.khem@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=tz@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 cdce2c4112..27a5d5fa2b 100644
--- a/meta/recipes-core/glibc/glibc_2.34.bb
+++ b/meta/recipes-core/glibc/glibc_2.34.bb
@@ -36,7 +36,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 \
@@ -53,6 +52,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 \
"
S = "${WORKDIR}/git"
B = "${WORKDIR}/build-${TARGET_SYS}"