Bug 5980

Summary: cdrtools-native 3.01a17: do_install failed
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Michael Wiederkehr <michael.wiederkehr>
Component: deploymentAssignee: Saul Wold <sgw>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: Medium CC: sgw
Version: unspecified   
Target Milestone: 1.6 M5   
Hardware: x86   
OS: x86_64   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
install log none

Description Michael Wiederkehr 2014-03-17 07:43:51 UTC
Created attachment 1820 [details]
install log

Hi,

I've tried to build yocto dora (genericx86 sato, intel sandy bridge) with several different hosts (Ubuntu 13.04, 13.10 and openSUSE 13.1) and get always the same error on building the cdrtools-native
Comment 1 Saul Wold 2014-03-18 19:21:33 UTC
I think I need some more details about what you are doing, I tried to reproduce 
this and I think somehow you are running this as root possibly?  There are some 
tests in the install-sh script to check if the -o and -g options are available. 
 In my builds, I get the following lines:

        ==> INSTALLING 
"/home/sgw/yocto/builds/world/tmp/work/x86_64-linux/cdrtools-native/3.01a20-r0/image/home/sgw/yocto/builds/world/tmp/sysroots/x86_64-linux/usr/include/schily/x86_64-linux-cc/xconfig.h"
Intercept /home/sgw/yocto/poky/scripts/native-intercept/chown: root 
/tmp/xd.1855/xx.1855 -- do nothing
install: -o option available only to root -- ignored
install: -g option available only to root -- ignored

It is not recommeded that you run as root, if you are indeed not running as 
root, then the chmod command is a problem somehow in the install-sh, since it 
should fail and therefore set  the rootflag to FALSE in install-sh, you can see 
we use an intercept for chown (the --do nothing note), which is used in your 
build.
Comment 2 Michael Wiederkehr 2014-03-19 10:24:19 UTC
(In reply to comment #1)
> I think I need some more details about what you are doing, I tried to
> reproduce 
> this and I think somehow you are running this as root possibly?  There are
> some 
> tests in the install-sh script to check if the -o and -g options are
> available. 
>  In my builds, I get the following lines:
> 
>         ==> INSTALLING 
> "/home/sgw/yocto/builds/world/tmp/work/x86_64-linux/cdrtools-native/3.01a20-
> r0/image/home/sgw/yocto/builds/world/tmp/sysroots/x86_64-linux/usr/include/
> schily/x86_64-linux-cc/xconfig.h"
> Intercept /home/sgw/yocto/poky/scripts/native-intercept/chown: root 
> /tmp/xd.1855/xx.1855 -- do nothing
> install: -o option available only to root -- ignored
> install: -g option available only to root -- ignored
> 
> It is not recommeded that you run as root, if you are indeed not running as 
> root, then the chmod command is a problem somehow in the install-sh, since
> it 
> should fail and therefore set  the rootflag to FALSE in install-sh, you can
> see 
> we use an intercept for chown (the --do nothing note), which is used in your 
> build.

Dear Saul,

thanks for your infos. I don't run hob/bitbake as root! 

For testing I commented out the line (install-sh) where the rootflag is set TRUE. After that change the build succeeds!

So as you mentioned the chmod command is the problem. I'm running all hosts under VMWare WS. Maybe that causes the chmod problem?
Comment 3 Saul Wold 2014-03-19 19:03:59 UTC
Ok, so you commented out that line out and it worked, looking further, can you 
you verify if the next check, inside the the rootflag = TRUE looking at the 
dsttmp file, it should be setting the rootflag to FLASE there.  I realized, the 
chown will pass because of the intercept and then the chmod will pass because 
it's still owned by you, so that will succeed and set rootflag to TRUE, which 
will then kick into the "Win95" check, which in this case should be our friend. 
 We should be checking if dsttmp file is owned by root, which it won't be and 
then set rootflag back to FALSE, if this check fails, then rootflag will remain 
TRUE and you encounter the failure you see.  So a question is which shell are 
you using, possibly a bash/dash issue then?
Comment 4 Michael Wiederkehr 2014-03-20 10:17:37 UTC
Current shell is bash (open SUSE 13.1, GNOME)
Comment 5 Saul Wold 2014-04-01 16:17:16 UTC
Sorry, I was away on a trip, back now.  In my comment #3, I suggested a course 
though the install-sh script, can you verify that is what's happening via 
echo's or other debug checks?

Let me know if you can do that, I really would like to track down what you are 
seeing.
Comment 6 Michael Wiederkehr 2014-04-02 08:25:27 UTC
Hi, no problem. With commenting out the chown/chmod line I was able to continue with my work.

Now I know whats going wrong. I've logged out the result of "ls -l {dsttmp}":

-rwxr-xr-x 1 wroot wroot 1 Apr  2 09:32 /tmp/xd.3191/xx.3191

The problem is the (stupid) user name "wroot"! Grep for "root" will succeed then and rootflag stays TRUE.

I used that username for all host installations!
Comment 7 Saul Wold 2014-04-02 20:29:28 UTC
Ah, that will do it, I guess we could modify the script to check for uid of 0 
instead of root, but this is such an edge case, but I will provide a quick 
patch here for you to test if you can.

85c85,87
< 	ls -l ${dsttmp} 2> /dev/null | grep root > /dev/null || rootflag=FALSE
---
> 	if [ `ls -l ${dsttmp} 2> /dev/null | awk '{print $3}'` = 0 ]; then
> 		rootflag=FALSE
> 	fi

But I think I will close this offically, unless you feel strongly that we need 
to patch the cdrtools scripts.

Sau!
Comment 8 Michael Wiederkehr 2014-04-03 07:39:46 UTC
Hi Saul,

I've tried your fix, but the build still fails!

I modified the fix to get numeric uid output (option -n) and checking the uid to be unequal zero:

85c85,87
< 	ls -l ${dsttmp} 2> /dev/null | grep root > /dev/null || rootflag=FALSE
---
> 	if [ `ls -n ${dsttmp} 2> /dev/null | awk '{print $3}'` != 0 ]; then
> 		rootflag=FALSE
> 	fi

For me it's ok when you close this case. I change the username of my host installations to avoid the problem!

Thanks a lot for your help.

Best regards

Michael
Comment 9 Saul Wold 2014-04-03 15:35:33 UTC
User name confusion with wroot