"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Alexander Arkhipov <aa@manpager.net>
Subject:
Re: bug/fix: segfault when diffing the root commit
To:
gameoftrees@openbsd.org
Date:
Tue, 06 Jun 2023 04:39:33 +0100

Download raw body.

Thread
Alexander Arkhipov <aa@manpager.net> wrote:

> Hello, gameoftrees@,
> 
> I noticed a bug in got, where typing `got -c <root commit> file' causes
> a segfault. The issue is caused by the NULL pointer tree being accessed
> in find_entry_by_name() in lib/object.c. I fixed the problem the obvious
> way by immediately returning NULL if tree is NULL. Now, however, it
> instead outputs error messages like this:
> 
> got: file: no such entry found in tree

Sorry, just realised my mistake here: the message only was like that
because the file I was testing with was not in the first commit,
although I assumed it was. Testing with the patch and a file that *was*
added with the first commit actually produces the correct result -- a
diff for that file!

Without the patch, however, the command always segfaults, regardless of
the file's existence at the time of the commit.

Alexander