From a50bfc016e40ed8a19c86dd6e6b40b9986024188 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Mon, 26 Feb 2018 22:07:29 +0100 Subject: [PATCH] Set $SHELL to a sane default value, used by BusyBox When finit calls out to external tools, like `ifup $IFACE`, that tool in turn may use other external tools. On systems with BusyBox our calling `ifup $IFACE` will result in BusyBox casting a magic spell: if $SHELL is unset it goes looking in the file /etc/passwd for the shell of $USER which may not be set to a Bourne compatible UNIX shell, so commands like `ip link ...` or `run-parts ...` will fail hard. This patch adds SHELL=/bin/sh as a sane early default. Signed-off-by: Joachim Nilsson --- src/finit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/finit.c b/src/finit.c index 8d4feca7..f82ad2f8 100644 --- a/src/finit.c +++ b/src/finit.c @@ -282,9 +282,10 @@ int main(int argc, char* argv[]) ctx = &loop; /* - * Set the PATH early to something sane + * Set PATH and SHELL early to something sane */ setenv("PATH", _PATH_STDPATH, 1); + setenv("SHELL", _PATH_BSHELL, 1); /* * Mount base file system, kernel is assumed to run devtmpfs for /dev