threads / discuss / 62922

git log --graph --no-graph can cause segfault

Subject: git log --graph --no-graph can cause segfault

## tl;dr

3 messages between Feb 8, 2025 and Feb 8, 2025.

replies: 2people: 2as markdown or json

Emily Klassen· Feb 8, 2025, 03:34 UTC · lore
> What did you do before the bug happened? (Steps to reproduce your issue)

$ git config --get alias.l log --pretty=oneline --abbrev-commit --decorate --graph

$ git --no-pager l --reverse --no-graph --name-status e83c516331 Initial revision of "git", the information manager from hell error: git died of signal 11

> What did you expect to happen? (Expected behavior)
I expect the commit listing to display successfully.
> What happened instead? (Actual behavior)

Git seems to have crashed. My best guess is that some state gets set with the first `--graph` flag which is not cleared with the `--no-graph` flag.

> What's different between what you expected and what actually happened?
Git crashed.
> Anything else you want to add:
I also tried to manually expand the alias with

$ git --no-pager log --pretty=oneline --abbrev-commit --decorate --graph HEAD --reverse --no-graph --name-status e83c516331 Initial revision of "git", the information manager from hell

$ echo $? 139

Which indicates a segfault.
The below command works properly

$ git log --pretty=oneline --abbrev-commit --decorate HEAD --reverse --name-status

but obviously, the intent is to be able to use my `l` alias with the `--reverse` flag by disabling `--graph`. My workaround is to create a `lr` alias which replaces `--graph` with `--reverse`.

I also tested "git log --graph --no-graph --name-only" and "--patch" and "--name-status", and all of those failed, without even specifying "--reverse"

Also verified by building `git` from the `next` branch.
> Please review the rest of the bug report below.
> You can delete any lines you don't wish to share.

[System Info] git version: git version 2.48.1 cpu: arm64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh feature: fsmonitor--daemon libcurl: 8.7.1 zlib: 1.2.12 uname: Darwin 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64 compiler info: clang: 16.0.0 (clang-1600.0.26.6) libc info: no libc information available $SHELL (typically, interactive shell): /bin/zsh

[Enabled Hooks]
~ Emily Marigold Klassen
Đoàn Trần Công Danh· Feb 8, 2025, 04:44 UTC · re: Emily Klassen · lore

Re: git log --graph --no-graph can cause segfault

On 2025-02-07 19:34:11-0800, Emily Klassen <forivall@gmail.com> wrote:
Show 21 quoted lines
> > What did you do before the bug happened? (Steps to reproduce your issue)
> 
> $ git config --get alias.l
> log --pretty=oneline --abbrev-commit --decorate --graph
> 
> $ git --no-pager l --reverse --no-graph --name-status
> e83c516331 Initial revision of "git", the information manager from hell
> error: git died of signal 11
> 
> > What did you expect to happen? (Expected behavior)
> 
> I expect the commit listing to display successfully.
> 
> > What happened instead? (Actual behavior)
> 
> Git seems to have crashed. My best guess is that some state gets set with the
> first `--graph` flag which is not cleared with the `--no-graph` flag.
> 
> > What's different between what you expected and what actually happened?
> 
> Git crashed.

Given commands yields: "fatal: Out of memory, realloc failed" in my system. But it's fixed by jk/combine-diff-cleanup, which is merged into master.

Would you try to run from master branch to see if your problem has been fixed?

-- 
Danh
Emily Klassen· Feb 8, 2025, 05:51 UTC · re: Đoàn Trần Công Danh · lore

Re: git log --graph --no-graph can cause segfault

Yup, I built on `next` and it's still resulting in the segfault. However, I did end up figuring out the issue, and I'm sending a proper patch momentarily. Basically "revs->diffopt.output_prefix_data" needs to be nulled in the "--no-graph" argument parser in revision.c

~ Emily Marigold Klassen
On Fri, Feb 7, 2025 at 8:45 PM Đoàn Trần Công Danh <congdanhqx@gmail.com> wrote:
Show 33 quoted lines
>
> On 2025-02-07 19:34:11-0800, Emily Klassen <forivall@gmail.com> wrote:
> > > What did you do before the bug happened? (Steps to reproduce your issue)
> >
> > $ git config --get alias.l
> > log --pretty=oneline --abbrev-commit --decorate --graph
> >
> > $ git --no-pager l --reverse --no-graph --name-status
> > e83c516331 Initial revision of "git", the information manager from hell
> > error: git died of signal 11
> >
> > > What did you expect to happen? (Expected behavior)
> >
> > I expect the commit listing to display successfully.
> >
> > > What happened instead? (Actual behavior)
> >
> > Git seems to have crashed. My best guess is that some state gets set with the
> > first `--graph` flag which is not cleared with the `--no-graph` flag.
> >
> > > What's different between what you expected and what actually happened?
> >
> > Git crashed.
>
> Given commands yields: "fatal: Out of memory, realloc failed" in my
> system. But it's fixed by jk/combine-diff-cleanup, which is merged
> into master.
>
> Would you try to run from master branch to see if your problem has
> been fixed?
>
> --
> Danh

← back to recent threads