glibc: don't require bash for nscd init script
PATCH 1/1 glibc: don't require bash for nscd init script
The nscd init script uses #! /bin/bash but only really uses one bashism (translated strings), so remove them and switch the shell to #! /bin/sh.
--- meta/recipes-core/glibc/glibc/nscd-no-bash.patch | 61 ++++++++++++++++++++++++ meta/recipes-core/glibc/glibc_2.22.bb | 1 + 2 files changed, 62 insertions(+) create mode 100644 meta/recipes-core/glibc/glibc/nscd-no-bash.patch
meta/recipes-core/glibc/glibc/nscd-no-bash.patch new file +61 -0
@@ -0,0 +1,61 @@ +Don't use bashisms (except for echo -n, which busybox supports) to avoid needing bash to start nscd. + +Upstream-Status: Pending +Signed-off-by: Ross Burton <[email protected]> + +diff --git a/nscd/nscd.init b/nscd/nscd.init +index a882da7..b02986e 100644 +--- a/nscd/nscd.init ++++ b/nscd/nscd.init +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # nscd: Starts the Name Switch Cache Daemon + # +@@ -49,7 +49,7 @@ prog=nscd + start () { + [ -d /var/run/nscd ] || mkdir /var/run/nscd + [ -d /var/db/nscd ] || mkdir /var/db/nscd +- echo -n $"Starting $prog: " ++ echo -n "Starting $prog: " + daemon /usr/sbin/nscd + RETVAL=$? + echo +@@ -58,7 +58,7 @@ start () { + } + + stop () { +- echo -n $"Stopping $prog: " ++ echo -n "Stopping $prog: " + /usr/sbin/nscd -K + RETVAL=$? + if [ $RETVAL -eq 0 ]; then +@@ -67,9 +67,9 @@ stop () { + # a non-privileged user + rm -f /var/run/nscd/nscd.pid + rm -f /var/run/nscd/socket +- success $"$prog shutdown" ++ success "$prog shutdown" + else +- failure $"$prog shutdown" ++ failure "$prog shutdown" + fi + echo + return $RETVAL +@@ -103,13 +103,13 @@ case "$1" in + RETVAL=$? + ;; + force-reload | reload) +- echo -n $"Reloading $prog: " ++ echo -n "Reloading $prog: " + killproc /usr/sbin/nscd -HUP + RETVAL=$? + echo + ;; + *) +- echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" ++ echo "Usage: $0 {start|stop|status|restart|reload|condrestart}" + RETVAL=1 + ;; + esac
meta/recipes-core/glibc/glibc_2.22.bb +1 -0
@@ -38,6 +38,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${BRANCH};name=glibc \ file://0025-eglibc-Install-PIC-archives.patch \ file://0026-eglibc-dl_debug_mask-is-controlled-by-__OPTION_EGLIB.patch \ file://0027-eglibc-use-option-groups-Conditionally-exclude-c-tes.patch \ + file://nscd-no-bash.patch \ " SRC_URI += "\
Signature · 1 line
2.3.2 (Apple Git-55)
Quoted 19 lines · Ross Burton
The nscd init script uses #!
/bin/bashbut only really uses one bashism (translated strings), so remove them and switch the shell to #!/bin/sh.Signed-off-by Ross Burton <[email protected]>---
meta/recipes-core/glibc/glibc/nscd-no-bash.patch| 61 ++++++++++++++++++++++++
meta/recipes-core/glibc/glibc_2.22.bb | 1 +2 files changed, 62 insertions(+)create mode 100644
meta/recipes-core/glibc/glibc/nscd-no-bash.patchmeta/recipes-core/glibc/glibc/nscd-no-bash.patch new file +0
-0
meta/recipes-core/glibc/glibc/nscd-no-bash.patch line 2
Quoted 2 lines
meta/recipes-core/glibc/glibc/nscd-no-bash.patch new file +2
-0@@ -0,0 +1,61 @@ +Don't use bashisms (except for echo -n, which busybox supports) to avoid needing bash to start nscd. +
it used to be like that and then changed to use translated strings. Do you see any downsides of removing it ? locales related or otherwise ? if not then it looks ok to me.
Quoted 79 lines
meta/recipes-core/glibc/glibc/nscd-no-bash.patch new file +59
-0+Upstream-Status: Pending +Signed-off-by: Ross Burton <[email protected]> + +diff --git a/nscd/nscd.init b/nscd/nscd.init +index a882da7..b02986e 100644 +--- a/nscd/nscd.init ++++ b/nscd/nscd.init +@@ -1,4 +1,4 @@ +-#!/bin/bash ++#!/bin/sh + # + # nscd: Starts the Name Switch Cache Daemon + # +@@ -49,7 +49,7 @@ prog=nscd + start () { + [ -d /var/run/nscd ] || mkdir /var/run/nscd + [ -d /var/db/nscd ] || mkdir /var/db/nscd +- echo -n $"Starting $prog: " ++ echo -n "Starting $prog: " + daemon /usr/sbin/nscd + RETVAL=$? + echo +@@ -58,7 +58,7 @@ start () { + } + + stop () { +- echo -n $"Stopping $prog: " ++ echo -n "Stopping $prog: " + /usr/sbin/nscd -K + RETVAL=$? + if [ $RETVAL -eq 0 ]; then +@@ -67,9 +67,9 @@ stop () { + # a non-privileged user + rm -f /var/run/nscd/nscd.pid + rm -f /var/run/nscd/socket +- success $"$prog shutdown" ++ success "$prog shutdown" + else +- failure $"$prog shutdown" ++ failure "$prog shutdown" + fi + echo + return $RETVAL +@@ -103,13 +103,13 @@ case "$1" in + RETVAL=$? + ;; + force-reload | reload) +- echo -n $"Reloading $prog: " ++ echo -n "Reloading $prog: " + killproc /usr/sbin/nscd -HUP + RETVAL=$? + echo + ;; + *) +- echo $"Usage: $0 {start|stop|status|restart|reload|condrestart}" ++ echo "Usage: $0 {start|stop|status|restart|reload|condrestart}" + RETVAL=1 + ;; + esacmeta/recipes-core/glibc/glibc_2.22.bb +1
-0@@ -38,6 +38,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${BRANCH};name=glibc \ file://0025-eglibc-Install-PIC-archives.patch \ file://0026-eglibc-dl_debug_mask-is-controlled-by-__OPTION_EGLIB.patch \ file://0027-eglibc-use-option-groups-Conditionally-exclude-c-tes.patch \ + file://nscd-no-bash.patch \"
SRC_URI+= "\Signature · 7 lines
2.3.2 (Apple Git-55) -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
Quoted 4 lines · Khem Raj
it used to be like that and then changed to use translated strings. Do you see any downsides of removing it ?
locales related or otherwise ? if not then it looks ok to me.
When given the choice of translated strings in an *init script* with enforced bash or English strings with no bash, I think most people here would go for English and not enforced bash. Nobody noticed this as the bash dependency wasn't declared (and thus was a QA warning with Poky at least).
Ross