From 0d86c4903bdc68d2d4704ab6c2d4fc8f2c054276 Mon Sep 17 00:00:00 2001 From: Lars Wendler Date: Wed, 12 May 2021 21:01:06 +0200 Subject: [PATCH] init.d/modules.in: Avoid loading modules twice in Linux with dash shell Since commit 6b475ab26992f1dd8815700828df46abc4b71d27, openrc tries to load modules twice which have been defined in /etc/conf.d/modules via modules= variable when /bin/sh points to dash shell. The reason is that when the "modules-load" service was merged into "modules" service, the "modules" variable name got used in both, load_modules() function and in Linux_modules() function which both get called when modules service is started. Although "modules" variable is marked as local in load_modules(), dash simply ignores this. Avoid the issue by renaming "modules" variable to "_modules" in load_modules() function. This fixes #419. --- init.d/modules.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init.d/modules.in b/init.d/modules.in index abaab85b..3bcd2dda 100644 --- a/init.d/modules.in +++ b/init.d/modules.in @@ -41,18 +41,18 @@ find_modfiles() load_modules() { - local file m modules rc x + local file m _modules rc x file=$1 [ -z "$file" ] && return 0 while read m x; do case $m in \;*) continue ;; \#*) continue ;; - *) modules="$modules $m" + *) _modules="$_modules $m" ;; esac done < $file - for x in $modules; do + for x in $_modules; do ebegin "Loading module $x" case "$RC_UNAME" in FreeBSD) kldload "$x"; rc=$? ;;