Issue #6228 has been updated by jonforums (Jon Forums).


In my configuration, one fix is to remove the recent -DFD_SETSEZE=32767 define from the RubyInstaller build recipe. Removing the define gives the following results on r35179:

* no deps build using WinSDK 7.1 (without RubyInstaller) has _no_ `test_lines(TestIO)` _nor_ `test_invalid_advise(TestIO)` Errno::EBADF failures
* no deps build using MinGW GCC 4.6.2 (with or without RubyInstaller) has _no_ `test_lines` _nor_ `test_invalid_advise` failures
* full deps build using MinGW GCC 4.6.2 (with RubyInstaller recipe) has _no_ `test_lines` _nor_ `test_invalid_advise` failures

However, removing the define is not acceptable as it was added to fix the following user issue

  https://github.com/oneclick/rubyinstaller/issues/104

And it get's more convoluted.

Running `git bisect` between commits a81c766/r34649 (good) and 7e2e3dc/r34806 (bad) with -DFD_SETSEZE=32767 enabled in the RubyInstaller recipes, the "first bad commit" is Nobu's 35bf809/r34749 tweak to Enumerator in io.c. Building the "good" fa1a2ae/r34746 parent commit (without deps) resulted in _no_ `test_invalid_advise` failure when running `make test-all TESTS='ruby/test_io.rb'`. But strangely, `test_lines` failed while `test_invalid_advise` passed when running my original `make test-all TESTS='openssl ... ruby/test_io.rb ...'`

I suspect there are other lurking issues left to discover, so don't close this issue as a 3rd party issue until we know more.
----------------------------------------
Bug #6228: [mingw] Errno::EBADF in ruby/test_io.rb on ruby_1_9_3
https://bugs.ruby-lang.org/issues/6228#change-25536

Author: jonforums (Jon Forums)
Status: Open
Priority: Normal
Assignee: 
Category: test
Target version: 1.9.3
ruby -v: ruby 1.9.3p172 (2012-03-30 revision 35179) [i386-mingw32]


On Win7 32bit built with MinGW 4.6.2 using the RubyInstaller build recipes, I get the following test error:


sh-3.1$ ruby --version
ruby 1.9.3p172 (2012-03-30 revision 35179) [i386-mingw32]

sh-3.1$ make test-all TESTS='openssl fiddle psych zlib io json mkmf pathname stringio erb 
fileutils ruby/test_io.rb ruby/test_io_m17n.rb ruby/test_file.rb'

  7) Error:
test_lines(TestIO):
Errno::EBADF: Bad file descriptor
    c:/Users/Jon/Documents/RubyDev/ruby-git/test/ruby/test_io.rb:33:in `close'
    c:/Users/Jon/Documents/RubyDev/ruby-git/test/ruby/test_io.rb:33:in `rescue in block in pipe'
    c:/Users/Jon/Documents/RubyDev/ruby-git/test/ruby/test_io.rb:30:in `block in pipe'


-- 
http://bugs.ruby-lang.org/