diff mbox series

[wrynose,meta-oe,17/45] conserver: only inherit useradd with systemd

Message ID 20261201064402.3934788-17-anuj.mittal@oss.qualcomm.com
State Under Review
Delegated to: Anuj Mittal
Headers show
Series [wrynose,meta-networking,01/45] proftpd: upgrade 1.3.9d -> 1.3.9e | expand

Commit Message

Anuj Mittal Dec. 1, 2026, 6:43 a.m. UTC
From: Peter Suti <peter.suti@streamunlimited.com>

With multilib enabled and systemd not in DISTRO_FEATURES, parsing
fails:

    ERROR: .../conserver_8.3.0.bb: .../conserver_8.3.0.bb inherits
    useradd but doesn't set USERADD_PACKAGES

Without systemd, USERADD_PACKAGES only holds whitespace. That passes
the "if not useradd_packages" check in useradd.bbclass, but for a
multilib variant multilib.bbclass filters the variable through
suffix_filter(), which returns " ".join(val.split()). The result is an
empty string and the check fails.

Fix this by inheriting useradd only when systemd is enabled, as the
user is only needed by conserver.service. USERADD_PACKAGES can then be
set unconditionally. chrony does the same for its privdrop user.

Tested on qemux86-64 with MULTILIBS = "multilib:lib32", both with
INIT_MANAGER = "sysvinit" and "systemd":

    bitbake -p
    bitbake -e conserver
    bitbake -e lib32-conserver

With sysvinit, useradd is not inherited, so as before no user is
created. With systemd, USERADD_PACKAGES is "conserver" and
"lib32-conserver" and both inherit useradd.

Fixes https://github.com/openembedded/meta-openembedded/issues/1058

AI-Generated: Claude Code, Opus 5.5
Signed-off-by: Peter Suti <peter.suti@streamunlimited.com>
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
(cherry picked from commit 110814e9d8e4a43dfdf882121e19447968b00aa5)
Signed-off-by: Anuj Mittal <anuj.mittal@oss.qualcomm.com>
---
 meta-oe/recipes-connectivity/conserver/conserver_8.3.0.bb | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/meta-oe/recipes-connectivity/conserver/conserver_8.3.0.bb b/meta-oe/recipes-connectivity/conserver/conserver_8.3.0.bb
index c32d6f9646..29bb6d147d 100644
--- a/meta-oe/recipes-connectivity/conserver/conserver_8.3.0.bb
+++ b/meta-oe/recipes-connectivity/conserver/conserver_8.3.0.bb
@@ -17,7 +17,8 @@  LIC_FILES_CHKSUM = "file://LICENSE;md5=b28513e7b696027d3d2b8dbf117f9fe5"
 
 DEPENDS = "libxcrypt"
 
-inherit autotools ptest systemd useradd
+inherit autotools ptest systemd
+inherit_defer ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'useradd', '', d)}
 
 SRC_URI = "\
     git://github.com/bstansell/conserver;protocol=https;branch=master;tag=v${PV} \
@@ -80,9 +81,7 @@  RDEPENDS:${PN}-ptest += "bash"
 
 SYSTEMD_SERVICE:${PN} = "${PN}.service"
 
-USERADD_PACKAGES = "\
-    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${PN}', '', d)} \
-"
+USERADD_PACKAGES = "${PN}"
 USERADD_PARAM:${PN} = "\
     -M -d /invalid -r -U -s ${sbindir}/nologin conserver; \
 "