Ruby Issue Tracking System: Issueshttps://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-03-02T01:51:40ZRuby Issue Tracking System
Redmine Backport200 - Backport #7996 (Closed): Non-existent code page on certain windows XP versionshttps://bugs.ruby-lang.org/issues/79962013-03-02T01:51:40Zmmeltner (Michael Meltner)mmeltner@trashmail.de
<p>Hello,</p>
<p>I try to run ruby 2.0.0p0 on a machine having Windows XP embedded. This causes a core dump. I tracked to problem to "win32/file.c", convert_mb_to_wchar.</p>
<p>Here the conversion is done from ascii 7 bit to wchar using MultiByteToWideChar. This function returns 0 (instead of the length) as this Windows XP embedded has no coding support for code page 20217(us ascii). So MultiByteToWideChar returns an error indicating failure.</p>
<p>I changed the default coding page to 1252 as this is supported on all windows versions and this coding page should be identical with ascii 7 bit for the range 0x20-0x7f (or am I wrong here?)</p>
<p>So I made this patch which works fine:</p>
<p>diff -rupN ruby-2.0.0-p0/win32/file.c ruby-2.0.0-p0.new/win32/file.c<br>
--- ruby-2.0.0-p0/win32/file.c 2012-11-17 18:53:21 +0100<br>
+++ ruby-2.0.0-p0.new/win32/file.c 2013-02-28 11:43:29 +0100<br>
@@ -212,9 +212,10 @@ code_page(rb_encoding *enc)<br>
names_ary = rb_funcall(encoding, names, 0);<br>
}</p>
<ul>
<li>/* map US-ASCII and ASCII-8bit as code page 20127 (us-ascii) */</li>
</ul>
<ul>
<li>/* map US-ASCII and ASCII-8bit as code page 1252 (us-ascii) */</li>
<li>/* code page 20127 (us-ascii) is not available on older WinXP systems*/<br>
if (enc == rb_usascii_encoding() || enc == rb_ascii8bit_encoding()) {</li>
</ul>
<ul>
<li>UINT code_page = 20127;</li>
</ul>
<ul>
<li>UINT code_page = 1252;<br>
rb_hash_aset(rb_code_page, name_key, INT2FIX(code_page));<br>
return code_page;<br>
}</li>
</ul>
<ul>
<li>Michael</li>
</ul> Ruby master - Bug #7995 (Closed): RubyVM::InstructionSequence to_a not working for blockshttps://bugs.ruby-lang.org/issues/79952013-03-02T01:44:07Zmmeltner (Michael Meltner)mmeltner@trashmail.de
<p>Hello,</p>
<a name="I-try-to-convert-this-code-into-an-array-via-RubyVMInstructionSequence"></a>
<h2 >I try to convert this code into an array via RubyVM::InstructionSequence:<a href="#I-try-to-convert-this-code-into-an-array-via-RubyVMInstructionSequence" class="wiki-anchor">¶</a></h2>
<h2>def test<br>
yield<br>
end<br>
test do<br>
puts "hi there"<br>
end</h2>
<p>then read it back via "iseq_s_load".</p>
<p>This causes an error that there is no block defined:<br>
:in <code>test': no block given (yield) (LocalJumpError) from <compiled>:in </code>'</p>
<p>I assume there is a bug in iseq.c, line 1778:<br>
rb_hash_aset(e, ID2SYM(rb_intern("blockptr")), ci->blockiseq ? seq_data_to_ary(ci->blockiseq) : Qnil);</p>
<p>as the corresponding line in compile.c is this:<br>
VALUE vblock = rb_hash_aref(op, ID2SYM(rb_intern("block")));</p>
<p>so is the symbol name mixed up between "block" and "blockptr" ?</p>
<ul>
<li>Michael</li>
</ul>