Skip to contentSkip to conversation

netplug (/etc/init.d/S29netplug): Fix the quoting of ${NETWORKING}.

PATCH New Thomas Claveirole 3 participants 3 messages Nov 15, 2018 – Nov 26, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netplug (/etc/init.d/S29netplug): Fix the quoting of ${NETWORKING}.

Since 4adaa581b27dc27298eb7cc421ee8f530f88e18e, S29netplug looks for /etc/default/network instead of /etc/sysconfig/network. When this file exists but does not define $NETWORKING, the script fails on line 29 with something like:

/etc/init.d/S29netplug: 29: [: =: unexpected operator

Fix quoting so this error no longer happens.

---
 package/netplug/S29netplug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/netplug/S29netplug +1 -1
index 66459061b3..6c344662bb 100755
@@ -26,7 +26,7 @@ if [ -f /etc/default/network ]; then
 	. /etc/default/network
 
 	# Check that networking is up.
-	[ ${NETWORKING} = "no" ] && exit 0
+	[ "$NETWORKING" = no ] && exit 0
 elif [ ! -f /etc/network/interfaces ]; then
 	# No network support
 	exit 0
Signature · 1 line
2.19.1
#1 lore raw

PATCH 1/1 netplug (/etc/init.d/S29netplug): Fix the quoting of ${NETWORKING}.

Hello,

Quoted 19 lines · Thomas Claveirole

Since 4adaa581b27dc27298eb7cc421ee8f530f88e18e, S29netplug looks for /etc/default/network instead of /etc/sysconfig/network. When this file exists but does not define $NETWORKING, the script fails on line 29 with something like:

/etc/init.d/S29netplug: 29: [: =: unexpected operator

Fix quoting so this error no longer happens.

---
 package/netplug/S29netplug | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/netplug/S29netplug +0 -0
index 66459061b3..6c344662bb 100755

package/netplug/S29netplug if [ -f /etc/default/network ]; then · line 29

Quoted 5 lines
package/netplug/S29netplug +1 -1
@@ -26,7 +26,7 @@ if [ -f /etc/default/network ]; then
 	. /etc/default/network
 
 	# Check that networking is up.
-	[ ${NETWORKING} = "no" ] && exit 0
+	[ "$NETWORKING" = no ] && exit 0

I don't think it was really necessary to remove the double quotes around "no", and to remove the curly braces to reference the variable. So I've added those back, tweaked the commit title and applied to master. Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 netplug (/etc/init.d/S29netplug): Fix the quoting of ${NETWORKING}.

In reply to Thomas Claveirole
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Claveirole <[email protected]> writes:

Since 4adaa581b27dc27298eb7cc421ee8f530f88e18e, S29netplug looks for /etc/default/network instead of /etc/sysconfig/network. When this file exists but does not define $NETWORKING, the script fails on line 29 with something like:

Quoted 5 lines

/etc/init.d/S29netplug: 29: [: =: unexpected operator

Fix quoting so this error no longer happens.

Committed to 2018.02.x and 2018.08.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard