Skip to content
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

[Bug] gitea crash while squash-merging #13483

Closed
6543 opened this issue Nov 9, 2020 · 2 comments · Fixed by #13486
Closed

[Bug] gitea crash while squash-merging #13483

6543 opened this issue Nov 9, 2020 · 2 comments · Fixed by #13486
Labels

Comments

@6543
Copy link
Member

6543 commented Nov 9, 2020

gitea version: 1.14.0+dev-158-gc178a3643

to reproduce:

  1. create new test repo
  2. create master, dev branch
  3. protect branches (master, dev)
  4. make some pulls & merge to dev
  5. squash-merge dev to master
[Macaron] 2020-11-09 21:22:21: Started POST /api/internal/hook/pre-receive/test/squash for [::1]
[git-module] /home/6543/tmp/gitea_master/repositories/test/squash.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-list --max-count=1 0e9406b8e1229168bd3bbf8d63ecc481bcb940da ^a1225a7c6b38c0da7c83a14985a8fc533e652748
[Macaron] 2020-11-09 21:22:21: Completed POST /api/internal/hook/pre-receive/test/squash 200 OK in 13.035397ms
[Macaron] 2020-11-09 21:22:22: Started POST /api/internal/hook/post-receive/test/squash for [::1]
[Macaron] 2020-11-09 21:22:22: Completed POST /api/internal/hook/post-receive/test/squash 200 OK in 8.190653ms
[Macaron] 2020-11-09 21:22:22: Completed POST /test/squash/pulls/3/merge 302 Found in 597.512363ms
[Macaron] 2020-11-09 21:22:22: Started GET /test/squash/pulls/3 for 127.0.0.1
[git-module] /home/6543/tmp/gitea_master/repositories/test/squash.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-list --count a1225a7c6b38c0da7c83a14985a8fc533e652748
[git-module] stdout:
2

[git-module] /home/6543/tmp/gitea_master/repositories/test/squash.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= merge-base -- 0e9406b8e1229168bd3bbf8d63ecc481bcb940da refs/pull/3/head
[git-module] stdout:
0e9406b8e1229168bd3bbf8d63ecc481bcb940da

[git-module] /home/6543/tmp/gitea_master/repositories/test/squash.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= log 0e9406b8e1229168bd3bbf8d63ecc481bcb940da...refs/pull/3/head --pretty=format:%H
[git-module] stdout:
30ee358d13685d64e974a3bbf8a0e6c5a379f155
04806b46b14cda20923b3d7f7279f2c3476a7a15
12b451d950d0db3b81fa0cae73046cefc01d9dcc
42405e2b47de4deb625c8fabb4f4905f90641c91
37291966d67c91c0cd1861eafd9dee4eb68f59ec
[git-module] /home/6543/tmp/gitea_master/repositories/test/squash.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= diff -z --name-only 0e9406b8e1229168bd3bbf8d63ecc481bcb940da...refs/pull/3/head
[git-module] /home/6543/tmp/gitea_master/repositories/test/squash.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-list 0e9406b8e1229168bd3bbf8d63ecc481bcb940da...a1225a7c6b38c0da7c83a14985a8fc533e652748
[git-module] /home/6543/tmp/gitea_master/repositories/test/squash.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= config --get commit.gpgsign
[git-module] stdout:
a1225a7c6b38c0da7c83a14985a8fc533e652748

[git-module] /home/6543/tmp/gitea_master/repositories/test/squash.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-list --max-count=1 0e9406b8e1229168bd3bbf8d63ecc481bcb940da ^a1225a7c6b38c0da7c83a14985a8fc533e652748
[git-module] /home/6543/tmp/gitea_master/repositories/test/squash.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-parse --verify refs/heads/main
[git-module] stdout:
a1225a7c6b38c0da7c83a14985a8fc533e652748

[git-module] /home/6543/tmp/gitea_master/repositories/test/squash.git: /usr/bin/git -c credential.helper= -c protocol.version=2 -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= rev-list --count a1225a7c6b38c0da7c83a14985a8fc533e652748
[git-module] stdout:
2

panic: runtime error: slice bounds out of range [:603] with capacity 576

goroutine 12 [running]:
code.gitea.io/gitea/modules/references.FindAllIssueReferences(0xc0096a0240, 0x234, 0x457f29, 0x37b6c35, 0x8dd0b9)
        /home/6543/git/gitea/modules/references/references.go:269 +0x4b4
code.gitea.io/gitea/modules/repofiles.UpdateIssuesCommit(0xc00959db80, 0xc009169c20, 0xc009e862b0, 0x1, 0x1, 0xc008fca9cb, 0x4, 0xc00969edf0, 0xb)
        /home/6543/git/gitea/modules/repofiles/action.go:140 +0xf3
code.gitea.io/gitea/services/repository.commitRepoAction(0xc009169c20, 0xc0093f5b90, 0xc009e4e118, 0x1, 0x1, 0xc009611ea0, 0x0)
        /home/6543/git/gitea/services/repository/push.go:252 +0xb87
code.gitea.io/gitea/services/repository.pushUpdates(0xc009d864e0, 0x1, 0x1, 0x0, 0x0)
        /home/6543/git/gitea/services/repository/push.go:185 +0x23ca
code.gitea.io/gitea/services/repository.handle(0xc000348a00, 0x1, 0x14)
        /home/6543/git/gitea/services/repository/push.go:33 +0x87
code.gitea.io/gitea/modules/queue.(*WorkerPool).doWork(0xc001442080, 0x2cd89e0, 0xc001376600)
        /home/6543/git/gitea/modules/queue/workerpool.go:383 +0x896
code.gitea.io/gitea/modules/queue.(*WorkerPool).addWorkers.func1(0xc001442080, 0x2cd89e0, 0xc001376600)
        /home/6543/git/gitea/modules/queue/workerpool.go:238 +0x45
created by code.gitea.io/gitea/modules/queue.(*WorkerPool).addWorkers
        /home/6543/git/gitea/modules/queue/workerpool.go:237 +0x56
@6543 6543 added the type/bug label Nov 9, 2020
@zeripath
Copy link
Contributor

zeripath commented Nov 9, 2020

@6543 it would be helpful to see the commit message that breaks this.

@6543
Copy link
Member Author

6543 commented Nov 9, 2020

Merge pull request 'w-nooo' (#2) from fea1 into dev

Reviewed-on: #2
Reviewed-by: test2 <test2@test.test>

Merge branch 'dev' into fea1

w-nooo

Merge pull request 'feat2' (#1) from feat2 into dev

Reviewed-on: #1

feat2

Co-authored-by: test2 <test2@test.test>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: #3
Reviewed-by: test2 <test2@test.test>
Co-Authored-By: test <test@test.test>
Co-Committed-By: test <test@test.test>

zeripath added a commit to zeripath/gitea that referenced this issue Nov 9, 2020
The issue lay in determining the position of matches on a second run round
a commit message in FindAllIssueReferences.

Fix go-gitea#13483

Signed-off-by: Andrew Thornton <art27@cantab.net>
6543 pushed a commit to 6543-forks/gitea that referenced this issue Nov 9, 2020
The issue lay in determining the position of matches on a second run round
a commit message in FindAllIssueReferences.

Fix go-gitea#13483

Signed-off-by: Andrew Thornton <art27@cantab.net>
lafriks pushed a commit that referenced this issue Nov 9, 2020
* Fix panic bug in handling multiple references in commit

The issue lay in determining the position of matches on a second run round
a commit message in FindAllIssueReferences.

Fix #13483

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Extract function and make testable

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Fix the comment

Signed-off-by: Andrew Thornton <art27@cantab.net>

* cleaning up the comments a bit more

Signed-off-by: Andrew Thornton <art27@cantab.net>
techknowlogick pushed a commit that referenced this issue Nov 10, 2020
)

* Fix panic bug in handling multiple references in commit (#13486)

The issue lay in determining the position of matches on a second run round
a commit message in FindAllIssueReferences.

Fix #13483

Signed-off-by: Andrew Thornton <art27@cantab.net>

* CI.restart()

Co-authored-by: Andrew Thornton <art27@cantab.net>
@go-gitea go-gitea locked and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants