Skip to contentSkip to conversation

eudev: remove bashism to be compatible with dash

PATCH New [email protected] 1 participant 2 messages Nov 18, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 eudev: remove bashism to be compatible with dash

From: Fedor Ross <[email protected]>

Remove 'echo -e' and replace it with 'printf'. In bash the builtin 'echo' has an option for interpreting backslash escapes. In a shell like dash the builtin 'echo' interprets backslash escapes by default. Therefor the 'echo' in dash doesn't have the '-e' option. When using 'printf' instead it is safe to use it either with bash or dash.

---
 meta/recipes-core/udev/eudev/init | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/udev/eudev/init +1 -1
index 0455ade258..c60dbbf6d5 100644
@@ -52,7 +52,7 @@ case "$1" in
     kill_udevd > "/dev/null" 2>&1
 
     # trigger the sorted events
-    [ -e /proc/sys/kernel/hotplug ] && echo -e '\000' >/proc/sys/kernel/hotplug
+    [ -e /proc/sys/kernel/hotplug ] && printf '\0\n' >/proc/sys/kernel/hotplug
     @UDEVD@ -d
 
     udevadm control --env=STARTUP=1
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 sysvinit: remove bashism to be compatible with dash

From: Fedor Ross <[email protected]>

Replace the equality operator '==' with '=' inside of '[]' to be compatible with bash and dash.

---
 meta/recipes-core/sysvinit/sysvinit/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/sysvinit/sysvinit/rc +1 -1
index fd1fdd26ba..d0d3149821 100755
@@ -63,7 +63,7 @@ startup() {
   stty onlcr 0>&1
 
   # Limit stack size for startup scripts
-  [ "$STACK_SIZE" == "" ] || ulimit -S -s $STACK_SIZE
+  [ "$STACK_SIZE" = "" ] || ulimit -S -s $STACK_SIZE
 
   # Now find out what the current and what the previous runlevel are.
 
Signature · 1 line
2.20.1