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

git 2.46.0 crashes when trying to verify-pack outside of a repo

From
IKIlya K <me@0upti.me>
Date
Aug 31, 2024, 06:46 UTC
Message-ID
<14ec9394-a7ea-456c-800a-6a84c52e5cda@0upti.me>
Hello folks!
We've updated to Git 2.46.0 in NixOS, and encountered an issue with Dulwich (a Python Git implementation) tests failing[0] because it attempts to call `git verify-pack` on a bare pack, with no surrounding repo. This used to work in Git 2.45.x, but in 2.46 it simply prints "error: index-pack died of signal 11". This seems to happen on any pack, including ones generated by Git itself (at least on a random pack from a random checkout I tested).
Here's a traceback from the crash:
    (gdb) bt
    #0  0x00000000005d93ef in add_packed_git (
        path=path@entry=0x7dd8f0 "pack-a94057e69dcef307b749cd32232e845c48bb32c9.idx", path_len=45,
        local=local@entry=1) at packfile.c:754
    754             if (path_len < the_hash_algo->hexsz ||
    #1  0x000000000046bd38 in read_idx_option (
        pack_name=0x7dd8f0 "pack-a94057e69dcef307b749cd32232e845c48bb32c9.idx", opts=0x7fffffffcd00)
        at builtin/index-pack.c:1652
    1652            struct packed_git *p = add_packed_git(pack_name, strlen(pack_name), 1);
    #2  cmd_index_pack (argc=3, argv=<optimized out>, prefix=<optimized out>)
        at builtin/index-pack.c:1883
    1883                    read_idx_option(&opts, index_name);
    #3  0x000000000040651d in run_builtin (argv=0x7fffffffd270, argc=3, p=0x7a0560 <commands+1344>)
        at git.c:476
    476             status = p->fn(argc, argv, prefix);
    #4  handle_builtin (argc=3, argv=0x7fffffffd270) at git.c:732
    732                     exit(run_builtin(builtin, argc, argv));
    #5  0x0000000000407690 in run_argv (argcp=argcp@entry=0x7fffffffd04c,
        argv=argv@entry=0x7fffffffd040) at git.c:796
    796                             handle_builtin(*argcp, *argv);
    #6  0x000000000040812c in cmd_main (argc=<optimized out>, argc@entry=4, argv=<optimized out>,
        argv@entry=0x7fffffffd268) at git.c:931
    931                     int was_alias = run_argv(&argc, &argv);
    #7  0x00000000004061fd in main (argc=4, argv=0x7fffffffd268) at common-main.c:64
    64              result = cmd_main(argc, argv);
It seems like `the_hash_algo` (which, AFAIUI, is macroed to `the_repository->hash_algo`) may be uninitialized here, but I'm not familiar enough with the codebase to really tell if that's the issue.
If you want to reproduce it, simply copy any pack file from a repo's .git/objects/pack/ to a directory that's not a repo, then `git verify-pack <the-file-you-just-copied>`.
If you need any more information, please contact me.
Thanks in advance!
[0]: https://github.com/jelmer/dulwich/issues/1359
Next: Junio C Hamano
Message 1 of 7 in “git 2.46.0 crashes when trying to verify-pack outside of a repo”
  1. Ilya KAug 31, 2024
  2. Junio C HamanoSep 1, 2024
  3. Patrick SteinhardtSep 1, 2024
  4. brian m. carlsonSep 2, 2024
  5. Patrick SteinhardtSep 2, 2024
  6. Junio C HamanoSep 3, 2024
  7. builtin/index-pack: fix segfaults when running outside of a repoPatrick Steinhardt, Sep 4, 2024

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.