Bug 15863

Summary: useradd: using only USERADD_DEPENDS gives errors about not setting one of the useradd class variables
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Ludovic Jozeau <ludovic.jozeau+yocto-bug>
Component: oe-core otherAssignee: Unassigned <unassigned>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: ccasciato, mathieu.dubois-briand, randy.macleod, yoann.congal
Version: 5.0.9   
Target Milestone: 6.1 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Ludovic Jozeau 2025-05-14 09:50:01 UTC
I have a recipe that depends on the user/group created in another one (while not creating users nor groups itself), so I naturally tried to use the new USERADD_DEPENDS variable from the useradd class

unfortunately it gives the following errors:

"inherits useradd but doesn't set USERADD_PACKAGES"

then when I set USERADD_PACKAGES to "${PN}"

I now have this error:

"... inherits useradd but doesn't set USERADD_PARAM, GROUPADD_PARAM or GROUPMEMS_PARAM for package ..."

I think the USERADD_DEPENDS variable should also be checked if it is set

also extending the tests in selftest-users, something like:

# usegroup1.bb:

SUMMARY = "usegroupb1"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

LICENSE = "MIT"

USERADD_DEPENDS = "dcreategroup"

S = "${WORKDIR}"

EXCLUDE_FROM_WORLD="1"

inherit useradd allarch

USERADD_PACKAGES = "${PN}"

TESTDIR = "${D}${sysconfdir}/creategroup"

do_install() {
	install -d   ${TESTDIR}
	install -d   ${TESTDIR}/dir
	touch        ${TESTDIR}/file
	ln -s ./file ${TESTDIR}/symlink
	install -d   ${TESTDIR}/fifotest
	mkfifo       ${TESTDIR}/fifotest/fifo

	chown    d_user:d_group ${TESTDIR}/file
	chown -R d_user:b_group ${TESTDIR}/dir
	chown -h d_user:d_group ${TESTDIR}/symlink
	chown -R d_user:b_group ${TESTDIR}/fifotest
}
Comment 1 Randy MacLeod 2025-05-15 14:43:30 UTC
Yoann or Ludovic to send a patch, hopefully.
Comment 2 Yoann Congal 2025-11-06 10:57:03 UTC
Bulk move to 6.0 M1
Comment 3 Yoann Congal 2026-04-03 09:25:41 UTC
(Unassigning myself since a do not realistically have the time to work on this)