pact-foundation / pact-reference

Reference implementations for the pact specifications
https://pact.io
MIT License
91 stars 46 forks source link

ffi.pactffi_logger_attach_sink causes seg fault if log directory doesn't exist #226

Closed YOU54F closed 1 year ago

YOU54F commented 1 year ago

Hey hey

Just started playing about with the FFI, as I wanted to get Ruby moving in the right direction

The following command fails when called, with a directory that doesn't exist, should this be handled by the rust-core?

either

ffi.pactffi_logger_attach_sink('file ./logs/log.txt',  ffi::FfiLogLevelFilter['LOG_LEVEL_INFO'])

My expectations on error handling come from

https://github.com/pact-foundation/pact-reference/blob/master/rust/pact_ffi/ARCHITECTURE.md#error-handling

And my logging is setup as per

https://github.com/pact-foundation/pact-reference/blob/master/rust/pact_ffi/ARCHITECTURE.md#logging

      PactRubyFfi.pactffi_logger_init
      PactRubyFfi.pactffi_logger_attach_sink('file ./logs/log.txt',
                                             PactRubyFfi::FfiLogLevelFilter['LOG_LEVEL_INFO'])
      PactRubyFfi.pactffi_logger_attach_sink('file ./logs/log-error.txt',
                                             PactRubyFfi::FfiLogLevelFilter['LOG_LEVEL_DEBUG'])
      PactRubyFfi.pactffi_logger_attach_sink('stdout', PactRubyFfi::FfiLogLevelFilter['LOG_LEVEL_INFO'])
      PactRubyFfi.pactffi_logger_attach_sink('stderr', PactRubyFfi::FfiLogLevelFilter['LOG_LEVEL_DEBUG'])
      PactRubyFfi.pactffi_logger_apply

dump (reduced)

pact_ruby_ffi 0.1.0 built to pkg/pact_ruby_ffi-0.1.0.gem.
/opt/hostedtoolcache/Ruby/3.0.4/x64/bin/ruby -I/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-support-3.12.0/lib:/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb
/home/runner/work/pact-ruby-ffi/pact-ruby-ffi/spec/pactffi_create_message_pact_spec.rb:27: [BUG] Segmentation fault at 0x00000000ffffffe0
ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0041 p:---- s:0211 e:000210 CFUNC  :pactffi_logger_attach_sink
c:0040 p:0042 s:0205 e:000204 BLOCK  /home/runner/work/pact-ruby-ffi/pact-ruby-ffi/spec/pactffi_create_message_pact_spec.rb:27 [FINISH]
c:0039 p:---- s:0199 e:000198 CFUNC  :instance_exec
c:0038 p:00[13](https://github.com/YOU54F/pact-ruby-ffi/actions/runs/3359065807/jobs/5566710227#step:7:14) s:0194 e:000193 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:457
c:0037 p:0010 s:0188 e:000187 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:365
c:0036 p:0007 s:0183 e:000182 BLOCK  /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:529 [FINISH]
c:0035 p:---- s:0179 e:000178 CFUNC  :each
c:0034 p:0012 s:0175 e:000174 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:528
c:0033 p:0013 s:0168 e:000167 BLOCK  /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:615 [FINISH]
c:0032 p:---- s:0164 e:000163 CFUNC  :reverse_each
c:0031 p:0008 s:0160 e:000159 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:6[14](https://github.com/YOU54F/pact-ruby-ffi/actions/runs/3359065807/jobs/5566710227#step:7:15)
c:0030 p:0089 s:0[15](https://github.com/YOU54F/pact-ruby-ffi/actions/runs/3359065807/jobs/5566710227#step:7:16)3 e:000152 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:484
c:0029 p:00[16](https://github.com/YOU54F/pact-ruby-ffi/actions/runs/3359065807/jobs/5566710227#step:7:17) s:0146 e:000145 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:505
c:0028 p:0004 s:0142 e:000141 BLOCK  /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:261
c:0027 p:0003 s:0137 e:000136 BLOCK  /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:511
c:0026 p:0003 s:0134 e:000133 BLOCK  /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:468
c:0025 p:0003 s:0131 e:000130 BLOCK  /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:486
c:0024 p:0026 s:0128 e:000127 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:624
c:0023 p:0108 s:0121 e:000120 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:486
c:0022 p:0025 s:0114 e:000113 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:468
c:0021 p:0019 s:0109 e:000108 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:511
c:0020 p:0111 s:0104 e:000103 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:259
c:0019 p:0044 s:0097 e:000096 BLOCK  /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:646 [FINISH]
c:0018 p:---- s:0091 e:000090 CFUNC  :map
c:00[17](https://github.com/YOU54F/pact-ruby-ffi/actions/runs/3359065807/jobs/5566710227#step:7:18) p:0011 s:0087 e:000086 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:642
c:0016 p:0081 s:0082 e:000081 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:607
c:0015 p:0007 s:0073 e:000072 BLOCK  /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:608 [FINISH]
c:0014 p:---- s:0069 e:000068 CFUNC  :map
c:0013 p:0094 s:0065 e:000064 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:608
c:0012 p:0008 s:0056 e:000055 BLOCK  /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:121 [FINISH]
c:0011 p:---- s:0052 e:000051 CFUNC  :map
c:0010 p:0030 s:0048 e:000047 BLOCK  /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:121
c:0009 p:0033 s:0045 e:000044 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/configuration.rb:2070
c:0008 p:0007 s:0041 e:000040 BLOCK  /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:116
c:0007 p:0009 s:0037 e:000036 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/reporter.rb:74
c:0006 p:0019 s:0032 e:000031 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:115
c:0005 p:0042 s:0025 e:000024 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:89
c:0004 p:0065 s:0019 e:0000[18](https://github.com/YOU54F/pact-ruby-ffi/actions/runs/3359065807/jobs/5566710227#step:7:19) METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:71
c:0003 p:0020 s:0011 e:000010 METHOD /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:45
c:0002 p:0025 s:0006 e:000005 EVAL   /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/exe/rspec:4 [FINISH]
c:0001 p:0000 s:0003 E:000050 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/exe/rspec:4:in `<main>'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:45:in `invoke'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:71:in `run'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:89:in `run'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:115:in `run_specs'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/reporter.rb:74:in `report'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:116:in `block in run_specs'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/configuration.rb:2070:in `with_suite_hooks'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:121:in `block (2 levels) in run_specs'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:121:in `map'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:121:in `block (3 levels) in run_specs'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:608:in `run'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:608:in `map'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:608:in `block in run'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:607:in `run'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:642:in `run_examples'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:642:in `map'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example_group.rb:646:in `block in run_examples'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:259:in `run'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:511:in `with_around_and_singleton_context_hooks'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:468:in `with_around_example_hooks'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:486:in `run'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:624:in `run_around_example_hooks_for'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:486:in `block in run'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:468:in `block in with_around_example_hooks'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:511:in `block in with_around_and_singleton_context_hooks'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:261:in `block in run'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:505:in `run_before_example'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:484:in `run'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:614:in `run_example_hooks_for'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:614:in `reverse_each'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:615:in `block in run_example_hooks_for'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:528:in `run_owned_hooks_for'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:528:in `each'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:529:in `block in run_owned_hooks_for'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/hooks.rb:365:in `run'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:457:in `instance_exec'
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib/rspec/core/example.rb:457:in `instance_exec'
/home/runner/work/pact-ruby-ffi/pact-ruby-ffi/spec/pactffi_create_message_pact_spec.rb:27:in `block (3 levels) in <top (required)>'
/home/runner/work/pact-ruby-ffi/pact-ruby-ffi/spec/pactffi_create_message_pact_spec.rb:27:in `pactffi_logger_attach_sink'

-- Machine register context ------------------------------------------------
 RIP: 0x00007f961a163717 RBP: 0x00000000fffffffa RSP: 0x00007ffdfd4ba638
 RAX: 0x0000000000000008 RBX: 0x000055e6649c7120 RCX: 0x000000000000001a
 RDX: 0x00000000fffffffa RDI: 0x00000000ffffffe0 RSI: 0x000055e664b266c8
  R8: 0x0000000000000015  R9: 0x00007f961a1c7c10 R10: 0xffffffffffffff0b
 R11: 0x00007f961a673c60 R12: 0x00007ffdfd4ba700 R13: 0x00007ffdfd4ba700
 R14: 0x00007ffdfd4ba6e0 R15: 0x00007ffdfd4ba720 EFL: 0x0000000000010202

-- C level backtrace information -------------------------------------------
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_print_backtrace+0x11) [0x7f961a702803] vm_dump.c:758
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_vm_bugreport) vm_dump.c:998
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_bug_for_fatal_signal+0xf4) [0x7f961a50bbd4] error.c:787
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(sigsegv+0x4d) [0x7f961a6597ed] signal.c:963
/lib/x86_64-linux-gnu/libpthread.so.0(__restore_rt+0x0) [0x7f961a401420]
/lib/x86_64-linux-gnu/libc.so.6(0x7f961a163717) [0x7f961a163717]
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_str_new_cstr+0x12) [0x7f961a673c72] string.c:872
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/ffi-1.15.5/lib/ffi_c.so(rbffi_NativeValue_ToRuby+0x1ef) [0x7f96[19](https://github.com/YOU54F/pact-ruby-ffi/actions/runs/3359065807/jobs/5566710227#step:7:20)b965df] Types.c:83
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/ffi-1.15.5/lib/ffi_c.so(rbffi_NativeValue_ToRuby) (null):0
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/ffi-1.15.5/lib/ffi_c.so(rbffi_CallFunction+0x[20](https://github.com/YOU54F/pact-ruby-ffi/actions/runs/3359065807/jobs/5566710227#step:7:21)f) [0x7f9619b8b3cf] Call.c:412
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/ffi-1.15.5/lib/ffi_c.so(custom_trampoline+0x37) [0x7f9619b8f3c7] MethodHandle.c:220
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_cfunc_with_frame+0x118) [0x7f961a6dab38] vm_insnhelper.c:2928
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_method_each_type+0x79) [0x7f961a6eec99] vm_insnhelper.c:3418
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_method+0xb4) [0x7f961a6ef374] vm_insnhelper.c:3536
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_sendish+0x10) [0x7f961a6e7cc2] vm_insnhelper.c:4529
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_exec_core) insns.def:789
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_vm_exec+0x1a4) [0x7f961a6ed8a4] vm.c:[21](https://github.com/YOU54F/pact-ruby-ffi/actions/runs/3359065807/jobs/5566710227#step:7:22)62
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(yield_under+0x4a1) [0x7f961a6fc771] vm.c:1263
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_cfunc_with_frame+0x118) [0x7f961a6dab38] vm_insnhelper.c:2928
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_method_each_type+0x79) [0x7f961a6eec99] vm_insnhelper.c:3418
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_method+0xb4) [0x7f961a6ef374] vm_insnhelper.c:3536
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_sendish+0x138) [0x7f961a6de948] vm_insnhelper.c:4529
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_exec_core+0x20a) [0x7f961a6e7d3a] insns.def:770
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_vm_exec+0x1a4) [0x7f961a6ed8a4] vm.c:2162
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_yield+0x25e) [0x7f961a6f179e] vm.c:1263
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(RB_FL_TEST_RAW+0x0) [0x7f961a475ecc] array.c:2523
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(RB_FL_ANY_RAW) ./include/ruby/internal/fl_type.h:258
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_array_len) ./include/ruby/internal/core/rarray.h:135
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_ary_each) array.c:25[22](https://github.com/YOU54F/pact-ruby-ffi/actions/runs/3359065807/jobs/5566710227#step:7:23)
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_cfunc_with_frame+0x118) [0x7f961a6dab38] vm_insnhelper.c:2928
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_sendish+0x138) [0x7f961a6de948] vm_insnhelper.c:4529
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_exec_core+0x20a) [0x7f961a6e7d3a] insns.def:770
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_vm_exec+0x1a4) [0x7f961a6ed8a4] vm.c:2162
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_yield+0x25e) [0x7f961a6f179e] vm.c:1263
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(RB_FL_TEST_RAW+0x0) [0x7f961a475f6e] array.c:2626
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(RB_FL_ANY_RAW) ./include/ruby/internal/fl_type.h:258
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_array_len) ./include/ruby/internal/core/rarray.h:135
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_ary_reverse_each) array.c:2627
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_cfunc_with_frame+0x118) [0x7f961a6dab38] vm_insnhelper.c:2928
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_method_each_type+0x79) [0x7f961a6eec99] vm_insnhelper.c:3418
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_method+0xb4) [0x7f961a6ef374] vm_insnhelper.c:3536
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_symbol+0x174) [0x7f961a6efa14] vm_insnhelper.c:3142
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_method_each_type+0x431) [0x7f961a6ef051] vm_insnhelper.c:3454
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_method+0xb4) [0x7f961a6ef374] vm_insnhelper.c:3536
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_sendish+0x138) [0x7f961a6de948] vm_insnhelper.c:4529
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_exec_core+0x20a) [0x7f961a6e7d3a] insns.def:770
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_vm_exec+0xa45) [0x7f961a6ee145] vm.c:2171
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_yield+0x25e) [0x7f961a6f179e] vm.c:1263
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_ary_collect+0x5c) [0x7f961a47c90c] array.c:3635
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_cfunc_with_frame+0x118) [0x7f961a6dab38] vm_insnhelper.c:2928
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_sendish+0x138) [0x7f961a6de948] vm_insnhelper.c:4529
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_exec_core+0x20a) [0x7f961a6e7d3a] insns.def:770
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_vm_exec+0x1a4) [0x7f961a6ed8a4] vm.c:2162
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_yield+0x25e) [0x7f961a6f179e] vm.c:1263
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_ary_collect+0x5c) [0x7f961a47c90c] array.c:3635
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_cfunc_with_frame+0x118) [0x7f961a6dab38] vm_insnhelper.c:2928
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_sendish+0x138) [0x7f961a6de948] vm_insnhelper.c:4529
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_exec_core+0x20a) [0x7f961a6e7d3a] insns.def:770
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_vm_exec+0x1a4) [0x7f961a6ed8a4] vm.c:2162
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_yield+0x25e) [0x7f961a6f179e] vm.c:1263
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_ary_collect+0x5c) [0x7f961a47c90c] array.c:3635
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_call_cfunc_with_frame+0x118) [0x7f961a6dab38] vm_insnhelper.c:2928
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_sendish+0x138) [0x7f961a6de948] vm_insnhelper.c:4529
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(vm_exec_core+0x20a) [0x7f961a6e7d3a] insns.def:770
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_vm_exec+0x1a4) [0x7f961a6ed8a4] vm.c:2162
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(rb_ec_exec_node+0xed) [0x7f961a510b1d] eval.c:317
/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/libruby.so.3.0(ruby_run_node+0x5a) [0x7f961a516a8a] eval.c:375
/opt/hostedtoolcache/Ruby/3.0.4/x64/bin/ruby(main+0x5f) [0x55e66224717f] ./main.c:50

Aborted (core dumped)
/opt/hostedtoolcache/Ruby/3.0.4/x64/bin/ruby -I/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-support-3.12.0/lib:/opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/lib /opt/hostedtoolcache/Ruby/3.0.4/x64/lib/ruby/gems/3.0.0/gems/rspec-core-3.12.0/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb failed
YOU54F commented 1 year ago

Got back to messing about with this this eve.

can just test for the directories existence and create it.

FileUtils.mkdir_p 'logs' unless File.directory?('logs')

also noted if LevelFilter is set to 0 it panics too

PactRubyFfi.pactffi_logger_attach_sink('stderr', PactRubyFfi::FfiLogLevelFilter['LOG_LEVEL_OFF'])

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', pact_ffi/src/log/logger.rs:76:95
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
rholshausen commented 1 year ago

Huh! Comment in the code:

// Safe to unwrap here, as the previous FFI step would have validated the sink and returned // an error back to the caller if the sink could not be constructed. Also the level filter will // never create a level that can't be unwrapped

I'll update that comment to be: Also the level filter will never create a level that can't be unwrapped unless it is for Yousaf :-D

YOU54F commented 1 year ago

Fixed