All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>
Cc: Ilya K <me@0upti.me>, git@vger.kernel.org
Subject: Re: [bug] Segfault in git commit when a hook has a broken shebang
Date: Fri, 05 Aug 2022 10:04:46 +0200	[thread overview]
Message-ID: <220805.86pmhfru8a.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <YuzML2lVGDBIK1uF@danh.dev>


On Fri, Aug 05 2022, Đoàn Trần Công Danh wrote:

> On 2022-08-05 08:45:02+0300, Ilya K <me@0upti.me> wrote:
>> Hello! I ran into a weird bug just now that is probably easier to show than
>> explain:
>> ❯ git init
>> Initialized empty Git repository in /home/k900/test/.git/
>> ❯ echo '#!/usr/bin/oops' > .git/hooks/pre-commit
>> ❯ chmod +x .git/hooks/pre-commit
>> ❯ touch oops
>> ❯ git add oops
>> ❯ git commit -a
>> fatal: cannot run .git/hooks/pre-commit: No such file or directory
>> [1]    24580 segmentation fault (core dumped)  git commit -a
>> This happens consistently with git 2.37.x, and I don't think it happened
>> with git 2.36 or earlier.
>
> This seems to be a side-effect of a082345372, (hook API: fix v2.36.0
> regression: hooks should be connected to a TTY, 2022-06-07)
>
> Since it makes hooks run in "ungroup" manner, hence run-command will
> pass NULL as first argument to notify_start_failure.
>
> This patch seems to fix the crash, however, I think we should remove
> that clause entirely.

Yes, thanks. I'm already working on a patch for this with a test, will
send it in shortly...


  reply	other threads:[~2022-08-05  8:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05  5:45 [bug] Segfault in git commit when a hook has a broken shebang Ilya K
2022-08-05  7:52 ` Đoàn Trần Công Danh
2022-08-05  8:04   ` Ævar Arnfjörð Bjarmason [this message]
2022-08-05  8:24     ` Ævar Arnfjörð Bjarmason
2022-08-05 16:12       ` Emily Shaffer

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=220805.86pmhfru8a.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=congdanhqx@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=me@0upti.me \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.