Bug #16265
closedTest (spec) failure using current MSYS2 tools, related to -fstack-protector and possibly D_FORTIFY_SOURCE=2
Description
GH PR https://github.com/ruby/ruby/pull/2573 was a work-around that forced using some non-current MSYS2 packages libraries for building. These libraries are only available on Appveyor because their images are out-of-date, a new MSYS2 install would not have them.
Using current MSYS2 libraries requires adding '-fstack-protector' to LDFLAGS. I also experimented with adding 'D_FORTIFY_SOURCE=2' to CFLAGS.
Ruby build/compiles with those flags added. test-all passes. But spec tests always lock up when running:
C-API Thread function rb_thread_call_without_gvl
- runs a C function with the global lock unlocked
- runs a C function with the global lock unlocked amd unlocks IO with the generic RUBY_UBF_IO
The tests are in spec/ruby/optional/capi/thread_spec.rb, as shown:
and the freeze occurs on line 137.
I've run this once in ruby-loco, twice in my ruby fork, and several times locally. In all runs, test-all passed, and spec stopped at the test above. This uses gcc 9.2.0, and the problem would occur with anyone doing a 'fresh' install of MSYS2.
Not being a c type, this is way beyond what I can fix. Happy to try patches, etc. Thanks, Greg