#21 Handle spaces in RUN_AS_GROUP

v3.2.3
open
nobody
None
5
2012-12-11
2007-11-12
Jacob Elder
No

This patch is required when the desired GID contains a space. Such an unfortunate situation is common in mixed Linux/Windows environments (winbind, think "Domain Users").

--- testwrapper 2006-10-17 10:30:47.000000000 -0400
+++ testwrapper.new 2007-11-12 13:51:58.000000000 -0500
@@ -314,13 +318,15 @@
if [ "X$1" != "X" ]
then
# Resolve the primary group
- RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1`
+ RUN_AS_GID=`$IDEXE -G luntbuild`
+ RUN_AS_GROUP=`getent group $RUN_AS_GID | cut -d: -f1`
if [ "X$RUN_AS_GROUP" = "X" ]
then
RUN_AS_GROUP=$RUN_AS_USER
fi
touch $LOCKFILE
- chown $RUN_AS_USER:$RUN_AS_GROUP $LOCKFILE
+ chown "$RUN_AS_USER" $LOCKFILE
+ chgrp "$RUN_AS_GROUP" $LOCKFILE
fi
fi

Discussion