summaryrefslogtreecommitdiff
path: root/test/ruby
AgeCommit message (Collapse)Author
2012-10-12merge revision(s) 35015:usa
* numeric.c (flodivmod): must through the same pass if HAVE_FMOD or not. this is a bugfix of r35013. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-12Remove wrong tests of r37144naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-11merge revision(s) 33819,33839:naruse
* io.c (ioctl_narg_len): don't use _IOC_SIZE macro on Linux. On Linux some constants for ioctl(2) doesn't include the size of its return value and 16bit value; for example FIONREAD 0x541B. Moreover the manual, ioctl_list(2), says "Note that the size bits are very unreliable: in lots of cases they are wrong, either because of buggy macros using sizeof(sizeof(struct)), or because of legacy values." So we shouldn't use it. * io.c (ioctl_narg_len, linux_iocparm_len): reinstantiate linux specific narg length calculation. * test/ruby/test_io.rb (test_ioctl_linux2): add new test for old and unstructured ioctl. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@37144 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23merge revision(s) 36668: [Backport #6846]naruse
* test/ruby/test_file_exhaustive.rb (TestFileExhaustive#test_stat_special_file): add a test. GetFileAttributesExW fails to get attributes of special files such as pagefile.sys. * win32/win32.c (check_valid_dir): for performance, check the path by FindFirstFileW only if the path contains "...". * win32/win32.c (winnt_stat): use GetFileAttributesExW instead of FindFirstFileW since GetFileAttributesExW is faster. Based on the patch by Dusan D. Majkic. [ruby-core:47083] [Feature #6845] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-20merge revision(s) 33991:naruse
* file.c (file_path_convert): don't convert it when the path string is ascii only. [ruby-core:41556] [Bug #5733] tests are contributed by nobu. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-09merge revision(s) 34972:naruse
* pack.c (pack_unpack): when unpack('M') occurs an illegal byte sequence, output the "=" character and the following character in the decoded data without any transformation. [ruby-dev:44875] [Bug #5635] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-03Revert r36279; it breaks C API compatibility.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-03merge revision(s) 34372:naruse
* file.c (rb_enc_path_next, rb_enc_path_skip_prefix) (rb_enc_path_last_separator, rb_enc_path_end) (ruby_enc_find_basename, ruby_enc_find_extname): encoding-aware path handling functions. * file.c (rb_home_dir, file_expand_path, rb_realpath_internal) (rb_file_s_basename, rb_file_dirname, rb_file_s_extname) (rb_file_join): should respect the encodings of arguments than file system encoding. [ruby-dev:45145] [Bug #5919] * dir.c (check_dirname, ruby_glob0): ditto. * ext/pathname/pathname.c (path_sub_ext): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-26merge revision(s) 34633: [Backport #5124]naruse
* insns.def (splatarray): make new array if flag is set. * compile.c (iseq_compile_each): make new array with splat. [ruby-core:21901][Feature #1125] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-26merge revision(s) 35081: [Backport #6605]naruse
* bignum.c (rb_big_pow): estimate result bit size more precisely. [ruby-core:30735][Feature #3429] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@36226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-28merge revision(s) 34753:naruse
* io.c (rb_io_extract_modeenc): fail only if conflicting text/binary modes given explicitly. [ruby-dev:45268][Bug #6055] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-25merge revision(s) 34910:naruse
assert_valid_syntax * test/ruby/test_syntax.rb (assert_valid_syntax): new assertion to validate syntax. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-25merge revision(s) 35644:naruse
* parse.y (f_arglist): should reset lexical states after empty argument list with no parenthesis as well as parenthesized list, so that reserved name method definition work. [ruby-dev:45626] [Bug #6403] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-25merge revision(s) 35766:naruse
* io.c (io_strip_bom): check EOF. [Bug #6487][ruby-core:45203] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-25merge revision(s) 35644:naruse
* parse.y (f_arglist): should reset lexical states after empty argument list with no parenthesis as well as parenthesized list, so that reserved name method definition work. [ruby-dev:45626] [Bug #6403] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-17merge revision(s) 35109,35110,35651: [Backport #6385]nobu
* win32/win32.c (rb_w32_fstat, rb_w32_fstati64): convert FILETIME to time_t directly, not to be affected by TZ unnecessarily. * win32/win32.c (unixtime_to_filetime): convert time_t to FILETIME simply. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-14merge revision(s) 35636,35637: [Backport #6429]naruse
* test/ruby/test_io.rb (TestIO): revert r35631. it broke the intent of test_flush_in_finalizer1. [ruby-core:43951] [Bug ##6228] * test/ruby/test_io.rb (test_flush_in_finalizer1): don't use IO.for_fd to close IO objects. it create IO object with already closed fd, and cause occasional Errno::EBADF in following tests. [ruby-core:45020] [Bug #6228] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35646 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-14merge revision(s) 34796:naruse
* parse.y (parser_tokadd_string): insert a backslash only if quoted by single quotes. [ruby-dev:45281] [Bug #6069] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-14merge revision(s) 35631:naruse
* test/ruby/test_io.rb (class TestIO): Disable GC during IO tests to avoid file descriptors being GC'ed. Suggestion by Tomoyuki Chikanaga [ruby-core:43951][Bug #6228] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-10merge revision(s) 35594: [Backport #6422]naruse
* io.c (io_unread): fix IO#pos with mode 'r' bug on Windows. If the end of reading buffer is CR, io_unread() needs to unread one more byte. [ruby-core:44874] [Bug #6401] * test/ruby/test_io_m17n.rb (TestIO_M17N#test_pos_with_buffer_end_cr): add a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35613 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-20merge revision(s) 35366,35377,35399,35406:nobu
* strftime.c (rb_strftime_with_timespec): fix padding of time zone offset. [ruby-dev:43287][Bug #4458] * strftime.c (rb_strftime_with_timespec): add an interim digit for the timezone offset which is less than an hour. * strftime.c (rb_strftime_with_timespec): fix carry-up bug and overwrite '+' with '-' if negative offset less than a hour. [ruby-core:44447][Bug #6323] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-15merge revision(s) 32799:naruse
* test/ruby/test_process.rb (TestProcess#windows?): new method. * test/ruby/test_process.rb (TestProcess#*): use above method. * test/ruby/test_process.rb (TestProcess#test_execopts_redirect): windows doesn't support FD_CLOEXEC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14merge revision(s) 35249,35250: [Backport #6296]naruse
* include/ruby/win32.h (rb_w32_aspawn_flags): add the declaration of new function. * process.c (enum): add EXEC_OPTION_PGROUP and move the position above for the usage in proc_spawn_n(). * process.c (proc_spawn_n): add an argument to pass new option `new_pgroup`. The option specifies CREATE_NEW_PROCESS_GROUP flag to CreateProcessW(). This flag is necessary for the usage of Process.kill on the subprocess on Windows. * process.c (rb_exec_arg_addopt): ditto. * process.c (rb_spawn_process): ditto. * process.c (documentation for rb_f_spawn): add documentation for new option `new_pgroup` of spawn. * test/ruby/test_process.rb (TestProcess#test_execopts_new_pgroup): add tests for option `new_pgroup`. * test/ruby/test_thread.rb (TestThreadGroup#test_thread_timer_and_interrupt): add option `new_pgroup: true` to spawn on Windows. It's needed for Process.kill on a subprocess. * win32/win32.c (CreateChild): add an argument to pass dwCreationFlags of CreateProcessW(). * win32/win32.c (rb_w32_spawn): ditto. * win32/win32.c (rb_w32_aspawn_flags): add new function to pass dwCreationFlags. * win32/win32.c (rb_w32_aspawn): refactor to move the content to rb_w32_aspawn_flags(). [ruby-core:43245][Bug #6131] * test/ruby/test_thread.rb (TestThreadGroup#test_thread_timer_and_interrupt): skip on Windows. Process.kill cannot kill a subprocess if CREATE_NEW_PROCESS_GROUP flag is not specified in a call to CreateProcessW(). * win32/win32.c (CreateChild): revert the usage of CREATE_NEW_PROCESS_GROUP flag for compatibility. [ruby-core:43245][Bug #6131] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14merge revision(s) 35296: [Backport #6295]naruse
* io.c (rb_io_eof): use eof() instead of io_fillbuf(). It's because io_unread() doesn't work properly when reading CRLF with read(length) and mode 'r'. [ruby-core:44189][Bug #6271] * test/ruby/test_io_m17n.rb (TestIO_M17N#test_read_crlf_and_eof): test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14merge revision(s) 34785,35095,35098,35111,35152: [Backport #6294]naruse
* io.c (set_binary_mode_with_seek_cur): reorder function qualifiers. * test/ruby/test_io.rb (TestIO#test_pos_with_getc): added. see [Bug #6179][ruby-core:43518] * test/ruby/test_io.rb (TestIO#test_pos_with_getc): updated. see [ruby-core:43550] * io.c (static int io_fflush): add the definition. Use it in set_binary_mode_with_seek_cur(). * io.c (set_binary_mode_with_seek_cur): refactoring to split the content into io_unread(). Fix the possibility of buffer overflow. * io.c (io_unread): add new implementation for Windows. Previous one caused invalid cursor position using IO#pos with OS text mode. New one fixes the bug. * test/ruby/test_io_m17n.rb (TestIO_M17N#test_pos_dont_move_cursor_position): add a test for above bug. [ruby-core:43497] [Bug #6179] * io.c (io_unread): fixed memory leak. report by nagachika via IRC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-04merge revision(s) 34897,34904,34906,34931:naruse
Old linux (at least CentOS 5.6, kernel 2.6.18) wakes up 4.99 sec. * test/ruby/test_sleep.rb (TestSleep#test_sleep_5sec): syntax error. * test/ruby/test_sleep.rb (TestSleep#test_sleep_5sec): call uname only on linux because it's a workaround for linux only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-30merge revision(s) 35146:naruse
* string.c (str_new_empty): should copy also the encoding as an empty substring. [ruby-dev:45441][Bug #6206] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-30merge revision(s) 35013:naruse
* numeric.c: fix flodivmod for cornercases [Bug #6044] add ruby_float_mod * insns.def (opt_mod): use ruby_float_mod * internal.h: declare ruby_float_mod * test/ruby/test_float.rb: tests for above * test/ruby/envutil.rb: create helper assert_is_minus_zero git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-18merge revision(s) 34433: [Backport #6153]naruse
* encoding.c (rb_enc_compatible): return ASCII-8BIT even if 2nd string is ascii only string. [ruby-core:42354] [Bug #5968] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@35078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-01merge revision(s) r33525: [Backport #6104]naruse
* file.c (rb_file_join): honor input encodings than ASCII-8BIT. [ruby-core:40338] [Bug #5483] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-26merge revision(s) 34821:naruse
* regparse.c (add_code_range_to_buf0): wrong condition of duplicated warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34822 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-26merge revision(s) 34819:nobu
* compile.c (iseq_compile_each): call on special object instead of self. since stabby lambda is a syntax, so it should not be affected by the context. [ruby-core:42349][Bug #5966] * insns.def (send): no special deal for FCALL. self should be put on TOS instead. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-25merge revision(s) 34786,34787,34788,34789:naruse
* dir.c, file.c, io.c: use rb_sys_fail_path. * error.c: new functions to deal exceptions with string instances. * dir.c, file.c, io.c (rb_sys_fail_path): use rb_sys_fail_str. * test/ruby/test_literal.rb (TestRubyLiteral#test_special_const): test for https://bugs.php.net/bug.php?id=61095 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-25merge revision(s) 34794,34795:naruse
* dir.c (dir_initialize): keep path in original encoding. * error.c (syserr_initialize): prefer the encoding of message over locale. [ruby-dev:45279][Bug #6071] * dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path. [Bug #6072] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-25merge revision(s) 34795:naruse
* dir.c (dir_inspect), io.c (rb_io_inspect): keep encoding of path. [Bug #6072] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-25merge revision(s) 34803:naruse
* complex.c (nucomp_marshal_load): raise error on invalid data. reported by John Firebaugh [ruby-core:42860] [Bug #6076] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-23merge revision(s) 34776:nobu
* parse.y (parser_tokadd_string, parser_yylex): insert a backslash if the next character is non-ascii. [ruby-dev:45278] [Bug #6069] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-22merge revision(s) 33873:nobu
* win32/win32.c (rb_w32_uchmod): typo. [Bug#5671] [ruby-dev:44898] * test/ruby/test_file.rb (TestFile#test_chmod_m17n): test of above bug. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-22merge revision(s) 34735,34736:nobu
* io.c (rb_io_s_foreach): return enumerator including kerword arguments. [ruby-dev:45267][Bug #6054] * io.c (rb_io_s_foreach): argument check before making Enumerator. [ruby-dev:31525] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-16merge revision(s) 32731,32734,32738:naruse
------------------------------------------------------------------------ r32731 | naruse | 2011-07-29 16:17:35 +0900 (Fri, 29 Jul 2011) | 3 lines Use setrlimit(NOFILE,1) on OpenBSD. Because on OpenBSD it freezes if limit=0. ------------------------------------------------------------------------ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-15merge revision(s) 34629,34630:naruse
* cont.c (rb_fiber_reset_root_local_storage): add a new function to restore rb_thread_t::local_storage. * cont.c (rb_obj_is_fiber): add a new function to tell finalizer to prevent fibers from destroy. * gc.c (rb_objspace_call_finalizer): don't sweep fibers at finalizing objspace. * internal.h (rb_fiber_reset_root_local_storage, rb_obj_is_fiber): add prototypes. * vm.c (ruby_vm_destruct): reset main thread's local_storage before free main thread. rb_thread_t::local_storage is replaced by fiber's local storage when forked from fiber, and it should be already freed when the fiber was destroyed. * test/ruby/test_fiber.rb (test_fork_from_fiber): add test for fork from fiber. when the fiber was destroyed. [ruby-core:41456] [Bug #5700] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-15merge revision(s) r34564:nobu
* vm_eval.c (check_funcall): Call respond_to? with matching arity for legacy single-argument implementations. [ruby-trunk - Bug #6000] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-15merge revision(s) r32855,r32857,r33493,r34554:nobu
* vm_eval.c (check_funcall): try respond_to? first if redefined. [Bug #5158] * test/ruby/test_object.rb: tests that respond_to? returns false. * vm_eval.c (check_funcall): set array elements one-by-one to fix compile error with Fujitsu C Compiler 5.6 on Solaris 10 on Sparc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-14merge revision(s) 34555: [Backport #5786]naruse
* compile.c (defined_expr): guard the whole expression. [ruby-dev:45021][Bug#5786] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-13merge revision(s) 33935,33936,33987: [Backport #5702]naruse
* variable.c (set_const_visibility): Module#private_constant has changed the visibility of only the first argument. Now it changes all of them. [ruby-list:48558] * test/ruby/test_module.rb: add a test for above. * variable.c (set_const_visibility): print a warning when no argument is passwd to Module#private_constant. [ruby-list:48558] * vm_method.c (set_method_visibility): ditto for Module#private_class_method. * variable.c (set_const_visibility): clear inine-cache when constant's visibility is modified. [ruby-dev:44929] * test/ruby/test_module.rb (test_private_constants_clear_inlinecache): add test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-12merge revision(s) 32527,32567: [Backport #6004]naruse
* vm_method.c (rb_add_method): should not call method_added hook for undef operation. [Bug #5015] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-10Revert r34538.naruse
* backport 33935,33936,33987 (fix private constant) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-10merge revision(s) 34043,34045,34132: [Backport #5791]naruse
* win32/win32.c, include/ruby/win32.h (rb_w32_fd_is_text): new function. * win32/win32.c (init_stdhandle): set default mode of stdin as binmode. * io.c (set_binary_mode_with_seek_cur): new function to replace SET_BINARY_MODE_WITH_SEEK_CUR macro. now returns previous mode of the fd and take care of LF in rbuf. * io.c (do_writeconv): set text mode when needed. * io.c (io_read): need to change the mode of the IO to binmode temporally when the length for IO#read, because IO#read with length must behave so. * test/ruby/test_io_m17n.rb (TestIO_M17N#est_{read_with_length, read_with_length_binmode,get[cs]_and_read_with_binmode, read_with_binmode_and_get[cs],read_write_with_binmode}): tests for above changes. all patches are written by Hiroshi Shirosaki. [ruby-core:41496] [Feature #5714] * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{read_with_binmode_and_get[cs]}): only for Windows. * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{read_with_length, * io.c (rb_sys_fail_path): move the definition. Move above for using it in set_binary_mode_with_seek_cur(). * io.c (set_binary_mode_with_seek_cur): fix improper seek cursor. Seeking file cursor with setting binary mode has possibility to cause infinite loop. Fixed the bug and refined error handling. Introduced at r34043. And cleanups as below. Remove unnecessary parentheses of `fptr`. Use return value of setmode(). * test/ruby/test_io_m17n.rb (TestIO_M17N#test_seek_with_setting_binmode): add a test for abobe. [ruby-core:41671] [Bug #5714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-10merge revision(s) 33937: [Backport #5704]naruse
* ext/zlib/zlib.c (rb_gzreader_initialize): use binary mode by default under Windows. Patch by Hiroshi Shirosaki. [ruby-core:40706] [Feature #5562] * include/ruby/encoding.h (void rb_econv_binmode): define NEWLINE decorator. * io.c (rb_cloexec_fcntl_dupfd): Introduce NEED_READCONV and NEED_WRITECONV to replace universal newline decorator by CRLF only when required to improve file reading and writing under Windows. Patch by Hiroshi Shirosaki. [ruby-core:40706] [Feature #5562] * io.c (do_writeconv): adjust binary mode if required. * io.c (read_all, appendline, swallow, rb_io_getline_1): ditto. * io.c (io_getc, rb_io_each_codepoint, rb_io_ungetc): ditto. * io.c (rb_io_binmode, rb_io_ascii8bit_binmode): ditto. * io.c (rb_io_extract_modeenc, rb_sysopen): ditto. * io.c (pipe_open, prep_stdio, io_encoding_set): ditto. * io.c (rb_io_s_pipe, copy_stream_body): ditto. * test/ruby/test_io_m17n.rb (EOT): add test for pipe and stdin in binary mode. * win32/win32.c (init_stdhandle): remove O_BINARY from stdhandle initialization. * win32/win32.c (rb_w32_write): use FTEXT mode accordingly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-10merge revision(s) 33662,33666,33770: [Backport #5793]naruse
------------------------------------------------------------------------ r33662 | usa | 2011-11-08 02:48:11 +0900 (Tue, 08 Nov 2011) | 18 lines * include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_READ_MASK, ECONV_NEWLINE_DECORATOR_WRITE_MASK): new macro. * io.c (rb_io_extract_modeenc, pipe_open, prep_stdio, argf_next_argv): set TEXTMODE_NEWLINE_DECORATOR_ON_WRITE for textmode on creating IO if the flag is available. * io.c (make_writeconv): drop decorators for reading. * io.c (make_readconv): drop decorators for writing. * io.c (do_writeconv): existing writeconv is not the condition to raise ArgumentError. should check textmode or not. * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{cr,lf,crlf}_decorator_on_stdout): test above changes. ------------------------------------------------------------------------ * include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_READ_MASK, ECONV_NEWLINE_DECORATOR_WRITE_MASK): new macro. * io.c (rb_io_extract_modeenc, pipe_open, prep_stdio, argf_next_argv): set TEXTMODE_NEWLINE_DECORATOR_ON_WRITE for textmode on creating IO if the flag is available. * io.c (make_writeconv): drop decorators for reading. * io.c (make_readconv): drop decorators for writing. * io.c (do_writeconv): existing writeconv is not the condition to raise ArgumentError. should check textmode or not. * test/ruby/test_io_m17n.rb (TestIO_M17N#test_{cr,lf,crlf}_decorator_on_stdout): test above changes. * io.c (argf_next_argv): wrong timing of setting ecflags. fixed the failure of TestArgf#test_textmode introduced at r33662. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34542 b2dd03c8-39d4-4d8f-98ff-823fe69b080e