Skip to content

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

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
h7su opened this issue Jan 18, 2024 · 7 comments · Fixed by #29054
Closed

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

h7su opened this issue Jan 18, 2024 · 7 comments · Fixed by #29054
Labels

Comments

@h7su
Copy link

h7su commented Jan 18, 2024

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/[email protected]/command.go:274 +0x998
github.com/urfave/cli/v2.(*Command).Run(0x2f18d00, 0xc000ebd080, {0xc0001eb200, 0x2, 0x2})
/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:267 +0xbe5
github.com/urfave/cli/v2.(*Command).Run(0xc001bf78c0, 0xc000ebcdc0, {0xc000194140, 0x3, 0x4})
/go/pkg/mod/github.com/urfave/cli/[email protected]/command.go:267 +0xbe5
github.com/urfave/cli/v2.(*App).RunContext(0xc0009683c0, {0x4b4c780?, 0x6960640}, {0xc000194140, 0x3, 0x4})
/go/pkg/mod/github.com/urfave/cli/[email protected]/app.go:332 +0x5b7
github.com/urfave/cli/v2.(*App).Run(...)
/go/pkg/mod/github.com/urfave/cli/[email protected]/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

@h7su h7su added the type/bug label Jan 18, 2024
@yp05327
Copy link
Contributor

yp05327 commented Jan 18, 2024

Want to confirm:

  1. It seems that you are using gogit version.
  2. When creating the mirror, did you select migrate the releases?

@h7su
Copy link
Author

h7su commented Jan 18, 2024

  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
Copy link
Contributor

yp05327 commented Jan 18, 2024

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 #28843 (comment)

@yp05327
Copy link
Contributor

yp05327 commented Jan 19, 2024

OK, I got it.
image

@yp05327
Copy link
Contributor

yp05327 commented Jan 19, 2024

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

@lunny
Copy link
Member

lunny commented Feb 4, 2024

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.

wxiaoguang added a commit that referenced this issue Feb 9, 2024
Replace #28849. Thanks to @yp05327 for the looking into the problem.
Fix #28840

The old behavior of newSignatureFromCommitline is not right. The new
parseSignatureFromCommitLine:

1. never fails
2. only accept one format (if there is any other, it could be easily added)

And add some tests.
wxiaoguang added a commit to wxiaoguang/gitea that referenced this issue Feb 9, 2024
Replace go-gitea#28849. Thanks to @yp05327 for the looking into the problem.
Fix go-gitea#28840

The old behavior of newSignatureFromCommitline is not right. The new
parseSignatureFromCommitLine:

1. never fails
2. only accept one format (if there is any other, it could be easily added)

And add some tests.
KN4CK3R pushed a commit that referenced this issue Feb 9, 2024
Backport #29054. Fix #28840

This backport is for 1.21 only and it is different from the change in
1.22: this backport still accept the legacy date format to avoid
breaking.
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
Replace go-gitea#28849. Thanks to @yp05327 for the looking into the problem.
Fix go-gitea#28840

The old behavior of newSignatureFromCommitline is not right. The new
parseSignatureFromCommitLine:

1. never fails
2. only accept one format (if there is any other, it could be easily added)

And add some tests.
6543 pushed a commit to 6543-forks/gitea that referenced this issue Feb 26, 2024
Replace go-gitea#28849. Thanks to @yp05327 for the looking into the problem.
Fix go-gitea#28840

The old behavior of newSignatureFromCommitline is not right. The new
parseSignatureFromCommitLine:

1. never fails
2. only accept one format (if there is any other, it could be easily added)

And add some tests.

(cherry picked from commit a24e1da)
Copy link

Automatically locked because of our CONTRIBUTING guidelines

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
3 participants