runqemu-extract-sdk: add --numeric-owner option to tar command
v2 cover runqemu-extract-sdk: add --numeric-owner option to tar command
From: Chen Qi <[email protected]>
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):
runqemu-extract-sdk: add --numeric-owner option to tar command
scripts/runqemu-extract-sdk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v2 1/1 runqemu-extract-sdk: add --numeric-owner option to tar command
From: Chen Qi <[email protected]>
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 uid/gid will be used when extracting the tarball using runqemu-extract-sdk. In this situation, we'll always get the correct uid/gid after extracting the tarball.
[YOCTO #5364]
--- scripts/runqemu-extract-sdk | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/runqemu-extract-sdk +3 -3
@@ -54,13 +54,13 @@ fi TAR_OPTS="" if [[ "$ROOTFS_TARBALL" =~ tar\.bz2$ ]]; then - TAR_OPTS="-xjf" + TAR_OPTS="--numeric-owner -xjf" fi if [[ "$ROOTFS_TARBALL" =~ tar\.gz$ ]]; then - TAR_OPTS="-xzf" + TAR_OPTS="--numeric-owner -xzf" fi if [[ "$ROOTFS_TARBALL" =~ \.tar$ ]]; then - TAR_OPTS="-xf" + TAR_OPTS="--numeric-owner -xf" fi if [ -z "$TAR_OPTS" ]; then echo "Error: Unable to determine sdk tarball format"
Signature · 1 line
1.7.9.5