git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org, Mike Hommey <mh@glandium.org>
Subject: Re: [2.46 regression] git ls-remote crash with import remote-helper
Date: Sat, 27 Jul 2024 20:54:13 -0700	[thread overview]
Message-ID: <xmqqle1mrx22.fsf@gitster.g> (raw)
In-Reply-To: <20240727191917.p64ul4jybpm2a7hm@glandium.org> (Mike Hommey's message of "Sun, 28 Jul 2024 04:19:17 +0900")

Mike Hommey <mh@glandium.org> writes:

> Running `git ls-remote $helper::$url` crashes when run outside a git
> repo and the helper uses the import feature.
>
> Here is a minimal reproducer:
> ```
> $ cat > git-remote-foo <<EOF
> #!/bin/sh
> echo import
> echo refspec '*:*'
> EOF
> $ chmod +x git-remote-foo
> $ PATH=$PWD:$PATH git ls-remote foo::bar
> ```
>
> The crash happens in parse_refspec in refspec.c, on a deref of the_hash_algo,
> because the_hash_also is not set anymore at that point since c8aed5e8da.

Thanks for a report, Mike.

Patrick, we have expected reports like this when we did c8aed5e8
(repository: stop setting SHA1 as the default object hash,
2024-05-07), so it is not very surprising.  In general, I think any
command that is designed to be usable outside a repository should
continue to fall back and use SHA-1, at least for now.  A command
like ls-remote _might_ want to do even better by waiting until it
has a chance to inspect what the other side said before setting the
hash-algo, or even better is to make it work without having any
concrete value in the hash-algo.  After all, when SHA-256
repositories become common out in the world, you should be able to
say ls-remote against them from your SHA-1 repository and the fact
that the hash-algo is read from local repository and set to SHA-1
should *not* negatively affect our ability to receive the ls-remote
response from SHA-256 repositories.  But that are all for longer
term future.  At least assuming SHA-1 like we have always done
should be better than the current situation.

Thanks.



  reply	other threads:[~2024-07-28  3:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-27 19:19 [2.46 regression] git ls-remote crash with import remote-helper Mike Hommey
2024-07-28  3:54 ` Junio C Hamano [this message]
2024-07-29 15:41   ` Patrick Steinhardt
2024-07-29 17:18     ` Junio C Hamano
2024-08-02  4:44 ` [PATCH] builtin/ls-remote: fall back to SHA1 outside of a repo Patrick Steinhardt
2024-08-02 15:26   ` Junio C Hamano

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=xmqqle1mrx22.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=mh@glandium.org \
    --cc=ps@pks.im \
    /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).