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

Re: [PATCH 5/5] path.c: don't call the match function without value in trie_find()

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 23, 2019, 04:01 UTC
Message-ID
<xmqqa79si003.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20191021205703.GB4348@szeder.dev>
SZEDER Gábor <szeder.dev@gmail.com> writes:
Show 11 quoted lines
>>   - b9317d55a3 added two new keys to the trie: 'logs/refs/rewritten'
>>     and 'logs/refs/worktree', next to the already existing
>>     'logs/refs/bisect'.  This resulted in a trie node with the path
>>     'logs/refs', which didn't exist before, and which doesn't have a
>
> Oops, I missed the trailing slash, that must be 'logs/refs/'!
>
>>     value attached.  A query for 'logs/refs/' finds this node and then
>>     hits that one callsite of the match function which doesn't check
>>     for the value's existence, and thus invokes the match function
>>     with NULL as value.

Given that the trie is maintained by hand in common_list[], I wonder if we can mechanically catch errors like the one b9317d55a3 added, by perhaps having a self-test function that a t/helper/ program calls to perform consistency check after the "git" gets built.

Thanks.
Previous: SZEDER GáborNext: SZEDER Gábor
Message 9 of 14 in “path.c: a couple of common dir/trie fixes”
  1. 0/5 path.c: a couple of common dir/trie fixesSZEDER Gábor, Oct 21, 2019
  2. 1/5 Documentation: mention more worktree-specific exceptionsSZEDER Gábor, Oct 21, 2019
  3. 3/5 path.c: mark 'logs/HEAD' in 'common_list' as fileSZEDER Gábor, Oct 21, 2019
  4. 2/5 path.c: clarify trie_find()'s in-code commentSZEDER Gábor, Oct 21, 2019
  5. 4/5 path.c: clarify two field names in 'struct common_dir'SZEDER Gábor, Oct 21, 2019
  6. 5/5 path.c: don't call the match function without value in trie_find()SZEDER Gábor, Oct 21, 2019
  7. David TurnerOct 21, 2019
  8. SZEDER GáborOct 21, 2019
  9. Junio C HamanoOct 23, 2019
  10. SZEDER GáborOct 23, 2019
  11. Junio C HamanoOct 24, 2019
  12. Johannes SchindelinOct 28, 2019
  13. SZEDER GáborOct 28, 2019
  14. Johannes SchindelinOct 28, 2019

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.