Bug 14553 - insane.bbclass: host-user-contaminated QA doesn't skip the home directory
Summary: insane.bbclass: host-user-contaminated QA doesn't skip the home directory
Status: CLOSED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: oe-core other (show other bugs)
Version: 3.4
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 4.1 M3
Assignee: Ahmed Hossam
QA Contact:
URL:
Whiteboard: NEWCOMER
Depends on:
Blocks:
 
Reported: 2021-09-17 05:26 UTC by Ahmed Hossam
Modified: 2022-08-09 22:40 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Layer with a recipe that demonstrates the issue (3.58 KB, application/zip)
2022-04-13 15:42 UTC, Ahmed Hossam
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmed Hossam 2021-09-17 05:26:04 UTC
According to the description:
host-user-contaminated: Checks that no package produced by the recipe contains any files outside of /home with a user or group ID that matches the user running BitBake. ...

However looking at the code:
http://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/classes/insane.bbclass#n948

    dest = d.getVar('PKGDEST')
    pn = d.getVar('PN')
    home = os.path.join(dest, 'home')
    if path == home or path.startswith(home + os.sep):
        return

PKGDEST is ${WORKDIR}/packages-split, so the path is checked against ${WORKDIR}/packages-split/home, which doesn't match yocto's pattern of ${WORKDIR}/packages-split/$PACKAGE_NAME/home/...

P.S. I was not able to suppress the warning using INSANE_SKIP:${PN}
Comment 1 Abongwa Bonalais Amahnui 2022-04-11 08:41:50 UTC
Hello Ahmed, I wish to ask how to reproduce this error.
Comment 2 Abongwa Bonalais Amahnui 2022-04-11 09:03:31 UTC
I'm asking because I would like to work on it
Comment 3 Randy MacLeod 2022-04-12 00:39:44 UTC
Abongwa, thats great!
Ahmen, could you help out by providing detailed steps to reproduce?
Comment 4 Ahmed Hossam 2022-04-13 15:42:00 UTC
Created attachment 4858 [details]
Layer with a recipe that demonstrates the issue

I attached a layer that reproduces the bug, to reproduce extract the layer and run the following commands:

git clone git://git.yoctoproject.org/poky
source poky/oe-init-build-env
bitbake-layers add-layer ../meta-bugtest
bitbake example

You should see the following warning
WARNING: example-0.1-r0 do_package_qa: QA Issue: example: /home/testuser/dummy.sh is owned by uid 1000, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

Note: to reproduce this bug you need to run bitbake with a user id 1000, this is the default on most installations, you can check it by running "id -u"
Comment 5 Randy MacLeod 2022-04-13 20:49:28 UTC
Thanks Ahmed.
Abongwa, I've assigned the bug to you. Let me know if you need help.
Comment 6 Ahmed Hossam 2022-06-22 15:34:09 UTC
Patch submitted: https://lists.openembedded.org/g/openembedded-core/message/167243
Comment 7 Ahmed Hossam 2022-08-09 22:39:03 UTC
Fixed on OE-core master

https://git.openembedded.org/openembedded-core/commit/?id=ae8f22d9e2694eea5ede3b31c6f3bca404ea4a5a

Fix taken into Poky master

https://git.yoctoproject.org/poky/commit/?id=24e6bbb90f5b8a4ba1e867b2652cd4a39ffd259d

It was also back ported to other branches.
Comment 8 Ahmed Hossam 2022-08-09 22:40:28 UTC
Closing bug.