rubinius/rubinius — pull request #2825 by r-stu31 (2013-12-11 15:23:20+00:00)
Title: Fix detection of lchmod() and lchown() in "configure" script

(discussed on IRC (#rubinius on Freenode) with dbussink on 2013-12-08 roughly at 20:00 GMT)

1)
Glibc has only a stub of lchmod() and lchmod() in this implementation always returns failure. When writing the original "configure" code, dbussink tried to avoid the situation, that "configure" finds lchmod() under linux (=glibc, for our purposes). Unfortunately, using XSH4.2 "defines" makes lchmod() invisible also on NetBSD, where lchmod() is present and correct. It is because by using XSH4.2 "defines" the application specifies what symbols it wants the system headers to expose and because there is no lchmod() in XSH4.2, the system headers don't expose it. So under the original "configure" code on NetBSD the test "File.lchmod changes the file mode of the link and not of the file" (spec/ruby/core/file/lchmod_spec.rb) fails, because RBX_HAVE_LCHMOD is since the run of "configure" script set to false.

Removing the wrong (on this place, not in itself) XSH4.2 "defines" and avoiding the detection of lchmod() in "configure" under linux fixes the problem for NetBSD. It does not change the unavailability of File.lchmod under linux or the results of tests there.

2)
Using the XSH4.2 "defines" in test for lchown() in "configure" is wrong, because rbx is itself not built with these "defines". (If it would be built with these defines, then functions, which are not part of the XSH4.2 standard (e.g. lchmod()) will not be available to rbx.)