git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Sohom Datta via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Sohom Datta <sohom.datta@learner.manipal.edu>
Subject: Re: [PATCH] Fix potential segfault on cloning invalid tag
Date: Fri, 30 Oct 2020 11:09:42 -0400	[thread overview]
Message-ID: <20201030150942.GB3282152@coredump.intra.peff.net> (raw)
In-Reply-To: <pull.906.git.git.1604058401991.gitgitgadget@gmail.com>

On Fri, Oct 30, 2020 at 11:46:41AM +0000, Sohom Datta via GitGitGadget wrote:

> From: Sohom Datta <sohom.datta@learner.manipal.edu>
> 
> Git allows users to create tags pointing to object hashes
> that may or may not be commits. When a tag that doesn't
> point to a commit is used with the -b (--branch) parameter
> of git clone, git segfaults as it assumes that the tag will
> always reference a commit.
> 
> Add a check to make sure that lookup_commit_reference returns a commit
> before detaching HEAD.

This seemed eerily familiar, so I dug up these threads:

  - https://lore.kernel.org/git/20191029092735.GA84120@carpenter.lan/

  - https://lore.kernel.org/git/20191101002432.GA49846@carpenter.lan/

The interesting things are:

  - there are some other cases where we might see a non-commit, which
    are also worth covering

  - it would be friendlier to the user to put in a fallback value for
    HEAD. We already transferred the whole history, so deleting it is a
    bit less friendly than leaving it in a state the user can recover
    from locally

I think the patches there were moving in a good direction, but it looks
like they just got stalled.

-Peff

  reply	other threads:[~2020-10-30 15:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-30 11:46 Sohom Datta via GitGitGadget
2020-10-30 15:09 ` Jeff King [this message]
2020-11-04 17:21 ` [PATCH v2] Avoid segfault and provide fallback when cloning invalid branch/tag Sohom Datta via GitGitGadget
2020-11-04 19:31   ` 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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20201030150942.GB3282152@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=sohom.datta@learner.manipal.edu \
    --subject='Re: [PATCH] Fix potential segfault on cloning invalid tag' \
    /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

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).