Bug 13836 - do_package_qa wrongly warns about a host user contamination
Summary: do_package_qa wrongly warns about a host user contamination
Status: RESOLVED NOTABUG
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: deployment (show other bugs)
Version: 3.0.2
Hardware: All Multiple
: Medium normal
Target Milestone: 3.2 M1
Assignee: Trevor Gamblin
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2020-03-18 09:17 UTC by h4nn35.work
Modified: 2020-06-18 08:01 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description h4nn35.work 2020-03-18 09:17:53 UTC
Preconditions/Environment
-------------------------
I think the setup isn't important in this case, but I'm building on Debian 9/ Ubuntu 19.04 for ARM (Cortex A8/A9) and x86-64 targets.

Triggering Action/Cause
-----------------------
Install into a home directory of a user(not system user) a file with the USER as owner.

Expectation
-----------
No warning should be trigger.

Actual Result
-------------
do_package_qa: QA Issue: package: /home/user/user.xml is owned by uid 1000, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

Reproducibility
---------------
20/20


I think the check in the insane.bbclass is not correct:

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

Because the path, as far as I checked, will never start with 'home/' and the other comparison will only be valid for the home directory on the target but not for anything inside of home.
But the comment and the reference manual states: 
"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."
Comment 1 Trevor Gamblin 2020-05-06 06:34:19 UTC
Hi,

Can you provide more info on the steps you took? It's not clear to me what your objective is.
Comment 2 h4nn35.work 2020-05-07 10:14:04 UTC
My objective is to install a file into a user directory like /home/user/user.xml which has user ownership.
It is similar to what is done in https://git.yoctoproject.org/cgit.cgi/poky/tree/meta-skeleton/recipes-skeleton/useradd/useradd-example.bb
The difference is that I don't set the user id and so it starts at 1000 and most of the time this is same user id as used on the build system.
Comment 3 Ross Burton 2020-06-18 08:01:26 UTC
In this case you *want* a non-root UID, so the solution would be to skip this QA test:

INSANE_SKIP_${PN} += "host-user-contaminated"