Project

General

Profile

Bug #5897

RubyからWinAPIのCreateProcessを使ったときに引数を間違えるとバグがでる

Added by uy (西行寺 うゆ) over 7 years ago. Updated 9 months ago.

Status:
Rejected
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]
[ruby-dev:<unknown>]

Description

require 'Win32API'

CreateProcess = Win32API.new('kernel32', 'CreateProcess', %w(ipiiiiiipp), 'i')

NULL = 0
FALSE = 0
lpCommandLine = ""

CreateProcess.call(
NULL,

lpCommandLine,

NULL,

NULL,

FALSE,

FALSE,
NULL,

NULL,

"",
0
)

引数は間違えないのが理想ですが
間違ったときには[BUG]じゃなくてエラーメッセージがいいんじゃないかなと

History

Updated by nobu (Nobuyoshi Nakada) over 7 years ago

  • Category set to ext
  • Status changed from Open to Feedback
  • Assignee set to usa (Usaku NAKAMURA)

=begin
再現しません。

$ ruby -v -rWin32API -e "CreateProcess = Win32API.new('kernel32', 'CreateProcess', %w(ipiiiiiipp), 'i')" -e "lpCommandLine = ''" -e "p CreateProcess.call(0, lpCommandLine, 0, 0, 0, 0, 0, 0, '', 0)"
ruby 1.9.3p0 (2011-11-08 revision 33661) [i386-mingw32]
Warning:C:/Program Files (x86)/ruby/1.9.3/i386-mingw32/lib/ruby/1.9.1/rubygems/custom_require.rb:36: Win32API is deprecated after Ruby 1.9.1; use dl directly instead
0

実際のメッセージをそのまま貼ってください。
=end

Updated by uy (西行寺 うゆ) about 7 years ago

C:/DOCUME~1/teruyo/LOCALS~1/Temp/rbBE.tmp:4: warning: already initialized constant FALSE
C:/Ruby2/lib/ruby/1.9.1/Win32API.rb:25: [BUG] Segmentation fault
ruby 1.9.3p0 (2011-10-30) [i386-mingw32]

-- Control frame information -----------------------------------------------
c:0005 p:---- s:0017 b:0017 l:000016 d:000016 CFUNC :call
c:0004 p:0041 s:0013 b:0013 l:000012 d:000012 METHOD C:/Ruby2/lib/ruby/1.9.1/Win32API.rb:25
c:0003 p:0133 s:0007 b:0007 l:00264c d:000520 EVAL C:/DOCUME~1/teruyo/LOCALS~1/Temp/rbBE.tmp:6
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:00264c d:00264c TOP

-- Ruby level backtrace information ----------------------------------------
C:/DOCUME~1/teruyo/LOCALS~1/Temp/rbBE.tmp:6:in <main>'
C:/Ruby2/lib/ruby/1.9.1/Win32API.rb:25:in
call'
C:/Ruby2/lib/ruby/1.9.1/Win32API.rb:25:in `call'

-- C level backtrace information -------------------------------------------
C:\WINDOWS\system32\ntdll.dll(KiFastSystemCallRet+0x0) [0x7c94e514]
C:\WINDOWS\system32\kernel32.dll(WaitForSingleObject+0x12) [0x7c802542]
C:\Ruby2\bin\msvcrt-ruby191.dll(rb_vm_bugreport+0xf9) [0x62e5acc9]
C:\Ruby2\bin\msvcrt-ruby191.dll(rb_name_err_mesg_new+0x17a) [0x62d3a68e]
C:\Ruby2\bin\msvcrt-ruby191.dll(rb_bug+0x2f) [0x62d3b3ef]
C:\Ruby2\bin\msvcrt-ruby191.dll(rb_check_safe_str+0x1a4) [0x62ded27c]
[0x004011e6]
C:\WINDOWS\system32\kernel32.dll(UnhandledExceptionFilter+0x1c7) [0x7c864191]

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

  • Loaded script: C:/DOCUME~1/teruyo/LOCALS~1/Temp/rbBE.tmp

  • Loaded features:

    0 enumerator.so
    1 C:/Ruby2/lib/ruby/1.9.1/i386-mingw32/enc/encdb.so
    2 C:/Ruby2/lib/ruby/1.9.1/i386-mingw32/enc/shift_jis.so
    3 C:/Ruby2/lib/ruby/1.9.1/i386-mingw32/enc/trans/transdb.so
    4 C:/Ruby2/lib/ruby/site_ruby/1.9.1/rubygems/defaults.rb
    5 C:/Ruby2/lib/ruby/1.9.1/tsort.rb
    6 C:/Ruby2/lib/ruby/site_ruby/1.9.1/rubygems/dependency_list.rb
    7 C:/Ruby2/lib/ruby/1.9.1/i386-mingw32/rbconfig.rb
    8 C:/Ruby2/lib/ruby/site_ruby/1.9.1/rubygems/deprecate.rb
    9 C:/Ruby2/lib/ruby/site_ruby/1.9.1/rubygems/exceptions.rb
    10 C:/Ruby2/lib/ruby/site_ruby/1.9.1/rubygems/defaults/operating_system.rb
    11 C:/Ruby2/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb
    12 C:/Ruby2/lib/ruby/site_ruby/1.9.1/rubygems.rb
    13 C:/Ruby2/lib/ruby/1.9.1/i386-mingw32/dl.so
    14 C:/Ruby2/lib/ruby/1.9.1/i386-mingw32/fiddle.so
    15 C:/Ruby2/lib/ruby/1.9.1/fiddle/function.rb
    16 C:/Ruby2/lib/ruby/1.9.1/fiddle/closure.rb
    17 C:/Ruby2/lib/ruby/1.9.1/fiddle.rb
    18 C:/Ruby2/lib/ruby/1.9.1/dl.rb
    19 C:/Ruby2/lib/ruby/1.9.1/Win32API.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.

Updated by mame (Yusuke Endoh) 9 months ago

  • Status changed from Feedback to Rejected

本日の開発者会議でこのチケットを議論しましたが、このAPIはFFIの薄いラッパなので、特に[BUG]を防ぐ予定はないとのことでした。

Also available in: Atom PDF