Skip to content

SIGSEGV when pushing sha256 repository #30975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
AdamMajer opened this issue May 14, 2024 · 8 comments
Closed

SIGSEGV when pushing sha256 repository #30975

AdamMajer opened this issue May 14, 2024 · 8 comments
Labels

Comments

@AdamMajer
Copy link
Contributor

Description

When pushing a sha256 repository,

Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 399 bytes | 399.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: panic: runtime error: invalid memory address or nil pointer dereference
remote: [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x286caec]
remote: 
remote: goroutine 1 [running]:
remote: code.gitea.io/gitea/cmd.runHookPostReceive(0xc0006d3a80)
remote: 	/home/adamm/work/alp/gitea/gitea/cmd/hook.go:381 +0xd0c
remote: code.gitea.io/gitea/cmd.prepareSubcommandWithConfig.prepareWorkPathAndCustomConf.func1(0xc0006d3a80)
remote: 	/home/adamm/work/alp/gitea/gitea/cmd/main.go:111 +0x1e3
remote: github.com/urfave/cli/v2.(*Command).Run(0x5901be0, 0xc0006d3a80, {0xc001a12350, 0x1, 0x1})
remote: 	/home/adamm/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:279 +0x97d
remote: github.com/urfave/cli/v2.(*Command).Run(0x5901ea0, 0xc000164580, {0xc001e1c150, 0x3, 0x3})
remote: 	/home/adamm/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:272 +0xbb7
remote: github.com/urfave/cli/v2.(*Command).Run(0xc001e10160, 0xc000164240, {0xc0000520c0, 0x4, 0x4})
remote: 	/home/adamm/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:272 +0xbb7
remote: github.com/urfave/cli/v2.(*App).RunContext(0xc001e0a000, {0x3b952f8, 0x5d33fc0}, {0xc0000520c0, 0x4, 0x4})
remote: 	/home/adamm/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:337 +0x58b
remote: github.com/urfave/cli/v2.(*App).Run(...)
remote: 	/home/adamm/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:311
remote: code.gitea.io/gitea/cmd.RunMainApp(0xc001e0a000, {0xc0000520c0?, 0xc001b9a410?, 0xc0000061c0?})
remote: 	/home/adamm/work/alp/gitea/gitea/cmd/main.go:172 +0x39
remote: main.main()
remote: 	/home/adamm/work/alp/gitea/gitea/main.go:46 +0x79

Gitea Version

1.22rc1

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

git version 2.43.0

Operating System

openSUSE Tumbleweed

How are you running Gitea?

Running as test instance from git source archive.

Database

SQLite

@AdamMajer
Copy link
Contributor Author

I don't see this error in main branch, so it's fixed there.

@wxiaoguang
Copy link
Contributor

I did some following up fixes like #30877 (and it has been backported)

could you try 1.22 nightly?

@AdamMajer
Copy link
Contributor Author

Where is the 1.22 nightly?

The change looks like version checks only which should not be an issue. But I'll find what fixed it :-)

@AdamMajer
Copy link
Contributor Author

Gitea in release/v1.22 seems to work.

@wxiaoguang
Copy link
Contributor

Where is the 1.22 nightly?

Get 1.22 nightly:

Gitea in release/v1.22 seems to work.

Yup, I think it has been fixed by the way.

@wxiaoguang
Copy link
Contributor

Gitea in release/v1.22 seems to work.

So I guess this issue could be closed as completed? 🤔

@AdamMajer
Copy link
Contributor Author

I did some following up fixes like #30877 (and it has been backported)

Confirmed, it's fixed by this PR. Thanks!

@AdamMajer
Copy link
Contributor Author

Just to add some background here as to the reason this was happening, if someone else stumbles on this here,

  1. sha256 support is conditional on newer git tools version
  2. this check is run as part of InitFull() but not part of InitSimple()
  3. InitSimple() was only run when gitea commands/hooks are run.
  4. The patch mentioned above checks the git version always, not just in the main process.
  5. CommitID parser doesn't have an error handler in this codepath hence SIGSEGV.

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants