1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 05:09:24 +00:00

shadow: Avoid nss warning/error with musl

The libnss configuration file is only installed when glibc is used. The
inexistence of it on a musl-based rootfs, will make shadow complain
about it:

Failed opening /etc/nsswitch.conf

This is because shadow will try to use nsswich when dealing with
subordinate IDs and the message is just a warning as the tool will still
generate them correctly in subuid/subgid files.

We drop this log message for class native to avoid an error when rootfs
logs are checked ('Failed' will match the regex bitbake is using to
check for rootfs generation errors).

(From OE-Core rev: e5ce33228858fcc12051548399c71ce10346bf5b)

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Andrei Gherzan
2022-08-25 18:30:41 +02:00
committed by Richard Purdie
parent c917d00ea3
commit 5f3999c41a
2 changed files with 29 additions and 0 deletions
@@ -0,0 +1,27 @@
From aed5a184401fbbe901cb825be4004ced885b6f9a Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Wed, 24 Aug 2022 00:54:47 +0200
Subject: [PATCH] Drop nsswitch.conf message when not in place - eg. musl
Upstream-Status: Inappropriate [issue reported at https://github.com/shadow-maint/shadow/issues/557]
Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
lib/nss.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/nss.c b/lib/nss.c
index af3e95a..74e0e16 100644
--- a/lib/nss.c
+++ b/lib/nss.c
@@ -57,7 +57,7 @@ void nss_init(char *nsswitch_path) {
// subid: files
nssfp = fopen(nsswitch_path, "r");
if (!nssfp) {
- fprintf(shadow_logfd, "Failed opening %s: %m", nsswitch_path);
+ //fprintf(shadow_logfd, "Failed opening %s: %m", nsswitch_path);
atomic_store(&nss_init_completed, true);
return;
}
--
2.25.1
+2
View File
@@ -26,6 +26,7 @@ SRC_URI:append:class-target = " \
SRC_URI:append:class-native = " \
file://0001-Disable-use-of-syslog-for-sysroot.patch \
file://commonio.c-fix-unexpected-open-failure-in-chroot-env.patch \
file://0001-Drop-nsswitch.conf-message-when-not-in-place-eg.-musl.patch \
"
SRC_URI:append:class-nativesdk = " \
file://0001-Disable-use-of-syslog-for-sysroot.patch \
@@ -33,6 +34,7 @@ SRC_URI:append:class-nativesdk = " \
SRC_URI[sha256sum] = "f262089be6a1011d50ec7849e14571b7b2e788334368f3dccb718513f17935ed"
# Additional Policy files for PAM
PAM_SRC_URI = "file://pam.d/chfn \
file://pam.d/chpasswd \