gets crashes Ruby 2.1.3

224 views
Skip to first unread message

Steffen Roller

unread,
Sep 29, 2014, 5:40:33 PM9/29/14
to rubyin...@googlegroups.com
with 2.1.3 a script that uses gets crashes.

script1 is ok, script2 crashes after the first key is pushed, before I hit the return key.

my version ruby 2.1.3p242 (2014-09-19 revision 47630) [i386-mingw32]
running on Windows 7 x64

Any idea?

----------------------------
# script1.rb

key = gets
print key
---------------------------

----------------------------
# script2.rb

print "> "
key = gets
print key
---------------------------

additional information:

> C:/src/Ruby/playground/2.1.0-error/gets2.rb:2: [BUG] Segmentation fault
ruby 2.1.3p242 (2014-09-19 revision 47630) [i386-mingw32]

-- Control frame information -----------------------------------------------
c:0004 p:---- s:0010 e:000009 CFUNC  :gets
c:0003 p:---- s:0008 e:000007 CFUNC  :gets
c:0002 p:0013 s:0005 E:001e30 EVAL   C:/src/Ruby/playground/2.1.0-error/gets2.rb:2 [FINISH]
c:0001 p:0000 s:0002 E:0023c4 TOP    [FINISH]

C:/src/Ruby/playground/2.1.0-error/gets2.rb:2:in `<main>'
C:/src/Ruby/playground/2.1.0-error/gets2.rb:2:in `gets'
C:/src/Ruby/playground/2.1.0-error/gets2.rb:2:in `gets'

-- C level backtrace information -------------------------------------------
C:\Windows\SysWOW64\ntdll.dll(ZwWaitForSingleObject+0x15) [0x7763F8D1]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObjectEx+0x43) [0x77001194]
C:\Windows\syswow64\kernel32.dll(WaitForSingleObject+0x12) [0x77001148]
C:\RUBY\BIN\msvcrt-ruby210.dll(rb_vm_bugreport+0xa7) [0x6D3947A7]
C:\RUBY\BIN\msvcrt-ruby210.dll(rb_name_err_mesg_new+0x69f) [0x6D248FBF]
C:\RUBY\BIN\msvcrt-ruby210.dll(rb_bug+0x2e) [0x6D249D9E]
C:\RUBY\BIN\msvcrt-ruby210.dll(rb_check_safe_str+0x34b) [0x6D31483B]
 [0x00401866]
C:\Windows\SysWOW64\ntdll.dll(RtlKnownExceptionFilter+0xb7) [0x776974FF]

-- Other runtime information -----------------------------------------------

* Loaded script: C:/src/Ruby/playground/2.1.0-error/gets2.rb

* Loaded features:

    0 enumerator.so
    1 C:/RUBY/lib/ruby/2.1.0/i386-mingw32/enc/encdb.so
    2 C:/RUBY/lib/ruby/2.1.0/i386-mingw32/enc/iso_8859_1.so
    3 C:/RUBY/lib/ruby/2.1.0/i386-mingw32/enc/trans/transdb.so
    4 C:/RUBY/lib/ruby/2.1.0/i386-mingw32/rbconfig.rb
    5 C:/RUBY/lib/ruby/2.1.0/rubygems/compatibility.rb
    6 C:/RUBY/lib/ruby/2.1.0/rubygems/defaults.rb
    7 C:/RUBY/lib/ruby/2.1.0/rubygems/deprecate.rb
    8 C:/RUBY/lib/ruby/2.1.0/rubygems/errors.rb
    9 C:/RUBY/lib/ruby/2.1.0/rubygems/version.rb
   10 C:/RUBY/lib/ruby/2.1.0/rubygems/requirement.rb
   11 C:/RUBY/lib/ruby/2.1.0/rubygems/platform.rb
   12 C:/RUBY/lib/ruby/2.1.0/rubygems/basic_specification.rb
   13 C:/RUBY/lib/ruby/2.1.0/rubygems/stub_specification.rb
   14 C:/RUBY/lib/ruby/2.1.0/rubygems/util/stringio.rb
   15 C:/RUBY/lib/ruby/2.1.0/rubygems/specification.rb
   16 C:/RUBY/lib/ruby/2.1.0/rubygems/exceptions.rb
   17 C:/RUBY/lib/ruby/2.1.0/rubygems/defaults/operating_system.rb
   18 C:/RUBY/lib/ruby/2.1.0/rubygems/core_ext/kernel_gem.rb
   19 thread.rb
   20 C:/RUBY/lib/ruby/2.1.0/i386-mingw32/thread.so
   21 C:/RUBY/lib/ruby/2.1.0/monitor.rb
   22 C:/RUBY/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb
   23 C:/RUBY/lib/ruby/2.1.0/rubygems.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.


This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

Luis Lavena

unread,
Sep 29, 2014, 5:44:26 PM9/29/14
to rubyin...@googlegroups.com
Hello,

On Mon, Sep 29, 2014 at 6:40 PM, Steffen Roller <steffen...@gmail.com> wrote:
with 2.1.3 a script that uses gets crashes.

script1 is ok, script2 crashes after the first key is pushed, before I hit the return key.


I couldn't reproduce:

C:\Users\Luis\Desktop>ruby -v script1.rb
ruby 2.1.3p242 (2014-09-19 revision 47630) [i386-mingw32]
foo
foo

C:\Users\Luis\Desktop>ruby -v script2.rb
ruby 2.1.3p242 (2014-09-19 revision 47630) [i386-mingw32]
> foo
foo
                                                     
Can you provide more details about your encoding? (chcp or changed locale settings in the registry).

Thank you.

--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Steffen Roller

unread,
Sep 29, 2014, 5:46:36 PM9/29/14
to rubyin...@googlegroups.com
[C:\src\Ruby\playground\2.1.0-error]chcp
Active code page: 1252

The locale is German though.

Steffen Roller

unread,
Sep 29, 2014, 6:25:25 PM9/29/14
to rubyin...@googlegroups.com
Hi Luis,

interesting finding, you were on the right path. My system is configured with German locale, German keyboard, English language.

I tried another system with Windows 2008 R2 - same behaviour. I changed the locale to English (Canada), rebooted et voilà it works.
How can I help to identify the problem? Is there a way to debug?

-st

Luis Lavena

unread,
Sep 29, 2014, 6:32:41 PM9/29/14
to rubyin...@googlegroups.com
On Mon, Sep 29, 2014 at 7:25 PM, Steffen Roller <steffen...@gmail.com> wrote:
Hi Luis,

interesting finding, you were on the right path. My system is configured with German locale, German keyboard, English language.


This is good news! :-)
 
I tried another system with Windows 2008 R2 - same behaviour. I changed the locale to English (Canada), rebooted et voilà it works.
How can I help to identify the problem? Is there a way to debug?


Can you tell me what is the output of the following script in the affected (non-working) system?

# script3.rb

p Encoding.default_external
p Encoding.default_internal
p Encoding.locale_charmap

Steffen Roller

unread,
Sep 29, 2014, 9:20:41 PM9/29/14
to rubyin...@googlegroups.com
Hi Luis,

here you go:

[C:\src\Ruby\playground\2.1.0-error]script3
#<Encoding:Windows-1252>
nil
"CP1252"
[C:\src\Ruby\playground\2.1.0-error]

--
You received this message because you are subscribed to a topic in the Google Groups "RubyInstaller" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyinstaller/A77cYhKn8ho/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rubyinstalle...@googlegroups.com.
To post to this group, send email to rubyin...@googlegroups.com.
Visit this group at http://groups.google.com/group/rubyinstaller.
For more options, visit https://groups.google.com/d/optout.

Luis Lavena

unread,
Sep 29, 2014, 10:28:21 PM9/29/14
to rubyin...@googlegroups.com
On Mon, Sep 29, 2014 at 10:20 PM, Steffen Roller <steffen...@gmail.com> wrote:
Hi Luis,

here you go:

[C:\src\Ruby\playground\2.1.0-error]script3
#<Encoding:Windows-1252>
nil
"CP1252"
[C:\src\Ruby\playground\2.1.0-error]


Are you using a console different than cmd.exe? PowerShell? which version? Do you have Ansicon or Console2/ConsoleZ running?

When you reproduced the issue in the other system, was running under the same environment configuration (using the same console, etc.)

I would like to gather more details before we can report this to Ruby-Core.

Thank you.

Steffen Roller

unread,
Sep 30, 2014, 12:29:56 AM9/30/14
to rubyin...@googlegroups.com
Hi Luis,

I'm using TCC, but I ran the tests under CMD.EXE as well. Same behaviour.
I'm using ansicon, but I uninstalled it with ansicon -u and ansicon -U. I also checked the registry to make sure the key was really gone.
I'm using the same configuration on all systems.

-st

--

Michele Boscolo

unread,
Nov 13, 2014, 9:10:11 AM11/13/14
to rubyin...@googlegroups.com
did you resolve your problem, because a have same problem in my system Windows 7 64 Bit, ruby 2.1.4p265 (2014-10-27 revision 48166) [i386-mingw32], 

My encoding is:
#<Encoding:CP850>
nil
"CP850"

Please someone can help me

Luis Lavena

unread,
Nov 13, 2014, 9:16:37 AM11/13/14
to rubyin...@googlegroups.com
Hello Michele,

Please see my question below.

On Thu, Nov 13, 2014 at 11:10 AM, Michele Boscolo <mibo...@gmail.com> wrote:
did you resolve your problem, because a have same problem in my system Windows 7 64 Bit, ruby 2.1.4p265 (2014-10-27 revision 48166) [i386-mingw32], 

My encoding is:
#<Encoding:CP850>
nil
"CP850"

Please someone can help me


As asked to Steffen, can you tell us which Locale is your system setup?

That might provide some ideas.

Steffen Roller

unread,
Nov 13, 2014, 9:20:36 AM11/13/14
to rubyin...@googlegroups.com
Luis,

I believe I sent all information I had. Things haven't chnged since.
I can go back and dig out my emails to have a look how I reproduced the problem.

-st
Sent from my BlackBerry

From: Luis Lavena <luisl...@gmail.com>
Date: Thu, 13 Nov 2014 11:16:14 -0300
Subject: Re: [RubyInstaller] gets crashes Ruby 2.1.3
--

Luis Lavena

unread,
Nov 13, 2014, 9:24:24 AM11/13/14
to rubyin...@googlegroups.com
Hello Steffen

On Thu, Nov 13, 2014 at 11:20 AM, Steffen Roller <steffen...@gmail.com> wrote:
Luis,

I believe I sent all information I had. Things haven't chnged since.
I can go back and dig out my emails to have a look how I reproduced the problem.


Was not asking you for additional information, sorry that got phrased that way.

Instead, I'm wondering what is the Locale setting of Michele that could provide us some ideas of the problem.

As I mentioned before, I was unable to reproduce the problem, but my locale was (and always been) English.

It seems there are settings that are affecting internal Unicode/Wide functions of Windows that are not reflected by the encoding information exposed by Ruby.

Want to determine if it happens with other locales and which ones.

Thank you.

Steffen Roller

unread,
Nov 13, 2014, 9:25:34 AM11/13/14
to rubyin...@googlegroups.com
Is your locale in Windows different from your encoding in ruby?
Have you changed some of your locale parameters?

If so - make sure that the Windows locale matches the Ruby locale.


-st
Sent from my BlackBerry

From: Michele Boscolo <mibo...@gmail.com>
Date: Thu, 13 Nov 2014 06:10:11 -0800 (PST)
Subject: Re: [RubyInstaller] gets crashes Ruby 2.1.3

Michele Boscolo

unread,
Nov 13, 2014, 3:47:02 PM11/13/14
to rubyin...@googlegroups.com, steffen...@gmail.com
If remove ansicon with command: ansicon -u, ruby work properly.

I think the problem is ansicon, because if acrivate Inject ConEmuHk in Conemu i have same problem.

Until the problem is not resolv i think that i disable ansicon in my console..

Michele Boscolo

unread,
Nov 13, 2014, 3:49:49 PM11/13/14
to rubyin...@googlegroups.com, steffen...@gmail.com
Sorry the language in my system is Italian.

Steffen Roller

unread,
Nov 13, 2014, 6:33:00 PM11/13/14
to rubyin...@googlegroups.com
My location is now English (United States), my language is German, my Ruby Encoding.internal is CP-1252, charmap CP1252.

The crash still happens under ruby 2.1.3p242 (2014-09-19 revision 47630) [i386-mingw32]

--
You received this message because you are subscribed to a topic in the Google Groups "RubyInstaller" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyinstaller/A77cYhKn8ho/unsubscribe.

Luis Lavena

unread,
Nov 13, 2014, 7:19:58 PM11/13/14
to rubyin...@googlegroups.com
On Thu, Nov 13, 2014 at 8:32 PM, Steffen Roller <steffen...@gmail.com> wrote:
My location is now English (United States), my language is German, my Ruby Encoding.internal is CP-1252, charmap CP1252.


Hello Steffen

Location or Locale? These are two different things. Those are under the same window but have different purposes.

Steffen Roller

unread,
Nov 14, 2014, 12:20:15 AM11/14/14
to rubyin...@googlegroups.com
Hi Luis,

that's how it looks like:
Inline-Bild 1

Inline-Bild 2


--
Reply all
Reply to author
Forward
0 new messages