diff --git a/ChangeLog b/ChangeLog index 7095d07880..85820df681 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Thu Dec 2 15:31:14 2010 NAKAMURA Usaku + + * win32/win32.c (rb_w32_read): more fix. [ruby-core:33513] + +Thu Dec 2 13:41:43 2010 NAKAMURA Usaku + + * win32/win32.c (rb_w32_read): workaround for console reading troubles. + fixed [ruby-core:33511] + +Tue Nov 30 12:23:52 2010 NAKAMURA Usaku + + * win32/win32.c (rb_w32_read): read only 1 byte at once on console. + workaround of Windows bug. see [ruby-core:33460]. + this is not the final solution. + Mon Nov 29 22:55:24 2010 Nobuyoshi Nakada * lib/uri/common.rb (URI::WFKV_): get rid of backtrack explosion diff --git a/version.h b/version.h index 047fc88fc6..b717927345 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 112 +#define RUBY_PATCHLEVEL 113 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1 diff --git a/win32/win32.c b/win32/win32.c index 2216f45d54..59310eaf14 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -5056,6 +5056,7 @@ rb_w32_read(int fd, void *buf, size_t size) size_t len; size_t ret; OVERLAPPED ol, *pol = NULL; + BOOL isconsole; int start = 0; if (is_socket(sock)) @@ -5073,16 +5074,18 @@ rb_w32_read(int fd, void *buf, size_t size) MTHREAD_ONLY(EnterCriticalSection(&(_pioinfo(fd)->lock))); if (!size || _osfile(fd) & FEOFLAG) { + _set_osflags(fd, _osfile(fd) & ~FEOFLAG); MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fd)->lock)); return 0; } ret = 0; + isconsole = is_console(_osfhnd(fd)); retry: /* get rid of console reading bug */ - if (is_console(_osfhnd(fd))) { + if (isconsole) { if (start) - len = min(16 * 1024, size); + len = 1; else { len = 0; start = 1; @@ -5178,11 +5181,14 @@ rb_w32_read(int fd, void *buf, size_t size) } ret += read; - if (read == len) { - buf = (char *)buf + len; - if (size > 0) + if (read >= len) { + buf = (char *)buf + read; + if (!(isconsole && len == 1 && *((char *)buf - 1) == '\n') && size > 0) goto retry; } + if (read == 0) + _set_osflags(fd, _osfile(fd) | FEOFLAG); + MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fd)->lock));