Project

General

Profile

Actions

Bug #5714

closed

Unexpected error of STDIN#read with non-ascii input on Windows XP

Added by phasis68 (Heesob Park) over 12 years ago. Updated over 12 years ago.

Status:
Closed
Target version:
-
ruby -v:
-
Backport:
[ruby-core:41496]

Description

When the input contains non-ascii character, STDIN#read raised Permission denied or Invalid argument error with MSVC compiled version on Windows XP.

C:\work>ruby -ve 'p STDIN.read(5)'
ruby 2.0.0dev (2011-12-05 trunk 33955) [i386-mswin32_100]
한글abcd
-e:1:in `read': Permission denied - <STDIN> (Errno::EACCES)
	from -e:1:in `<main>'

C:\>irb
irb(main):001:0> STDIN.read(5)
한글abcd
Errno::EINVAL: Invalid argument - <STDIN>
	from (irb):1:in `read'
	from (irb):1
	from c:/usr/bin/irb.bat:19:in `<main>'

If the input is ascii only, STDIN.read works fine.

C:\work>ruby -ve 'p STDIN.read(5)'
ruby 2.0.0dev (2011-12-05 trunk 33955) [i386-mswin32_100]
abcdefg
"abcde"

C:\>irb
irb(main):001:0> STDIN.read(5)
abcdefg
=> "abcde"

It is odd but the Mingw compiled version works fine.

C:\work>ruby -ve 'p STDIN.read(5)'
ruby 2.0.0dev (2011-12-05 trunk 33955) [i386-mingw32]
한글abcde
"\xC7\xD1\xB1\xDBabc"

And Ruby 1.9.3p0 works fine.

C:\>ruby -ve 'p STDIN.read(5)'
ruby 1.9.3p0 (2011-10-30 revision 33570) [i386-mswin32_100]
한글abcd
"\xC7\xD1\xB1\xDBabc"

Files

read_binmode.patch (861 Bytes) read_binmode.patch h.shirosaki (Hiroshi Shirosaki), 12/08/2011 02:54 PM
read_binmode2.patch (933 Bytes) read_binmode2.patch h.shirosaki (Hiroshi Shirosaki), 12/10/2011 03:10 PM
read_binmode_fix_r34024.patch (5.89 KB) read_binmode_fix_r34024.patch h.shirosaki (Hiroshi Shirosaki), 12/13/2011 04:44 PM
read_binmode_fix_r34035.patch (7.7 KB) read_binmode_fix_r34035.patch h.shirosaki (Hiroshi Shirosaki), 12/14/2011 05:04 PM
set_binmode_fix.patch (2.61 KB) set_binmode_fix.patch h.shirosaki (Hiroshi Shirosaki), 12/15/2011 02:58 PM
set_binmode_fix_r34120.patch (3.46 KB) set_binmode_fix_r34120.patch h.shirosaki (Hiroshi Shirosaki), 12/25/2011 11:17 PM

Related issues 1 (0 open1 closed)

Related to Backport193 - Backport #5791: Please backport r34043, r34045 (Unexpected error of STDIN#read with non-ascii input)Closedluislavena (Luis Lavena)12/23/2011Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0