Bug 15023

Summary: Cannot build SDK with api-documentation enabled
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ross Burton <ross.burton>
Component: devtools / tool chainAssignee: Eilís Ní Fhlannagáin <pidge>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: meta.mr.watcher, meta.watcher, pidge, randy.macleod
Version: 4.2   
Target Milestone: 4.3 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Ross Burton 2023-01-30 15:59:59 UTC
If I build a SDK with api-documentation DISTRO_FEATURE enabled:

ERROR: core-image-base-1.0-r0 do_populate_sdk: Postinstall scriptlets of ['alsa-utils-doc', 'kmod-doc', 'libglib-2.0-doc', 'openssh-doc', 'systemd-doc', 'util-linux-doc'] have failed. If the intention is to defer them to first boot,

Looking at the log:

+ chown man:man /yocto/ross/build/tmp/work/qemuarm64-poky-linux/core-image-base/1.0-r0/sdk/image/usr/local/oe-sdk-hardcoded-buildpath/sysroots/cortexa57-poky-linux/var/cache/man/./fr/index.db
chown: invalid user: ‘man:man’
Error in POSTIN scriptlet in rpm package kmod-doc

Is pseudo looking in the wrong place for the passwd?
Comment 1 Eilís Ní Fhlannagáin 2023-08-16 15:59:09 UTC
It's not so much that pseudo is looking in the wrong place for a passwd file, it's that the passwd/group files it finds has no man:man in it. Adding man to ../meta/recipes-devtools/pseudo/files/fallback-group and ../meta/recipes-devtools/pseudo/files/fallback-passwd gets past the error (but is obviously not the correct fix)

The correct fix is to probably adduser when api-documentation is set as a DISTRO_FEATURES. I'll have a patch soon.
Comment 2 Eilís Ní Fhlannagáin 2023-09-07 15:02:59 UTC
So the issue here is deeper and has to do with the nativesdk-intercepts for chown and chgrp.

Running either of these ends up corrupting the os.execv args.

If we run:
./scripts/nativesdk-intercept/chown -R foo:foo bar

The loop here ends up missing the conversion of foo:foo to root:root because
it sees sys.argv[0] and assumes that it's the user:group argument and that we
should convert that. We end up a os.execv(path, args) that have the following
args:

['root:root', '-R', 'foo:foo', 'bar']

As os.execv ignores args[0], we can just populate it with sys.argv[0] and then
loop through sys.argv[1:]. As both chgrp and chown would have either flags and
USER[:GROUP] next, this fixes the issue.

I have a patch for this, but the question I'm trying to answer now is where the PATH prepend goes. Looking at this, it might need to go down in oe/lib/sdk.py