lua: workaround pwd.getpwall() issue on Fedora 29
This is a workaround for systemd-nss issue: https://github.com/systemd/systemd/issues/9585 The following error is observed on app-tap/pwd.test.lua on Fedora 29 (glibc-2.28-26.fc29, systemd-239-12.git8bca462.fc29) when tarantool is linked with libcurl w/o GSS-API support: | builtin/pwd.lua:169: getpwall failed [errno 2]: No such file or directory Such tarantool build lacks of libselinux.so.1 transitive dependency (tarantool -> libcurl.so.4 -> libgssapi_krb5.so.2 -> libkrb5support.so.0 -> libselinux.so.1) and strace shows the following calls when pwd.getpwall() is invoked first time: | openat(AT_FDCWD, "/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 7A | <...> | access("/etc/selinux/config", F_OK) = -1 ENOENT (No such file or directory) It looks like a part of libselinux initialization code and is invoked during execution of a last ffi.C.getpwent() call that returns `nil` as a result and left errno set to ENOENT. Our pwd module set errno to zero before getpwent() call and expects that it will be preserved if no unrecoverable errors occur. It seems that this expectation is not meet due to the systemd-nss issue linked above. Second and next getpwall() calls will succeed, so the commit adds an extra getpwall() during pwd module load. This workaround is disabled on FreeBSD due to another issue: #4428 ('getpwall() hangs on FreeBSD 12'). See also the previous related commit: efccac69 ('lua: fix error handling in getpwall and getgrall'). Follows up #3766. Part of #4318. (cherry picked from commit f5d8331e)
Please register or sign in to comment