>So this makes me really wonder how people are building Ruby with mingw and
avoid this problem? Are you using something else beside msys? Would my
patch break things for you then?

 Luis' mingw distro seems to work well
http://github.com/luislavena/rubyinstaller/blob/master/README.txt
http://www.akitaonrails.com/2008/7/26/still-playing-with-ruby-on-windows

At least, when I use it I can build binary gems using it. If that's any
help.
-=r