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

(From OE-Core rev: 28adfbbcf42d15eabdd7fe3a5dea486bd5049f09)

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>
This commit is contained in:
Khem Raj
2021-12-09 17:06:13 -08:00
committed by Richard Purdie
parent 63f1e59f9f
commit c9351aee3f
5 changed files with 61 additions and 36 deletions

View File

@@ -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() {

View File

@@ -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
}

View File

@@ -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

View File

@@ -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 '-'.

View File

@@ -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}"