mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* thread.c: disabled _FORTIFY_SOURCE for avoid to hit glibc bug.
[Bug #8080] [ruby-core:53349] * test/ruby/test_io.rb (TestIO#test_io_select_with_many_files): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c824d47ebc
commit
92b367e069
3 changed files with 46 additions and 1 deletions
|
@ -1,3 +1,10 @@
|
|||
Fri Mar 15 14:57:16 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* thread.c: disabled _FORTIFY_SOURCE for avoid to hit glibc bug.
|
||||
[Bug #8080] [ruby-core:53349]
|
||||
* test/ruby/test_io.rb (TestIO#test_io_select_with_many_files):
|
||||
test for the above.
|
||||
|
||||
Wed Mar 13 15:16:35 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* include/ruby/missing.h (__syscall): moved to...
|
||||
|
|
|
@ -2629,5 +2629,30 @@ End
|
|||
s.puts(c.new)
|
||||
assert_equal("[...]\n", s.string, bug5986)
|
||||
end
|
||||
end
|
||||
|
||||
def test_io_select_with_many_files
|
||||
bug8080 = '[ruby-core:53349]'
|
||||
|
||||
assert_normal_exit %q{
|
||||
require "tempfile"
|
||||
|
||||
# try to raise RLIM_NOFILE to >FD_SETSIZE
|
||||
# Unfortunately, ruby export FD_SETSIZE. then we assume it's 1024.
|
||||
fd_setsize = 1024
|
||||
|
||||
begin
|
||||
Process.setrlimit(Process::RLIMIT_NOFILE, fd_setsize+10)
|
||||
rescue =>e
|
||||
# Process::RLIMIT_NOFILE couldn't be raised. skip the test
|
||||
exit 0
|
||||
end
|
||||
|
||||
tempfiles = []
|
||||
(0..fd_setsize+1).map {|i|
|
||||
tempfiles << Tempfile.open("test_io_select_with_many_files")
|
||||
}
|
||||
|
||||
IO.select(tempfiles)
|
||||
}, bug8080
|
||||
end
|
||||
end
|
||||
|
|
13
thread.c
13
thread.c
|
@ -42,6 +42,19 @@
|
|||
*/
|
||||
|
||||
|
||||
/*
|
||||
* FD_SET, FD_CLR and FD_ISSET have a small sanity check when using glibc
|
||||
* 2.15 or later and set _FORTIFY_SOURCE > 0.
|
||||
* However, the implementation is wrong. Even though Linux's select(2)
|
||||
* support large fd size (>FD_SETSIZE), it wrongly assume fd is always
|
||||
* less than FD_SETSIZE (i.e. 1024). And then when enabling HAVE_RB_FD_INIT,
|
||||
* it doesn't work correctly and makes program abort. Therefore we need to
|
||||
* disable FORTY_SOURCE until glibc fixes it.
|
||||
*/
|
||||
#undef _FORTIFY_SOURCE
|
||||
#undef __USE_FORTIFY_LEVEL
|
||||
#define __USE_FORTIFY_LEVEL 0
|
||||
|
||||
/* for model 2 */
|
||||
|
||||
#include "eval_intern.h"
|
||||
|
|
Loading…
Add table
Reference in a new issue