Re: bug: invalid sha1 pointer in cache-tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Joel, hopefully someone can correct me for being wrong about this ;)

On Thu, Oct 28, 2021 at 10:57 PM Joel Stanley <joel@xxxxxxxxx> wrote:
>
> Hello,
>
> I've filled out git-bugreport after discussing this issue with a git
> developer. I'm not sure if it's user error, disk corruption, or a bug
> in git. Any insight would be appreciated!
>
> What did you do before the bug happened? (Steps to reproduce your issue)
>
> I was attempting to merge a tag into the current branch. Before I did so, I
> reset'd away a commit I didn't want:
>
> $ git reset HEAD~1 --hard
> error: Could not read 7c03aa457205afa2def273129653bea6225c5a0a
> HEAD is now at 387b8b425339 spi: fsi: Print status on error

I suspect you already had problems from this point, regardless of what
came after. What's surprising to me, though, is that the object 7c03aa
would be missing, since it should have been referred to by the current
branch you were trying to merge into.

Is it possible you were doing something slightly odd, like partial
clone, shallow clone, or working in detached-HEAD for some reason? You
didn't mention here that you had been rm-ing things in .git/, and I
asked you explicitly about that when we spoke offline, but that also
would worry me.

Regardless, I think once you've got a missing object and 'git fsck'
fails, there aren't many promises we can make about correct behavior
after, so I'm not sure I have anything to say on the rest of the
report, unfortunately.


> Anything else you want to add:
>
> I have tree git trees involved:
>
> linus, a clone of torvald's tree
> stable, a bare clone of the stable tree. it was cloned with a
> --reference to linus
> openbmc, a clone of a kernel tree that has a --reference to both
> stable and linus.

Ah, this is a hint and may actually be the winner... When you're
cloning with --reference, the "referenced" repo doesn't know who is
referencing it, so it sometimes can gc with abandon and delete
something you cared about in a referencing repo.

The workarounds here range from "if you care only about network speed,
reclone with --reference --dissociate" to "if you care about network
speed *and* disk space, do something fancy with 'git worktree' and
multiple remotes" to "if you care about disk space *and* you care
about insulating objects from accidentally going to the wrong remote,
get a bigger disk and use --reference --dissociate anyway".

>
> I did a fsck and saw this:
>
> error: 7c03aa457205afa2def273129653bea6225c5a0a: invalid sha1 pointer
> in cache-tree
> broken link from    tree 385b33c97554b2ab43b7dea822b34e10e9d7ce66 (:)
>               to    tree 7c03aa457205afa2def273129653bea6225c5a0a (:configs/)
>
>
> I have since tried re-fetching all three repositories in turn, and
> this had no change:
>
> git fetch-pack --all https://github.com/openbmc/linux
> git fetch-pack --all
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> git fetch-pack --all
> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
>
> I also tried removing and re-cloning the stable tree (an the assumption that
> this is where the objects that make up the problematic v5.14.14 tag should come
> from), but this did not help. I have however changed the output of git fsck:
>
> $ git merge v5.14.14
> fatal: unable to read tree 385b33c97554b2ab43b7dea822b34e10e9d7ce66

Yeah, I think this is the final decisive pointer to "this is an issue
with stable as an alternate to your other stuff" - I'd guess that the
object that's missing changed because the alternate links broke in
some way.

>
> $ git fsck
> ...
> error: 385b33c97554b2ab43b7dea822b34e10e9d7ce66: invalid sha1 pointer
> in cache-tree
> broken link from    tree 61a337aed7681b506b935b507a422fc5983ba4f3 (:)
>               to    tree 385b33c97554b2ab43b7dea822b34e10e9d7ce66 (:powerpc/)
>
>
> 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.33.0
> cpu: x86_64
> no commit associated with this build
> sizeof-long: 8
> sizeof-size_t: 8
> shell-path: /bin/sh
> uname: Linux 5.14.0-2-amd64 #1 SMP Debian 5.14.9-2 (2021-10-03) x86_64
> compiler info: gnuc: 10.2
> libc info: glibc: 2.33
> $SHELL (typically, interactive shell): /bin/bash
>
>
> [Enabled Hooks]
>
> Cheers,
>
> Joel



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux