go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.08k stars 5.41k forks source link

slice bounds out of range in function: /modules/git.newSignatureFromCommitline #28840

Closed h7su closed 7 months ago

h7su commented 7 months ago

Description

create a mirror from linux kernel repo, it clone the repo to disk successful but prompt "panic: runtime error: slice bounds out of range [:-1]" on the web. then i use cmd: gitea.exe admin repo-sync-releases, it show below log:

2024/01/18 15:02:39 .../setting/security.go:168:loadSecurityFrom() [W] Enabling Query API Auth tokens is not recommended. DISABLE_QUERY_AUTH_TOKEN will default to true in gitea 1.23 and will be removed in gitea 1.24. panic: runtime error: slice bounds out of range [:-1]

goroutine 1 [running]: code.gitea.io/gitea/modules/git.newSignatureFromCommitline({0xc001ebacb8, 0x0, 0x20}) /source/modules/git/signature_gogit.go:37 +0x3fa code.gitea.io/gitea/modules/git.parseTagRef(0xc001ebafd8?) /source/modules/git/repo_tag.go:184 +0x22f code.gitea.io/gitea/modules/git.(Repository).GetTagInfos(0xc001cba1e0, 0x0, 0x3a071c5?) /source/modules/git/repo_tag.go:142 +0x7fc code.gitea.io/gitea/modules/repository.pullMirrorReleaseSync({0x4b4c9f0, 0xc000d4bcc0}, 0xc0020c6800, 0x27?) /source/modules/repository/repo.go:502 +0x114 code.gitea.io/gitea/modules/repository.SyncReleasesWithTags({0x4b4c9f0?, 0xc000d4bcc0}, 0xc0020c6800, 0xc001cba1e0) /source/modules/repository/repo.go:294 +0x18a code.gitea.io/gitea/cmd.runRepoSyncReleases(0xc00045d720?) /source/cmd/admin.go:392 +0x5ca code.gitea.io/gitea/cmd.prepareSubcommandWithConfig.prepareWorkPathAndCustomConf.func1(0x2f16c00?) /source/cmd/main.go:117 +0x1ec github.com/urfave/cli/v2.(Command).Run(0x2f16c00, 0xc000ebd380, {0xc0001260e0, 0x1, 0x1}) /go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/command.go:274 +0x998 github.com/urfave/cli/v2.(Command).Run(0x2f18d00, 0xc000ebd080, {0xc0001eb200, 0x2, 0x2}) /go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/command.go:267 +0xbe5 github.com/urfave/cli/v2.(Command).Run(0xc001bf78c0, 0xc000ebcdc0, {0xc000194140, 0x3, 0x4}) /go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/command.go:267 +0xbe5 github.com/urfave/cli/v2.(App).RunContext(0xc0009683c0, {0x4b4c780?, 0x6960640}, {0xc000194140, 0x3, 0x4}) /go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/app.go:332 +0x5b7 github.com/urfave/cli/v2.(App).Run(...) /go/pkg/mod/github.com/urfave/cli/v2@v2.25.7/app.go:309 code.gitea.io/gitea/cmd.RunMainApp(0xc0009683c0, {0xc000194140?, 0xc0020530e0?, 0x4a?}) /source/cmd/main.go:176 +0x39 main.main() /source/main.go:46 +0x79

Gitea Version

1.21.4

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

v1.21.4 is downloaded from github release,and used in win11x64

Database

SQLite

yp05327 commented 7 months ago

Want to confirm:

  1. It seems that you are using gogit version.
  2. When creating the mirror, did you select migrate the releases?
h7su commented 7 months ago
  1. Yes,I didn't know there is another gitea before your answer, now I try the no gogit version, it works good, no error.
  2. When i use the 'import outside repo' function from top-right, I just check 'use it as a mirror' , not seen 'migrate the releases'.
  3. So, should this issue be treat as a bug?
yp05327 commented 7 months ago

now I try the no gogit version, it works good, no error.

So only gogit version has this issue. Thanks for your test.

When i use the 'import outside repo' function from top-right, I just check 'use it as a mirror' , not seen 'migrate the releases'.

OK

So, should this issue be treat as a bug?

Not sure. Maybe caused by some special tags in this repo, like https://github.com/go-gitea/gitea/issues/28843#issuecomment-1898213975

yp05327 commented 7 months ago

OK, I got it. image

yp05327 commented 7 months ago

The reason is that the creator is empty in tag v2.6.13-rc3 image

lunny commented 7 months ago

The reason is that the creator is empty in tag v2.6.13-rc3 image

So we have to use a ghost here if creator is empty.

github-actions[bot] commented 6 months ago

Automatically locked because of our CONTRIBUTING guidelines