1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

reroute musl unistd.h weirdness

Musl is (of course) not glibc.  Its confstr(3) does not understand
_CS_GNU_LIBC_VERSION.  That's fair.  Problem is, its unistd.h has that
constant defined for unknown reason.  We cannot blindly say the libc is
glibc by looking at it.  Instead we have to kick it, then see if it
quacks like a duck.

See https://git.musl-libc.org/cgit/musl/tree/include/unistd.h
This commit is contained in:
卜部昌平 2020-01-23 12:14:19 +09:00
parent 3b9f36d6c6
commit 50925b6409

View file

@ -751,8 +751,14 @@ class TestM17NComb < Test::Unit::TestCase
# glibc 2.16 or later denies salt contained other than [0-9A-Za-z./] #7312
# we use this check to test strict and non-strict behavior separately #11045
strict_crypt = if defined? Etc::CS_GNU_LIBC_VERSION
glibcver = Etc.confstr(Etc::CS_GNU_LIBC_VERSION).scan(/\d+/).map(&:to_i)
(glibcver <=> [2, 16]) >= 0
begin
confstr = Etc.confstr(Etc::CS_GNU_LIBC_VERSION)
rescue Errno::EINVAL
false
else
glibcver = confstr.scan(/\d+/).map(&:to_i)
(glibcver <=> [2, 16]) >= 0
end
end
def test_str_crypt