ruby-changes:52408
From: nagachika <ko1@a...>
Date: Sun, 2 Sep 2018 20:23:11 +0900 (JST)
Subject: [ruby-changes:52408] nagachika:r64617 (ruby_2_5): merge revision(s) 64092: [Backport #14942]
nagachika 2018-09-02 20:23:06 +0900 (Sun, 02 Sep 2018) New Revision: 64617 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64617 Log: merge revision(s) 64092: [Backport #14942] win32.c: limit write size on console * win32/win32.c (constat_parse): split long buffer and limit write size on a console, as well as rb_w32_write. [ruby-dev:50597] [Bug #14942] Modified directories: branches/ruby_2_5/ Modified files: branches/ruby_2_5/version.h branches/ruby_2_5/win32/win32.c Index: ruby_2_5/version.h =================================================================== --- ruby_2_5/version.h (revision 64616) +++ ruby_2_5/version.h (revision 64617) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_5/version.h#L1 #define RUBY_VERSION "2.5.2" #define RUBY_RELEASE_DATE "2018-09-02" -#define RUBY_PATCHLEVEL 88 +#define RUBY_PATCHLEVEL 89 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 9 Index: ruby_2_5/win32/win32.c =================================================================== --- ruby_2_5/win32/win32.c (revision 64616) +++ ruby_2_5/win32/win32.c (revision 64617) @@ -6818,6 +6818,10 @@ constat_apply(HANDLE handle, struct cons https://github.com/ruby/ruby/blob/trunk/ruby_2_5/win32/win32.c#L6818 } } +/* get rid of console writing bug; assume WriteConsole and WriteFile + * on a console share the same limit. */ +static const long MAXSIZE_CONSOLE_WRITING = 31366; + /* License: Ruby's */ static long constat_parse(HANDLE h, struct constat *s, const WCHAR **ptrp, long *lenp) @@ -6872,7 +6876,7 @@ constat_parse(HANDLE h, struct constat * https://github.com/ruby/ruby/blob/trunk/ruby_2_5/win32/win32.c#L6876 } rest = 0; } - else { + else if ((rest = *lenp - len) < MAXSIZE_CONSOLE_WRITING) { continue; } *ptrp = ptr; @@ -7130,8 +7134,7 @@ rb_w32_write(int fd, const void *buf, si https://github.com/ruby/ruby/blob/trunk/ruby_2_5/win32/win32.c#L7134 ret = 0; retry: - /* get rid of console writing bug */ - len = (_osfile(fd) & FDEV) ? min(32 * 1024, size) : size; + len = (_osfile(fd) & FDEV) ? min(MAXSIZE_CONSOLE_WRITING, size) : size; size -= len; retry2: Index: ruby_2_5 =================================================================== --- ruby_2_5 (revision 64616) +++ ruby_2_5 (revision 64617) Property changes on: ruby_2_5 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r64092 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/