[OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-14 Thread kai.kang
From: Kai Kang 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. Use flock to reslove it by using an universal lock file for all the user and group related operations. The lock file is put in image dir /tmp.

[OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-15 Thread kai.kang
From: Kai Kang 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 file for all the user and group related operations. [YOCTO #9022] Signed-off-by:

[OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-22 Thread kai.kang
From: Kai Kang 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 file for all the user and group related operations. [YOCTO #9022] Signed-off-by:

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-15 Thread Burton, Ross
On 15 February 2016 at 01:59, wrote: > + eval flock -x -w 100 $rootdir/tmp/user-and-group-ops.flock > -c \'$PSEUDO useradd $opts\' || true > This is a great patch, but why not just flock $rootdir/etc instead of new file in tmp?Surely images end up being created with /tmp/user-

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-15 Thread Kang Kai
On 2016年02月15日 20:31, Burton, Ross wrote: On 15 February 2016 at 01:59, > wrote: + eval flock -x -w 100 $rootdir/tmp/user-and-group-ops.flock -c \'$PSEUDO useradd $opts\' || true This is a great patch, but why not just flock $rootdir/etc i

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-16 Thread Burton, Ross
On 16 February 2016 at 07:14, wrote: > +FLOCK_FILE=$SYSROOT/etc > useradd_base is also used by extrausers.bbclass, so it would be best if useradd_base decided where to use as a lock ($rootdir/${sysconfdir} sounds sensible) instead of expecting that the caller sets FLOCK_FILE and mysteriously fai

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-16 Thread Kang Kai
On 2016年02月16日 20:09, Burton, Ross wrote: On 16 February 2016 at 07:14, > wrote: +FLOCK_FILE=$SYSROOT/etc useradd_base is also used by extrausers.bbclass, so it would be best if useradd_base decided where to use as a lock ($rootdir/${sysconfdir} sounds se

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-17 Thread Burton, Ross
On 17 February 2016 at 05:40, Kang Kai wrote: > I prefer to keep such check. There is more than one case that causes > operation error such as pass wrong parameters. The messages are helpful > for developers. > In that case the groupadd will return an error code. What situations with proper l

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-22 Thread Kang Kai
On 2016年02月18日 07:49, Burton, Ross wrote: On 17 February 2016 at 05:40, Kang Kai > wrote: I prefer to keep such check. There is more than one case that causes operation error such as pass wrong parameters. The messages are helpful for developers. I

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-22 Thread Khem Raj
Patch subject is unclear. Patch itself looks ok On Mon, Feb 22, 2016 at 9:45 PM, wrote: > From: Kai Kang > > 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 usi

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-22 Thread Kang Kai
On 2016年02月23日 11:05, Khem Raj wrote: Patch subject is unclear. Patch itself looks ok How about use the title of Yocto #9022: useradd_base.bbclass: replace retry logic with flock Thanks, Kai On Mon, Feb 22, 2016 at 9:45 PM, wrote: From: Kai Kang When perform useradd during populat

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-22 Thread Richard Purdie
On Tue, 2016-02-23 at 11:35 +0800, Kang Kai wrote: > On 2016年02月23日 11:05, Khem Raj wrote: > > Patch subject is unclear. Patch itself looks ok > > How about use the title of Yocto #9022: > > useradd_base.bbclass: replace retry logic with flock Sounds good to me, thanks! Richard -- ___

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-22 Thread Kang Kai
On 2016年02月23日 15:25, Richard Purdie wrote: On Tue, 2016-02-23 at 11:35 +0800, Kang Kai wrote: On 2016年02月23日 11:05, Khem Raj wrote: Patch subject is unclear. Patch itself looks ok How about use the title of Yocto #9022: useradd_base.bbclass: replace retry logic with flock Sounds good to me

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-23 Thread Burton, Ross
On 23 February 2016 at 02:45, wrote: > 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 file for all the > user and group related operation

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-23 Thread Burton, Ross
On 23 February 2016 at 16:29, Burton, Ross wrote: > I got an error when openssh's do_install was running useradds to the > sysroot: > > | DEBUG: Executing shell function useradd_sysroot > | Running useradd commands... > | > /data/poky-master/tmp-glibc/work/core2-32-poky-linux/openssh/7.1p2-r0/tem

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-23 Thread Burton, Ross
On 23 February 2016 at 17:01, Burton, Ross wrote: > The *amazing* BB_VERBOSE_LOGS option (set to 1 in local.conf to get all > shell scripts to do set -x) tells me this is due to missing quotes around > the opts assignment: > Why do some of the opts assignments just do opts=$2, and others do a se

Re: [OE-core] [PATCH 1/1] useradd_base.bbclass: fix simultaneous with flock

2016-02-24 Thread Kang Kai
On 2016年02月24日 01:10, Burton, Ross wrote: On 23 February 2016 at 17:01, Burton, Ross > wrote: The *amazing* BB_VERBOSE_LOGS option (set to 1 in local.conf to get all shell scripts to do set -x) tells me this is due to missing quotes around the opts ass