Issue #5375 has been updated by Luis Lavena.

Status changed from Assigned to Feedback
Assignee changed from Nobuyoshi Nakada to Aaron Patterson

@Jon:

Just tested trunk at r33401 with GCC 4.6.1 (TDM-1) under Windows XP SP2 and worked without segfaulting:

<pre>
V:\>ver

Microsoft Windows XP [VersiĆ³n 5.1.2600]

V:\>ruby -rpsych -ve "puts Psych.load(\"gem: --no-ri --no-rdoc\r\n\")"
ruby 1.9.4dev (2011-10-05) [i386-mingw32]
{"gem"=>"--no-ri --no-rdoc"}
</pre>

This commit and the following (r33403 and r33404) should be backported to 1.9.3

Assigning to Aaron Patterson so he can confirm if this is correct.

----------------------------------------
Bug #5375: [mingw32] segfault on WinXP SP3 with 1.9.3dev@33347
http://redmine.ruby-lang.org/issues/5375

Author: Jon Forums
Status: Feedback
Priority: Normal
Assignee: Aaron Patterson
Category: 
Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2011-09-27 revision 33347) [i386-mingw32]


With 1.9.3dev@33347 I get a segfault when running `gem --version` on WinXP SP3 32bit (Home and Professional) when Ruby is built with TDM-GCC 4.6.1 and the RubyInstaller recipes.

The build passed `make test-all TESTS='openssl fiddle psych' && make test`

I am unable to replicate the failure in the following environments:

  * Win7 Professional or Ultimate 32bit
  * ruby 1.9.3dev@33347 built with TDM-GCC 4.5.2
  * ruby 1.9.4dev@33350 built with TDM-GCC 4.6.1
  * ruby 1.9.4dev@33350 built with gcc 4.6.1 on Arch Linux 3.0


C:\>ruby --version
ruby 1.9.3dev (2011-09-27 revision 33347) [i386-mingw32]

C:\>gem --version
c:/ruby19/lib/ruby/1.9.1/psych/scalar_scanner.rb:71: [BUG] Segmentation fault
ruby 1.9.3dev (2011-09-27 revision 33347) [i386-mingw32]

-- Control frame information -----------------------------------------------
c:0027 p:---- s:0138 b:0138 l:000137 d:000137 CFUNC  :Integer
c:0026 p:0185 s:0134 b:0134 l:000133 d:000133 METHOD c:/ruby19/lib/ruby/1.9.1/psych/scalar_scanner.rb:71
c:0025 p:0220 s:0129 b:0129 l:000128 d:000128 METHOD c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:46
c:0024 p:0030 s:0118 b:0118 l:000117 d:000117 METHOD c:/ruby19/lib/ruby/1.9.1/psych/visitors/visitor.rb:15
c:0023 p:0013 s:0114 b:0114 l:000113 d:000113 METHOD c:/ruby19/lib/ruby/1.9.1/psych/visitors/visitor.rb:5
c:0022 p:0012 s:0110 b:0110 l:000109 d:000109 METHOD c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:16
c:0021 p:0164 s:0102 b:0099 l:000083 d:000098 BLOCK  c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:226
c:0020 p:---- s:0094 b:0094 l:000093 d:000093 FINISH
c:0019 p:---- s:0092 b:0092 l:000087 d:000091 IFUNC
c:0018 p:---- s:0090 b:0090 l:000089 d:000089 CFUNC  :each
c:0017 p:---- s:0088 b:0088 l:000087 d:000087 CFUNC  :each_slice
c:0016 p:0052 s:0084 b:0084 l:000083 d:000083 METHOD c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:211
c:0015 p:0091 s:0079 b:0079 l:000078 d:000078 METHOD c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:123
c:0014 p:0030 s:0065 b:0065 l:000064 d:000064 METHOD c:/ruby19/lib/ruby/1.9.1/psych/visitors/visitor.rb:15
c:0013 p:0013 s:0061 b:0061 l:000060 d:000060 METHOD c:/ruby19/lib/ruby/1.9.1/psych/visitors/visitor.rb:5
c:0012 p:0012 s:0057 b:0057 l:000056 d:000056 METHOD c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:16
c:0011 p:0026 s:0049 b:0049 l:000048 d:000048 METHOD c:/ruby19/lib/ruby/1.9.1/psych/nodes/node.rb:35
c:0010 p:0029 s:0046 b:0046 l:000045 d:000045 METHOD c:/ruby19/lib/ruby/1.9.1/psych.rb:113
c:0009 p:0080 s:0041 b:0041 l:000040 d:000040 METHOD c:/ruby19/lib/ruby/1.9.1/rubygems/config_file.rb:239
c:0008 p:0212 s:0037 b:0037 l:000036 d:000036 METHOD c:/ruby19/lib/ruby/1.9.1/rubygems/config_file.rb:179
c:0007 p:---- s:0028 b:0028 l:000027 d:000027 FINISH
c:0006 p:---- s:0026 b:0026 l:000025 d:000025 CFUNC  :new
c:0005 p:0022 s:0022 b:0021 l:000020 d:000020 METHOD c:/ruby19/lib/ruby/1.9.1/rubygems/gem_runner.rb:78
c:0004 p:0118 s:0017 b:0017 l:000016 d:000016 METHOD c:/ruby19/lib/ruby/1.9.1/rubygems/gem_runner.rb:51
c:0003 p:0164 s:0009 b:0009 l:0019bc d:0021a8 EVAL   c:/ruby19/bin/gem:21
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:0019bc d:0019bc TOP

-- Ruby level backtrace information ----------------------------------------
c:/ruby19/bin/gem:21:in `<main>'
c:/ruby19/lib/ruby/1.9.1/rubygems/gem_runner.rb:51:in `run'
c:/ruby19/lib/ruby/1.9.1/rubygems/gem_runner.rb:78:in `do_configuration'
c:/ruby19/lib/ruby/1.9.1/rubygems/gem_runner.rb:78:in `new'
c:/ruby19/lib/ruby/1.9.1/rubygems/config_file.rb:179:in `initialize'
c:/ruby19/lib/ruby/1.9.1/rubygems/config_file.rb:239:in `load_file'
c:/ruby19/lib/ruby/1.9.1/psych.rb:113:in `load'
c:/ruby19/lib/ruby/1.9.1/psych/nodes/node.rb:35:in `to_ruby'
c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:16:in `accept'
c:/ruby19/lib/ruby/1.9.1/psych/visitors/visitor.rb:5:in `accept'
c:/ruby19/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit'
c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:123:in `visit_Psych_Nodes_Mapping'
c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:211:in `revive_hash'
c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:211:in `each_slice'
c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:211:in `each'
c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:226:in `block in revive_hash'
c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:16:in `accept'
c:/ruby19/lib/ruby/1.9.1/psych/visitors/visitor.rb:5:in `accept'
c:/ruby19/lib/ruby/1.9.1/psych/visitors/visitor.rb:15:in `visit'
c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb:46:in `visit_Psych_Nodes_Scalar'
c:/ruby19/lib/ruby/1.9.1/psych/scalar_scanner.rb:71:in `tokenize'
c:/ruby19/lib/ruby/1.9.1/psych/scalar_scanner.rb:71:in `Integer'

-- C level backtrace information -------------------------------------------
C:\WINDOWS\system32\ntdll.dll(KiFastSystemCallRet+0x0) [0x7c90e514]
C:\WINDOWS\system32\kernel32.dll(WaitForSingleObject+0x12) [0x7c802542]

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

* Loaded script: c:/ruby19/bin/gem

* Loaded features:

    0 enumerator.so
    1 c:/ruby19/lib/ruby/1.9.1/i386-mingw32/enc/encdb.so
    2 c:/ruby19/lib/ruby/1.9.1/i386-mingw32/enc/iso_8859_1.so
    3 c:/ruby19/lib/ruby/1.9.1/i386-mingw32/enc/trans/transdb.so
    4 c:/ruby19/lib/ruby/1.9.1/rubygems/defaults.rb
    5 c:/ruby19/lib/ruby/1.9.1/i386-mingw32/rbconfig.rb
    6 c:/ruby19/lib/ruby/1.9.1/rubygems/deprecate.rb
    7 c:/ruby19/lib/ruby/1.9.1/rubygems/exceptions.rb
    8 c:/ruby19/lib/ruby/1.9.1/rubygems/defaults/operating_system.rb
    9 c:/ruby19/lib/ruby/1.9.1/rubygems/custom_require.rb
   10 c:/ruby19/lib/ruby/1.9.1/rubygems.rb
   11 c:/ruby19/lib/ruby/1.9.1/optparse.rb
   12 c:/ruby19/lib/ruby/1.9.1/rubygems/user_interaction.rb
   13 c:/ruby19/lib/ruby/1.9.1/rubygems/command.rb
   14 c:/ruby19/lib/ruby/1.9.1/rubygems/command_manager.rb
   15 c:/ruby19/lib/ruby/1.9.1/i386-mingw32/etc.so
   16 c:/ruby19/lib/ruby/1.9.1/i386-mingw32/enc/utf_16le.so
   17 c:/ruby19/lib/ruby/1.9.1/i386-mingw32/enc/trans/utf_16_32.so
   18 c:/ruby19/lib/ruby/1.9.1/i386-mingw32/enc/trans/single_byte.so
   19 c:/ruby19/lib/ruby/1.9.1/rubygems/config_file.rb
   20 c:/ruby19/lib/ruby/1.9.1/rubygems/doc_manager.rb
   21 c:/ruby19/lib/ruby/1.9.1/rubygems/version.rb
   22 c:/ruby19/lib/ruby/1.9.1/rubygems/requirement.rb
   23 c:/ruby19/lib/ruby/1.9.1/rubygems/platform.rb
   24 c:/ruby19/lib/ruby/1.9.1/rubygems/specification.rb
   25 c:/ruby19/lib/ruby/1.9.1/rubygems/path_support.rb
   26 c:/ruby19/lib/ruby/1.9.1/rubygems/dependency.rb
   27 c:/ruby19/lib/ruby/gems/1.9.1/gems/yard-0.7.2/lib/yard/rubygems/specification.rb
   28 c:/ruby19/lib/ruby/gems/1.9.1/gems/yard-0.7.2/lib/yard/rubygems/doc_manager.rb
   29 c:/ruby19/lib/ruby/1.9.1/rubygems/gem_runner.rb
   30 c:/ruby19/lib/ruby/1.9.1/i386-mingw32/psych.so
   31 c:/ruby19/lib/ruby/1.9.1/i386-mingw32/stringio.so
   32 c:/ruby19/lib/ruby/1.9.1/psych/nodes/node.rb
   33 c:/ruby19/lib/ruby/1.9.1/psych/nodes/stream.rb
   34 c:/ruby19/lib/ruby/1.9.1/psych/nodes/document.rb
   35 c:/ruby19/lib/ruby/1.9.1/psych/nodes/sequence.rb
   36 c:/ruby19/lib/ruby/1.9.1/psych/nodes/scalar.rb
   37 c:/ruby19/lib/ruby/1.9.1/psych/nodes/mapping.rb
   38 c:/ruby19/lib/ruby/1.9.1/psych/nodes/alias.rb
   39 c:/ruby19/lib/ruby/1.9.1/psych/nodes.rb
   40 c:/ruby19/lib/ruby/1.9.1/psych/streaming.rb
   41 c:/ruby19/lib/ruby/1.9.1/psych/visitors/visitor.rb
   42 c:/ruby19/lib/ruby/1.9.1/i386-mingw32/strscan.so
   43 c:/ruby19/lib/ruby/1.9.1/psych/scalar_scanner.rb
   44 c:/ruby19/lib/ruby/1.9.1/psych/visitors/to_ruby.rb
   45 c:/ruby19/lib/ruby/1.9.1/psych/visitors/emitter.rb
   46 c:/ruby19/lib/ruby/1.9.1/psych/visitors/yaml_tree.rb
   47 c:/ruby19/lib/ruby/1.9.1/psych/json/ruby_events.rb
   48 c:/ruby19/lib/ruby/1.9.1/psych/visitors/json_tree.rb
   49 c:/ruby19/lib/ruby/1.9.1/psych/visitors/depth_first.rb
   50 c:/ruby19/lib/ruby/1.9.1/psych/visitors.rb
   51 c:/ruby19/lib/ruby/1.9.1/psych/handler.rb
   52 c:/ruby19/lib/ruby/1.9.1/psych/tree_builder.rb
   53 c:/ruby19/lib/ruby/1.9.1/psych/parser.rb
   54 c:/ruby19/lib/ruby/1.9.1/psych/omap.rb
   55 c:/ruby19/lib/ruby/1.9.1/psych/set.rb
   56 c:/ruby19/lib/ruby/1.9.1/psych/coder.rb
   57 c:/ruby19/lib/ruby/1.9.1/psych/core_ext.rb
   58 c:/ruby19/lib/ruby/1.9.1/i386-mingw32/date_core.so
   59 c:/ruby19/lib/ruby/1.9.1/date/format.rb
   60 c:/ruby19/lib/ruby/1.9.1/date.rb
   61 c:/ruby19/lib/ruby/1.9.1/psych/deprecated.rb
   62 c:/ruby19/lib/ruby/1.9.1/psych/json.rb
   63 c:/ruby19/lib/ruby/1.9.1/psych.rb
   64 c:/ruby19/lib/ruby/1.9.1/yaml.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html


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



C:\>gdb --args ruby -S gem --version
GNU gdb (GDB) 7.3
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from c:\ruby19\bin\ruby.exe...done.
(gdb) run
Starting program: c:\ruby19\bin\ruby.exe -S gem --version
[New Thread 1480.0x974]
[New Thread 1480.0x680]

Program received signal SIGSEGV, Segmentation fault.
0x77c3554a in msvcrt!_abnormal_termination ()
   from C:\WINDOWS\system32\msvcrt.dll
(gdb) bt
#0  0x77c3554a in msvcrt!_abnormal_termination ()
   from C:\WINDOWS\system32\msvcrt.dll
#1  0x77c39bc6 in strerror () from C:\WINDOWS\system32\msvcrt.dll
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) thread
[Current thread is 1 (Thread 1480.0x974)]
(gdb) info threads
  Id   Target Id         Frame
  2    Thread 1480.0x680 0x7c90e514 in ntdll!LdrAccessResource ()
   from C:\WINDOWS\system32\ntdll.dll
* 1    Thread 1480.0x974 0x77c3554a in msvcrt!_abnormal_termination ()
   from C:\WINDOWS\system32\msvcrt.dll
(gdb)



-- 
http://redmine.ruby-lang.org