Bug 15023 - Cannot build SDK with api-documentation enabled
Summary: Cannot build SDK with api-documentation enabled
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 4.2
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 4.3 M4
Assignee: Eilís Ní Fhlannagáin
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2023-01-30 15:59 UTC by Ross Burton
Modified: 2023-10-17 13:31 UTC (History)
4 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 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