git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilya K <me@0upti.me>
To: git@vger.kernel.org
Subject: git 2.46.0 crashes when trying to verify-pack outside of a repo
Date: Sat, 31 Aug 2024 09:46:10 +0300	[thread overview]
Message-ID: <14ec9394-a7ea-456c-800a-6a84c52e5cda@0upti.me> (raw)

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


             reply	other threads:[~2024-08-31  6:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-31  6:46 Ilya K [this message]
2024-09-01 15:26 ` git 2.46.0 crashes when trying to verify-pack outside of a repo Junio C Hamano
2024-09-01 23:45   ` Patrick Steinhardt
2024-09-02 13:18     ` brian m. carlson
2024-09-02 13:47       ` Patrick Steinhardt
2024-09-03 15:52         ` Junio C Hamano
2024-09-04  6:26 ` [PATCH] builtin/index-pack: fix segfaults when running " Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14ec9394-a7ea-456c-800a-6a84c52e5cda@0upti.me \
    --to=me@0upti.me \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).