git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/2] Debugging tools for get_pathname()
@ 2011-09-27  4:28 Michael Haggerty
  2011-09-27  4:28 ` [RFC 1/2] Make the number of pathname buffers a compile-time constant Michael Haggerty
  2011-09-27  4:28 ` [RFC 2/2] Make misuse of get_pathname() buffers detectable by valgrind Michael Haggerty
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Haggerty @ 2011-09-27  4:28 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Petr Baudis, Michael Haggerty

I just wasted a bunch of time diagnosing a problem that was caused by
other code's misuse of a temporary buffer created by get_pathname()
(patch forthcoming).  The bug was triggered by totally unrelated (and
innocent) code changes that I had made.  I found it quite difficult to
figure out the source of the problem.

It is probably obvious to everybody else, but here are the two tricks
that finally enabled me to diagnose the problem:

1. I increased the number of temporary buffers available to
   get_pathname().  This made the test suite failure go away, which
   was a good indication that the problem was related to the buffers.

2. I changed get_pathname() to allocate and free the buffers instead
   of using statically-allocated buffers.  This made it trivial to
   find the offender using valgrind.

This patch series make it easier to apply these tricks.  I hope it
helps somebody else avoid the pain that I just experienced.

Michael Haggerty (2):
  Make the number of pathname buffers a compile-time constant
  Make misuse of get_pathname() buffers detectable by valgrind

 path.c |   43 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 41 insertions(+), 2 deletions(-)

-- 
1.7.7.rc2

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-16 14:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-27  4:28 [RFC 0/2] Debugging tools for get_pathname() Michael Haggerty
2011-09-27  4:28 ` [RFC 1/2] Make the number of pathname buffers a compile-time constant Michael Haggerty
2011-09-27  4:28 ` [RFC 2/2] Make misuse of get_pathname() buffers detectable by valgrind Michael Haggerty
2011-11-16 13:57   ` Nguyen Thai Ngoc Duy
2011-11-16 14:18   ` Nguyen Thai Ngoc Duy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).