diff --git a/src/lua/pwd.lua b/src/lua/pwd.lua index 58c2e94f34f2a345dcc66ee7042c38655794a4b0..b6de1562f880ae7b4273828d45ec706243a29dd1 100644 --- a/src/lua/pwd.lua +++ b/src/lua/pwd.lua @@ -194,6 +194,19 @@ local function getgrall() return grs end +-- Workaround pwd.getpwall() issue on Fedora 29: successful +-- getgrent() call that should normally return NULL and preserve +-- errno, set it to ENOENT due to systemd-nss issue [1] when a +-- password database is traversed first time. +-- +-- [1]: https://github.com/systemd/systemd/issues/9585 +-- +-- It is disabled on FreeBSD due to gh-4428: getpwall() hangs on +-- FreeBSD 12. +if jit.os ~= 'BSD' then + pcall(getpwall) +end + return { getpw = getpw, getgr = getgr,