Skip to contentSkip to conversation

V4: Replace retry logic in useradd with flock

PATCH New [email protected] 1 participant 2 messages Feb 29, 2016

lore
Share & tools
lore
#0 lore raw

cover V4: Replace retry logic in useradd with flock

From: Kai Kang <[email protected]>

V4:
* re-add check whether user/group exist

Hi Ross,

I add check back that avahi fails to do compile when remove the checks:

| useradd: user 'avahi-autoipd' already exists

So I add

set +e

But it fails with:

ERROR: Fakeroot process (13034) exited unexpectedly (-9), shutting down...

So I add the checks back and the commit works.

Regards,
Kai

The following changes since commit 4006a7f2762ccd5dcbc6cdff49482d4387a73261:

sanity: Fix int verses string reference (2016-02-28 22:54:09 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib kangkai/flockv4
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/flockv4

Kai Kang (1):
useradd_base.bbclass: replace retry logic with flock

 meta/classes/useradd.bbclass      |   6 +-
 meta/classes/useradd_base.bbclass | 165 ++++++++++----------------------------
 2 files changed, 46 insertions(+), 125 deletions(-)
Signature · 1 line
2.6.1
#1 lore raw

PATCH 1/1 useradd_base.bbclass: replace retry logic with flock

From: Kai Kang <[email protected]>

When perform useradd during populate sysroot, it locks files passwd.lock and group.lock at same time. And then it meets a dead lock issue randomly.

Use flock to reslove it by using an universal lock directory for all the user and group related operations.

[YOCTO #9022]

---
 meta/classes/useradd.bbclass      |   6 +-
 meta/classes/useradd_base.bbclass | 165 ++++++++++----------------------------
 2 files changed, 46 insertions(+), 125 deletions(-)
meta/classes/useradd.bbclass +3 -3
index c960656..0a6f2be 100644
@@ -57,7 +57,7 @@ if test "x`echo $GROUPADD_PARAM | tr -d '[:space:]'`" != "x"; then
 	opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1`
 	remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2-`
 	while test "x$opts" != "x"; do
-		perform_groupadd "$SYSROOT" "$OPT $opts" 10
+		perform_groupadd "$SYSROOT" "$OPT $opts"
 		if test "x$opts" = "x$remaining"; then
 			break
 		fi
@@ -73,7 +73,7 @@ if test "x`echo $USERADD_PARAM | tr -d '[:space:]'`" != "x"; then
 	opts=`echo "$USERADD_PARAM" | cut -d ';' -f 1`
 	remaining=`echo "$USERADD_PARAM" | cut -d ';' -f 2-`
 	while test "x$opts" != "x"; do
-		perform_useradd "$SYSROOT" "$OPT $opts" 10
+		perform_useradd "$SYSROOT" "$OPT $opts"
 		if test "x$opts" = "x$remaining"; then
 			break
 		fi
@@ -89,7 +89,7 @@ if test "x`echo $GROUPMEMS_PARAM | tr -d '[:space:]'`" != "x"; then
 	opts=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 1`
 	remaining=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 2-`
 	while test "x$opts" != "x"; do
-		perform_groupmems "$SYSROOT" "$OPT $opts" 10
+		perform_groupmems "$SYSROOT" "$OPT $opts"
 		if test "x$opts" = "x$remaining"; then
 			break
 		fi
meta/classes/useradd_base.bbclass +43 -122

237 lines not on this page · raw message

Signature · 1 line
2.6.1