[OE-core] [PATCH v2 3/7] classes/useradd: handle whitespace only USERADD/GROUPADD/GROUPMEMS

Maciej Borzecki maciej.borzecki at open-rnd.pl
Wed Feb 10 12:32:52 UTC 2016


Useradd attempts to add users/groups even when
{USERADD,GROUPADD,GROUPMEMS}_PARAM is whitespace only. This scenario is
possible when variables and modified using one of +=, =+ operator, yet
the content being added is conditional (i.e. may depend on PACKAGECONFIG
flags).

Signed-off-by: Maciej Borzecki <maciej.borzecki at open-rnd.pl>
---
 meta/classes/useradd.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index 4577e56f5a17940929c555b3f5d18d75e92f1476..c960656f02b3d11e5bb08dca259df3946f96aeaf 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -50,7 +50,7 @@ fi
 
 # Perform group additions first, since user additions may depend
 # on these groups existing
-if test "x$GROUPADD_PARAM" != "x"; then
+if test "x`echo $GROUPADD_PARAM | tr -d '[:space:]'`" != "x"; then
 	echo "Running groupadd commands..."
 	# Invoke multiple instances of groupadd for parameter lists
 	# separated by ';'
@@ -66,7 +66,7 @@ if test "x$GROUPADD_PARAM" != "x"; then
 	done
 fi 
 
-if test "x$USERADD_PARAM" != "x"; then
+if test "x`echo $USERADD_PARAM | tr -d '[:space:]'`" != "x"; then
 	echo "Running useradd commands..."
 	# Invoke multiple instances of useradd for parameter lists
 	# separated by ';'
@@ -82,7 +82,7 @@ if test "x$USERADD_PARAM" != "x"; then
 	done
 fi
 
-if test "x$GROUPMEMS_PARAM" != "x"; then
+if test "x`echo $GROUPMEMS_PARAM | tr -d '[:space:]'`" != "x"; then
 	echo "Running groupmems commands..."
 	# Invoke multiple instances of groupmems for parameter lists
 	# separated by ';'
-- 
2.5.0




More information about the Openembedded-core mailing list