git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC 0/2] Debugging tools for get_pathname()

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Sep 27, 2011, 04:28 UTC
Message-ID
<1317097687-11098-1-git-send-email-mhagger@alum.mit.edu>

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
Next: Michael Haggerty
Message 1 of 5 in “[RFC 0/2] Debugging tools for get_pathname()”
  1. Michael HaggertySep 27, 2011
  2. 1/2 Make the number of pathname buffers a compile-time constantMichael Haggerty, Sep 27, 2011
  3. 2/2 Make misuse of get_pathname() buffers detectable by valgrindMichael Haggerty, Sep 27, 2011
  4. Nguyen Thai Ngoc DuyNov 16, 2011
  5. Nguyen Thai Ngoc DuyNov 16, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.