Bug 775

Summary: file-native needs to be wrapped
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Saul Wold <sgw>
Component: coreAssignee: Saul Wold <sgw>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: High CC: andrea.adami, meta.mr.watcher, meta.watcher, richard.purdie
Version: 1.0   
Target Milestone: 1.1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: ---
Attachments:
Description Flags
log.do_package
none
strace of update-rc.d from devshell
none
strace of file
none
strace of update-rc.d none

Description Saul Wold 2011-02-25 15:27:14 UTC
File hard codes sysroot paths in binary and can fail when installed via sstate-cache. The native version of file needs to be wrapped and pass the --magic-file option with the correct sysroot location for magic.mgc
Comment 2 Saul Wold 2011-07-22 11:30:34 UTC
file-native is working correctly with the wrapper
Comment 3 Andrea Adami 2011-09-15 16:30:01 UTC
Created attachment 233 [details]
log.do_package
Comment 4 Andrea Adami 2011-09-15 16:32:20 UTC
It seems that file-native behaves incorrectly and peeks at buildhost file.

Evidences are e.g. in  log.do_package of update-modules-1.0-r10 and update-rc.d-0.7-r4 in all-oe-linux.
...
error: magic_load(ms, /usr/share/misc/magic) failed: File 5.4 supports only version 7 magic files. `/usr/share/misc/magic.mgc' is version 8
rpmdeps: rpmfc.c:1154: rpmfcClassify: Assertion `mg != ((void *)0)' failed.
...

Buildcase: the magic.mgc in sysroot is v7 and the one on buildhost/Gentoo is v8.

andrea@mizar /oe/oe-core/build $ file /oe/oe-core/build/tmp-eglibc/sysroots/i686-linux/usr/share/misc/magic.mgc 
/oe/oe-core/build/tmp-eglibc/sysroots/i686-linux/usr/share/misc/magic.mgc: magic binary file for file(1) cmd (version 7) (little endian)

andrea@mizar /oe/oe-core/build $ file /usr/share/misc/magic.mgc /usr/share/misc/magic.mgc: magic binary file for file(1) cmd (version 8) (little endian)

Regards

Andrea
Comment 5 Saul Wold 2011-09-21 22:21:26 UTC
So you are building with a gentoo system?

Can you please confirm which file is being found when you do an update-rc.d with devshell, maybe attach an "strace -o file.strace -s 8192 -f" output.  This might be a Gentoo specific issue that we need to understand.  I do not see this issue on F15 or Ubunto 10.10 system

thanks
Comment 6 Saul Wold 2011-09-25 10:53:55 UTC
Andrea, please let me know if you are still having issues, Please confirm the version of Yocto you are using and if you can provide the strace output that would also be helpful.
Comment 7 Andrea Adami 2011-09-25 14:00:25 UTC
Created attachment 253 [details]
strace of update-rc.d from devshell

andrea@mizar /oe/oe-core/build $ bitbake -c devshell update-rc.d

andrea@mizar /oe/oe-core/build/tmp-eglibc/work/all-oe-linux/update-rc.d-0.7-r4/g
it $ which file
/oe/oe-core/build/tmp-eglibc/sysroots/i686-linux/usr/bin/file

While there, straced update-rc.d (see log)

Thanks for investigating it

Andrea
Comment 8 Andrea Adami 2011-09-25 15:59:42 UTC
Created attachment 254 [details]
strace of file

Attached output of:

andrea@mizar /oe/oe-core/build/tmp-eglibc/work/all-oe-linux/update-rc.d-0.7-r4/g
it $ which file
/oe/oe-core/build/tmp-eglibc/sysroots/i686-linux/usr/bin/file
andrea@mizar /oe/oe-core/build/tmp-eglibc/work/all-oe-linux/update-rc.d-0.7-r4/g
it $ strace -o file.strace -s 8192 -f file
Usage: file.real [-bchikLNnprsvz0] [--apple] [--mime-encoding] [--mime-type]
            [-e testname] [-F separator] [-f namefile] [-m magicfiles] file ...
       file.real -C [-m magicfiles]
       file.real [--help]
andrea@mizar /oe/oe-core/build/tmp-eglibc/work/all-oe-linux/update-rc.d-0.7-r4/g
it $
Comment 9 Andrea Adami 2011-09-25 16:19:45 UTC
Created attachment 255 [details]
strace of update-rc.d

more useful strace...
Comment 10 Saul Wold 2011-09-25 21:19:05 UTC
Ok, I am getting a better understanding of this problem now, it's not actaully file that failing as this was the orignal bug.  It seems we have a different problem and would be better suited to have a new bug filed.

Can you file a new bug and attach both the log.do_package, along with the run.do_package and run.do_package_rpm files.  I am looking at my run* files and see a BUILDSPEC command being build and I wonder if there is some host contamination with the magic_load from RPM in this case.  Also if you have a run.BUILDSPEC, please attach that.  If run.BUILDPSEC exists, please run it using strace, maybe that will lead me someplace.  Also provide an  ldd `which rpmbuild.real`.

Thanks
Comment 11 Saul Wold 2011-09-27 10:59:54 UTC
This bug kind of got hijacked because of the similar nature of the problem, the real issue is in RPM, see the new bug #1532, I am remarking this one as resolved