From: Ilya K Date: Sat, 31 Aug 2024 06:46:10 GMT Subject: git 2.46.0 crashes when trying to verify-pack outside of a repo 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=, prefix=)     at builtin/index-pack.c:1883 1883                    read_idx_option(&opts, index_name); #3  0x000000000040651d in run_builtin (argv=0x7fffffffd270, argc=3, p=0x7a0560 )     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=, argc@entry=4, argv=,     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 `. If you need any more information, please contact me. Thanks in advance! [0]: https://github.com/jelmer/dulwich/issues/1359