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

newSignatureFromCommitline panics during migration when tag author line does not contain timestamp #2763

Closed
1 of 3 tasks
as-com opened this issue Oct 22, 2017 · 1 comment · Fixed by go-gitea/git#89 or #2765
Closed
1 of 3 tasks
Labels
Milestone

Comments

@as-com
Copy link

as-com commented Oct 22, 2017

  • Gitea version (or commit ref): starting in e232c49
  • Git version: whatever comes with the Docker container
  • Operating system: the BusyBox thing in the Docker container
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:
gogs_1                         | Oct 22 14:57:33 syslogd started: BusyBox v1.25.1
gogs_1                         | Oct 22 14:57:33 sshd[16]: Server listening on :: port 22.
gogs_1                         | Oct 22 14:57:33 sshd[16]: Server listening on 0.0.0.0 port 22.
gogs_1                         | 2017/10/22 14:57:43 [T] Custom path: /data/gitea
gogs_1                         | 2017/10/22 14:57:43 [T] Log path: /data/gitea/log
gogs_1                         | panic: runtime error: index out of range
gogs_1                         |
gogs_1                         | goroutine 1 [running]:
gogs_1                         | code.gitea.io/gitea/vendor/code.gitea.io/git.newSignatureFromCommitline(0xc4206c005a, 0xb, 0x5a6, 0x5ad, 0xc420150ff0, 0x6)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/vendor/code.gitea.io/git/signature.go:35 +0x457
gogs_1                         | code.gitea.io/gitea/vendor/code.gitea.io/git.parseTagData(0xc4206c0000, 0x66, 0x600, 0xc4206c0000, 0x66, 0x600)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/vendor/code.gitea.io/git/tag.go:54 +0x217
gogs_1                         | code.gitea.io/gitea/vendor/code.gitea.io/git.(*Repository).getTag(0xc4207a3d40, 0xf0daa9cfa4b95fa4, 0x8aa1a7de89906483, 0x8aa1a7de2a5c6328, 0xc42a5c6328, 0x0, 0x0)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/vendor/code.gitea.io/git/repo_tag.go:65 +0x351
gogs_1                         | code.gitea.io/gitea/vendor/code.gitea.io/git.(*Repository).GetTag(0xc4207a3d40, 0xc4206ba00a, 0x12, 0x0, 0x564db1ecf8e0, 0xc4206d4760)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/vendor/code.gitea.io/git/repo_tag.go:89 +0x17f
gogs_1                         | code.gitea.io/gitea/models.pushUpdateAddTag(0xc4205802c0, 0xc4207a3d40, 0xc4206ba00a, 0x12, 0x564db273d740, 0x0)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/models/update.go:114 +0xb6
gogs_1                         | code.gitea.io/gitea/models.SyncReleasesWithTags(0xc4205802c0, 0xc4207a3d40, 0xc4207a3d40, 0x0)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/models/release.go:462 +0x502
gogs_1                         | code.gitea.io/gitea/models/migrations.releaseAddColumnIsTagAndSyncTags(0xc42029b4a0, 0x2, 0xc4201f4a38)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/models/migrations/v42.go:47 +0x245
gogs_1                         | code.gitea.io/gitea/models/migrations.(*migration).Migrate(0xc42030ab40, 0xc42029b4a0, 0xc4204c56d0, 0x1)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/models/migrations/migrations.go:53 +0x36
gogs_1                         | code.gitea.io/gitea/models/migrations.Migrate(0xc42029b4a0, 0x0, 0x0)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/models/migrations/migrations.go:171 +0x3b8
gogs_1                         | code.gitea.io/gitea/models.NewEngine(0x564db18b26d0, 0xc, 0xc4204c57c8)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/models/models.go:270 +0x72
gogs_1                         | code.gitea.io/gitea/routers.GlobalInit()
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/routers/init.go:55 +0x310
gogs_1                         | code.gitea.io/gitea/cmd.runWeb(0xc4202e3400, 0x0, 0x0)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/cmd/web.go:60 +0xb7
gogs_1                         | code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0x564db174d000, 0x564db18b25a8, 0xc4202e3400, 0xc420188600, 0x0)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xb9
gogs_1                         | code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0x564db10aa8b1, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x564db10cda9c, 0x16, 0x0, ...)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0xa74
gogs_1                         | code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc420073380, 0xc42000c060, 0x2, 0x2, 0x0, 0x0)
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x601
gogs_1                         | main.main()
gogs_1                         | 	/srv/app/src/code.gitea.io/gitea/main.go:44 +0x3a7

Description

I just tried to upgrade my Gitea server, but it kept on crashing with the above error message. I found that this appeared some time between 1.2.0rc2 and 1.2.0rc3, and I traced it to that specific commit.

I followed the code path to this error, and created the following Bash line to find which of my repositories was causing the issue:

for i in */*; do echo; echo $i; echo "======="; for t in $(git -C $i show-ref --tags | cut -f 1 -d " "); do if [ $(git -C $i cat-file -t $t) == "tag" ]; then git -C $i cat-file -p $t | grep "^tagger"; fi; done; done

and it turns out that a copy of the Quagga repository was causing the issue:

andrew/quagga.git
=======
tagger Denis Ovsienko <infrastation@yandex.ru> 1317300784 +0400
tagger Denis Ovsienko <infrastation@yandex.ru> 1325771815 +0400
tagger paul <paul>
tagger paul <paul>
tagger Chris Hall (GMCH) <chris.hall@highwayman.com> 1305620650 +0100
tagger Chris Hall (GMCH) <chris.hall@highwayman.com> 1305620770 +0100
tagger Chris Hall (GMCH) <chris.hall@highwayman.com> 1305620808 +0100
tagger Chris Hall (GMCH) <chris.hall@highwayman.com> 1305621324 +0100
tagger Chris Hall (GMCH) <chris.hall@highwayman.com> 1305621440 +0100
tagger Chris Hall (GMCH) <chris.hall@highwayman.com> 1305621066 +0100
tagger Chris Hall (GMCH) <chris.hall@highwayman.com> 1305620973 +0100
tagger Chris Hall (GMCH) <chris.hall@highwayman.com> 1305621511 +0100
tagger Chris Hall (GMCH) <chris.hall@highwayman.com> 1305621602 +0100
tagger Chris Hall <chris.hall@highwayman.com> 1315351914 +0100
tagger Chris Hall <chris.hall@highwayman.com> 1315349362 +0100
tagger Chris Hall (GMCH) <chris.hall@highwayman.com> 1332158374 +0000
tagger Chris Hall <chris.hall@highwayman.com> 1332504450 +0000
tagger Chris Hall <chris.hall@highwayman.com> 1332505242 +0000
tagger Chris Hall <chris.hall@highwayman.com> 1336384768 +0100
tagger Chris Hall <chris.hall@highwayman.com> 1339165556 +0100
tagger Paul Jakma <paul@clubi.ie> 1131254104 +0000
tagger Paul Jakma <paul@quagga.net> 1143735361 +0100
tagger Paul Jakma <paul@quagga.net> 1143805065 +0100
tagger Paul Jakma <paul@quagga.net> 1143805186 +0100
tagger Paul Jakma <paul@quagga.net> 1147109393 +0100
tagger gdt <gdt>
tagger jardin <jardin>
tagger gdt <gdt>
tagger gdt <gdt>
tagger paul <paul>
tagger paul <paul>
tagger hasso <hasso>
tagger paul <paul>
tagger ajs <ajs>
tagger ajs <ajs>
tagger ajs <ajs>
tagger ajs <ajs>
tagger paul <paul>
[...]

GitHub seems to deal with one of these tags somewhat more gracefully: https://github.com/Quagga/quagga/releases/tag/zebra_org_20030428

For now, I've deleted the repository so the Gitea upgrade can proceed, but I think this code (https://github.com/go-gitea/gitea/blob/master/vendor/code.gitea.io/git/signature.go#L35) should be able to deal with a missing timestamp, especially since there are repositories out in the wild that have tags with author lines that are missing timestamps.

@lafriks
Copy link
Member

lafriks commented Oct 22, 2017

I have submitted PR to fix this issue

@lafriks lafriks reopened this Oct 23, 2017
@go-gitea go-gitea locked and limited conversation to collaborators Nov 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants