Bug 3500

Summary: Host user not recognized when building meta-toolchain-sdk
Product: [Documentation] Development Manual Reporter: Alexandru Georgescu <alexandru.c.georgescu>
Component: developmentAssignee: Laurentiu Palcu <laurentiu.palcu>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: liang.li2, poky.bs.watcher, poky.watcher, seebs, sgw
Version: 1.4   
Target Milestone: 1.4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---
Attachments:
Description Flags
do_populate_sdk log none

Description Alexandru Georgescu 2012-11-27 16:37:30 UTC
Created attachment 955 [details]
do_populate_sdk log

The following warning appears when trying to build meta-toolchain-sdk.

ENVIRONMENT USED:
commit id: 0d7d413d64bab8d3c758414c6c8c653ccc325653
HOST OS: Fedoar 17 64bit.
Build Configuration:
BB_VERSION        = "1.16.0"
TARGET_ARCH       = "i586"
TARGET_OS         = "linux"
MACHINE           = "qemux86"
DISTRO            = "poky"
DISTRO_VERSION    = "1.3+snapshot-20121127"
TUNE_FEATURES     = "m32 i586"
TARGET_FPU        = ""
meta
meta-yocto
meta-yocto-bsp    = "<unknown>:<unknown>"



STEPS TO REPRODUCE:
1. Build  meta-toolchain-sdk.

ACTUAL RESULT
1. in my poky/build/tmp/work/i586-poky-linux/meta-toolchain-gmae/1.0-r7/temp/log.do_populate_sdk.23481 I have the following warning:

nativesdk-automake          ################################warning: user alex does not exist - using root


I have attached the log file (line 558).
Comment 1 Jessica 2012-12-06 00:25:55 UTC
Laurentiu,

Seems your recent patch should address this issue.

Thanks,
jessica
Comment 2 Laurentiu Palcu 2012-12-07 14:40:14 UTC
This looks like a pseudo issue. In the do_install function of the automake recipe we have the following loop [1].

* aclocal-1.12 is hardlink to aclocal
* automake-1.12 is a hardlink to automake

As you can see in the [2] listing, after the loop completes, aclocal-1.12 and automake-1.12 have another ownership. That's because 'sed -i' creates a temporary file first and then does a "mv tmp_file aclocal". This basically deletes the old file and creates another one with a new inode. The hardlink will point to the old inode, which is fine, but the ownership is changed to 'test'! After the loop, we will end up with 4 different files actually.

So, the main question here is: why does the ownerchip changes?

[1]
for i in aclocal aclocal-1.12 automake automake-1.12; do
  if [ -f ${D}${bindir}/$i ]; then
     sed -i -e '##NOT_IMPORTANT##' ${D}${bindir}/$i
  fi
done

[2]
before loop:
6338159 drwxr-xr-x 2 root root   4096 Dec  7 16:12 .
6338158 drwxr-xr-x 4 root root   4096 Dec  7 16:12 ..
6338445 -rwxr-xr-x 2 root root  31882 Dec  7 16:12 aclocal
6338445 -rwxr-xr-x 2 root root  31882 Dec  7 16:12 aclocal-1.12
6338444 -rwxr-xr-x 2 root root 256888 Dec  7 16:12 automake
6338444 -rwxr-xr-x 2 root root 256888 Dec  7 16:12 automake-1.12

after loop:
6338159 drwxr-xr-x 2 root root   4096 Dec  7 16:12 .
6338158 drwxr-xr-x 4 root root   4096 Dec  7 16:12 ..
6340801 -rwxr-xr-x 1 root root  31883 Dec  7 16:12 aclocal
6340802 -rwxr-xr-x 1 test test  31883 Dec  7 16:12 aclocal-1.12
6338445 -rwxr-xr-x 1 root root 256889 Dec  7 16:12 automake
6340803 -rwxr-xr-x 1 test test 256889 Dec  7 16:12 automake-1.12
Comment 3 Laurentiu Palcu 2012-12-12 15:06:58 UTC
I found the root cause. It looks like ln, in newer versions of coreutils, uses linkat() system call in order to create a hardlink, instead of link(). Unfortunately, pseudo does not have a linkat() wrapper function and the hard link is not recorded in the database. Hence, when the file the link points to is deleted and the inode dissapears from the DB, the hard link ownership swtiches to the current user.

I will work on implementing a wrapper script for linkat() and give it a try.
Comment 4 Seebs 2012-12-12 20:13:58 UTC
Agreed that I need a linkat() wrapper. This is... way harder than I anticipated, partially because the obvious implementation would break strangely on Darwin. Hoping to get a patch done "soon".
Comment 5 Seebs 2012-12-12 22:13:07 UTC
I have a possible fix for this up on the SEEBS_TESTING branch of pseudo.
Comment 6 Laurentiu Palcu 2012-12-13 09:06:44 UTC
Seebs,

I tested your fixes and the results are good. Hardlink ownership is maintained after the original file is deleted.

Let me know when is the next pseudo release or, if you're not planning a release any time soon, let me know when you merge the changes in master so I can switch to pseudo_git recipe.
Comment 7 Laurentiu Palcu 2013-02-11 10:22:28 UTC
Pseudo has been upgraded to 1.4.3. Closing this now.