Specifically, I'm working on https://github.com/dscottboggs/colors-and-gradients, and the spec/gradient_spec.cr file is at some point causing a segfault. The output of the terminal when that happens is
~/.../code/colors >>> crystal spec
.....................Invalid memory access (signal 11) at address 0x38
[0x5562ebe0a9a6] *CallStack::print_backtrace:Int32 +118
[0x5562ebdf993d] __crystal_sigfault_handler +61
[0x7fe2145713c0] ???
[0x5562ebdfe1f5] ~procProc(Nil) +21
[0x5562ebdfbb4d] *it<String, String, Int32, Int32, &Proc(Nil)>:(Array(Spec::Result) | Nil) +525
[0x5562ebdfde03] ~procProc(Nil) +579
[0x5562ebe615d4] *Spec::RootContext::describe<String, String, Int32, &Proc(Nil)>:Spec::Context+ +340
[0x5562ebdfeeb7] *describe<Colors::Gradient.class, String, Int32, &Proc(Nil)>:Spec::Context+ +55
[0x5562ebde9672] __crystal_main +4354
[0x5562ebe8db76] *Crystal::main_user_code<Int32, Pointer(Pointer(UInt8))>:Nil +6
[0x5562ebe8dad9] *Crystal::main<Int32, Pointer(Pointer(UInt8))>:Int32 +41
[0x5562ebdf46b6] main +6
[0x7fe21413e223] __libc_start_main +243
[0x5562ebde849e] _start +46
[0x0] ???
I'm sorry, I wish I had more to give you, but I'm at a loss here.
Reduced:
def do_block
yield
end
def do_capture(&block)
block.call
end
do_block do
grad = "1"
do_capture do
grad[0]
end
end
grad = "2"
do_capture do
grad[0]
end
@dscottboggs, you should be able to work around this by avoiding reassigning grad in gradent_spec.cr (just rename the second instance to grad2 or something).
Thanks, no more segfault! Thanks for narrowing it down and showing where the problem is
Most helpful comment
Reduced:
@dscottboggs, you should be able to work around this by avoiding reassigning
gradingradent_spec.cr(just rename the second instance tograd2or something).