Chasing the stack (problem determining what is calling this function wrong)


#1

Ohai!

In an attempt to try and do some debugging on an issue I’m having with
minitest-chef-handler runs, I’m hoping I can get some good advice on
getting a better handle on exception handling and looking at stack traces.

The issue I’m having is at
https://github.com/calavera/minitest-chef-handler/issues/34 which gives
a slightly more detailed account of the problem I’m having, but I’m
hoping the techniques learned will be useful in other areas in the future.

The main issue is that the stacktrace I get when I do a chef run doesn’t
show me anything too interesting. It almost seems like something is
buried in the run that I can’t access, or isn’t being raised as an
exception except closer to the top of the stack.

In the file resource of Chef 10.14.4, something is calling ‘diff’
(https://github.com/opscode/chef/blob/master/chef/lib/chef/resource/file.rb#L85)
with 2 arguments, which causes the error – ArgumentError: wrong number
of arguments (2 for 1)

I’ve tried adding some additional 'raise’s to both minitest-chef-handler
and chef, building new gems and testing, and also adding Chef::Log and
such such, but I can’t seem to track down what the issue is. When I
attempt to add debugging output to minitest-chef-handler it seems to get
clobbered or hidden from my own view.

So after I’ve puked verbosity over this email, I’m hoping maybe someone
could give me some good pointers about adding logging data, or other
methods for tracking down exactly where this issue is. I’ve looked at
pry-rescue (https://github.com/ConradIrwin/pry-rescue) but haven’t been
able to modify Chef to work quite right.

I’d appreciate any help you can provide in showing me techniques for
tracking down the issue. I’d prefer someone to not just give the answer,
but rather provide information for how I might track down the issue.
Once tracked, I suspect the fix will be relatively trivial.

Thanks!
Leif.


Leif Madsen