SIGSEGV when pushing sha256 repository #12994

Closed
opened 2025-11-02 10:27:08 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @AdamMajer on GitHub (May 14, 2024).

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/v2@v2.27.1/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/v2@v2.27.1/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/v2@v2.27.1/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/v2@v2.27.1/app.go:337 +0x58b
remote: github.com/urfave/cli/v2.(*App).Run(...)
remote: 	/home/adamm/go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/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

Originally created by @AdamMajer on GitHub (May 14, 2024). ### 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/v2@v2.27.1/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/v2@v2.27.1/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/v2@v2.27.1/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/v2@v2.27.1/app.go:337 +0x58b remote: github.com/urfave/cli/v2.(*App).Run(...) remote: /home/adamm/go/pkg/mod/github.com/urfave/cli/v2@v2.27.1/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
GiteaMirror added the type/bug label 2025-11-02 10:27:08 -06:00
Author
Owner

@AdamMajer commented on GitHub (May 14, 2024):

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

@AdamMajer commented on GitHub (May 14, 2024): I don't see this error in `main` branch, so it's fixed there.
Author
Owner

@wxiaoguang commented on GitHub (May 14, 2024):

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

could you try 1.22 nightly?

@wxiaoguang commented on GitHub (May 14, 2024): I did some following up fixes like #30877 (and it has been backported) could you try 1.22 nightly?
Author
Owner

@AdamMajer commented on GitHub (May 14, 2024):

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 commented on GitHub (May 14, 2024): 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 :-)
Author
Owner

@AdamMajer commented on GitHub (May 14, 2024):

Gitea in release/v1.22 seems to work.

@AdamMajer commented on GitHub (May 14, 2024): Gitea in `release/v1.22` seems to work.
Author
Owner

@wxiaoguang commented on GitHub (May 14, 2024):

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 commented on GitHub (May 14, 2024): > Where is the 1.22 nightly? Get 1.22 nightly: * https://hub.docker.com/r/gitea/gitea/tags?page=&page_size=&ordering=&name=1.22-nightly * https://dl.gitea.com/gitea/1.22/ ( @techknowlogick would you like to rename it to 1.22-nightly for consistency?) > Gitea in release/v1.22 seems to work. Yup, I think it has been fixed by the way.
Author
Owner

@wxiaoguang commented on GitHub (May 14, 2024):

Gitea in release/v1.22 seems to work.

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

@wxiaoguang commented on GitHub (May 14, 2024): > Gitea in `release/v1.22` seems to work. So I guess this issue could be closed as completed? 🤔
Author
Owner

@AdamMajer commented on GitHub (May 14, 2024):

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

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

@AdamMajer commented on GitHub (May 14, 2024): > I did some following up fixes like #30877 (and it has been backported) Confirmed, it's fixed by this PR. Thanks!
Author
Owner

@AdamMajer commented on GitHub (May 16, 2024):

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.
@AdamMajer commented on GitHub (May 16, 2024): 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12994