* [PATCH 0/1] image_type.bbclass: add '--numeric-owner' to tar command @ 2013-10-18 7:47 Qi.Chen 2013-10-18 7:47 ` [PATCH 1/1] image_types.bbclass: add --numeric-owner option " Qi.Chen 0 siblings, 1 reply; 4+ messages in thread From: Qi.Chen @ 2013-10-18 7:47 UTC (permalink / raw) To: openembedded-core From: Chen Qi <Qi.Chen@windriver.com> The following changes since commit 529bf977e956175bd8405ebffc88194192e44740: update-rcd.bbclass: fix host/target test (2013-10-16 14:51:07 +0100) are available in the git repository at: git://git.pokylinux.org/poky-contrib ChenQi/tar-numeric-owner http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/tar-numeric-owner Chen Qi (1): image_types.bbclass: add --numeric-owner option to tar command meta/classes/image_types.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 1.7.9.5 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/1] image_types.bbclass: add --numeric-owner option to tar command 2013-10-18 7:47 [PATCH 0/1] image_type.bbclass: add '--numeric-owner' to tar command Qi.Chen @ 2013-10-18 7:47 ` Qi.Chen 2013-10-18 14:57 ` Richard Purdie 0 siblings, 1 reply; 4+ messages in thread From: Qi.Chen @ 2013-10-18 7:47 UTC (permalink / raw) To: openembedded-core From: Chen Qi <qi.chen@windriver.com> If the same username exists on both target and the build host, but the uids differ, and we start target via NFS, then the uid for the user will be incorrect on target. For example, if postfix's uid on host is 119 and on target is 1024, then if we start target via NFS, the uid for postfix will be 119. The root cause is that when we use runqemu-extract-sdk to generate the NFS rootfs for later use, the tar command will respect the username instead of uid. So if PSEUDO_PASSWD environment is not set correctly, the host /etc/passwd will be used, resulting in wrong uids. The situation for gid is completely analogous to that of uid. It's almost impossible for the runqemu-extract-sdk to guess the correct location of the needed password file merely based on the target tarball name. This patch solves this problem by adding the '--numeric-owner' option to the tar command so that the username/groupname is not recorded in the tarball. In this situation, we'll always get the correct uid/gid after extracting the tarball. [YOCTO #5364] Signed-off-by: Chen Qi <Qi.Chen@windriver.com> --- meta/classes/image_types.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 9ead059..234c9ff 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -171,7 +171,7 @@ IMAGE_CMD_btrfs () { IMAGE_CMD_squashfs = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs ${EXTRA_IMAGECMD} -noappend" IMAGE_CMD_squashfs-xz = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs-xz ${EXTRA_IMAGECMD} -noappend -comp xz" -IMAGE_CMD_tar = "cd ${IMAGE_ROOTFS} && tar -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar ." +IMAGE_CMD_tar = "cd ${IMAGE_ROOTFS} && tar --numeric-owner -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar ." CPIO_TOUCH_INIT () { if [ ! -L ${IMAGE_ROOTFS}/init ] -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] image_types.bbclass: add --numeric-owner option to tar command 2013-10-18 7:47 ` [PATCH 1/1] image_types.bbclass: add --numeric-owner option " Qi.Chen @ 2013-10-18 14:57 ` Richard Purdie 2013-10-21 2:43 ` ChenQi 0 siblings, 1 reply; 4+ messages in thread From: Richard Purdie @ 2013-10-18 14:57 UTC (permalink / raw) To: Qi.Chen; +Cc: openembedded-core On Fri, 2013-10-18 at 15:47 +0800, Qi.Chen@windriver.com wrote: > From: Chen Qi <qi.chen@windriver.com> > > If the same username exists on both target and the build host, but > the uids differ, and we start target via NFS, then the uid for the > user will be incorrect on target. > > For example, if postfix's uid on host is 119 and on target is 1024, > then if we start target via NFS, the uid for postfix will be 119. > > The root cause is that when we use runqemu-extract-sdk to generate > the NFS rootfs for later use, the tar command will respect the username > instead of uid. So if PSEUDO_PASSWD environment is not set correctly, > the host /etc/passwd will be used, resulting in wrong uids. > > The situation for gid is completely analogous to that of uid. > > It's almost impossible for the runqemu-extract-sdk to guess the correct > location of the needed password file merely based on the target tarball > name. > > This patch solves this problem by adding the '--numeric-owner' option > to the tar command so that the username/groupname is not recorded in > the tarball. In this situation, we'll always get the correct uid/gid > after extracting the tarball. > > [YOCTO #5364] > > Signed-off-by: Chen Qi <Qi.Chen@windriver.com> > --- > meta/classes/image_types.bbclass | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Er, isn't the right fix to fix runqemu-extract-sdk to use numeric IDs then rather than butcher all the tarballs we create? Cheers, Richard ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] image_types.bbclass: add --numeric-owner option to tar command 2013-10-18 14:57 ` Richard Purdie @ 2013-10-21 2:43 ` ChenQi 0 siblings, 0 replies; 4+ messages in thread From: ChenQi @ 2013-10-21 2:43 UTC (permalink / raw) To: Richard Purdie; +Cc: openembedded-core On 10/18/2013 10:57 PM, Richard Purdie wrote: > On Fri, 2013-10-18 at 15:47 +0800, Qi.Chen@windriver.com wrote: >> From: Chen Qi <qi.chen@windriver.com> >> >> If the same username exists on both target and the build host, but >> the uids differ, and we start target via NFS, then the uid for the >> user will be incorrect on target. >> >> For example, if postfix's uid on host is 119 and on target is 1024, >> then if we start target via NFS, the uid for postfix will be 119. >> >> The root cause is that when we use runqemu-extract-sdk to generate >> the NFS rootfs for later use, the tar command will respect the username >> instead of uid. So if PSEUDO_PASSWD environment is not set correctly, >> the host /etc/passwd will be used, resulting in wrong uids. >> >> The situation for gid is completely analogous to that of uid. >> >> It's almost impossible for the runqemu-extract-sdk to guess the correct >> location of the needed password file merely based on the target tarball >> name. >> >> This patch solves this problem by adding the '--numeric-owner' option >> to the tar command so that the username/groupname is not recorded in >> the tarball. In this situation, we'll always get the correct uid/gid >> after extracting the tarball. >> >> [YOCTO #5364] >> >> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> >> --- >> meta/classes/image_types.bbclass | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > Er, isn't the right fix to fix runqemu-extract-sdk to use numeric IDs > then rather than butcher all the tarballs we create? > > Cheers, > > Richard > > > Thanks for pointing it out. V2 has been sent out. Best Regards, Chen Qi ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-21 2:42 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-10-18 7:47 [PATCH 0/1] image_type.bbclass: add '--numeric-owner' to tar command Qi.Chen 2013-10-18 7:47 ` [PATCH 1/1] image_types.bbclass: add --numeric-owner option " Qi.Chen 2013-10-18 14:57 ` Richard Purdie 2013-10-21 2:43 ` ChenQi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox