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

Fix panic: template: repo/issue/list:210: unexpected "=" in operand #6041

Merged
merged 1 commit into from
Feb 13, 2019

Conversation

gzsombor
Copy link
Contributor

It seems, that a recent change introduced invalid template content, which resulted in a startup failure:


 AppPath: /opt/gitea/gitea
 AppWorkPath: /var/lib/gitea
 Custom path: /var/lib/gitea/custom
 Log path: /var/log/gitea
 panic: template: repo/issue/list:210: unexpected "=" in operand
 goroutine 1 [running]:
 html/template.Must(0x0, 0x192b4a0, 0xc420d1a070, 0x0)
         /var/lib/jenkins/tools/org.jenkinsci.plugins.golang.GolangInstallation/go-1.10.3/src/html/template/template.go:372 +0x54
 code.gitea.io/gitea/vendor/gopkg.in/macaron%2ev1.compile(0x17d26f2, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc42000c120, 0x2, 0x2, ...)
         /var/lib/jenkins/workspace/build_gitea/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/render.go:292 +0x21d
 code.gitea.io/gitea/vendor/gopkg.in/macaron%2ev1.(*TemplateSet).Set(0xc4207e6630, 0x17cc1cb, 0x7, 0xc4207e4000, 0x0)
         /var/lib/jenkins/workspace/build_gitea/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/render.go:318 +0x61
 code.gitea.io/gitea/vendor/gopkg.in/macaron%2ev1.renderHandler(0x17d26f2, 0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc42000c120, 0x2, 0x2, ...)
         /var/lib/jenkins/workspace/build_gitea/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/render.go:385 +0x12d
 code.gitea.io/gitea/vendor/gopkg.in/macaron%2ev1.Renderer(0xc4208d5240, 0x1, 0x1, 0xc42000c100, 0x0)
         /var/lib/jenkins/workspace/build_gitea/src/code.gitea.io/gitea/vendor/gopkg.in/macaron.v1/render.go:422 +0x165
 code.gitea.io/gitea/modules/templates.HTMLRenderer(0xc42002ed80, 0x16218a0)
         /var/lib/jenkins/workspace/build_gitea/src/code.gitea.io/gitea/modules/templates/static.go:117 +0x155
 code.gitea.io/gitea/routers/routes.NewMacaron(0xc420231680)
         /var/lib/jenkins/workspace/build_gitea/src/code.gitea.io/gitea/routers/routes/routes.go:107 +0x2fe
 code.gitea.io/gitea/cmd.runWeb(0xc420231680, 0x0, 0x0)
         /var/lib/jenkins/workspace/build_gitea/src/code.gitea.io/gitea/cmd/web.go:125 +0xb2
 code.gitea.io/gitea/vendor/github.com/urfave/cli.HandleAction(0x15aeb40, 0x1848c20, 0xc420231680, 0xc42014d200, 0x0)
         /var/lib/jenkins/workspace/build_gitea/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:471 +0xad
 code.gitea.io/gitea/vendor/github.com/urfave/cli.Command.Run(0x17c6b46, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x17f092c, 0x16, 0x0, ...)
         /var/lib/jenkins/workspace/build_gitea/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/command.go:191 +0xa0e
 code.gitea.io/gitea/vendor/github.com/urfave/cli.(*App).Run(0xc4205801a0, 0xc4200be040, 0x4, 0x4, 0x0, 0x0)
         /var/lib/jenkins/workspace/build_gitea/src/code.gitea.io/gitea/vendor/github.com/urfave/cli/app.go:241 +0x5b8
 main.main()
         /var/lib/jenkins/workspace/build_gitea/src/code.gitea.io/gitea/main.go:57 +0x495

@codecov-io
Copy link

codecov-io commented Feb 12, 2019

Codecov Report

Merging #6041 into master will decrease coverage by <.01%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6041      +/-   ##
==========================================
- Coverage   38.86%   38.86%   -0.01%     
==========================================
  Files         345      345              
  Lines       49491    49503      +12     
==========================================
+ Hits        19237    19241       +4     
- Misses      27473    27480       +7     
- Partials     2781     2782       +1
Impacted Files Coverage Δ
models/issue.go 47.44% <33.33%> (-0.15%) ⬇️
models/unit.go 0% <0%> (-14.29%) ⬇️
models/repo_list.go 64.55% <0%> (+1.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f38e2d...c1290ee. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 12, 2019
@techknowlogick
Copy link
Member

Thanks for PR @gzsombor, which version of Golang are you using?

@gzsombor
Copy link
Contributor Author

I'm using 1.10.4

@lafriks lafriks added this to the 1.8.0 milestone Feb 12, 2019
@adelowo
Copy link
Member

adelowo commented Feb 12, 2019

This is pretty weird I must say since it is already defined at the top

{{ $timeStr:= TimeSinceUnix .CreatedUnix $.Lang }}

@lafriks
Copy link
Member

lafriks commented Feb 12, 2019

Updating variables was added in GoLang v1.11: https://golang.org/doc/go1.11#text/template

So we should either rewrite this part of code or raise GoLang version requirements

EDIT: I would prefer moving such logic out of template

@lafriks
Copy link
Member

lafriks commented Feb 12, 2019

Proposed change will fix template rendering but won't fix problem as assigning new variables inside if will break logic imho

@adelowo
Copy link
Member

adelowo commented Feb 12, 2019

Updating variables was added in GoLang v1.11:

My bad

@lunny
Copy link
Member

lunny commented Feb 12, 2019

We still needs support go1.10 on until Gitea v1.9 I think.

@gzsombor
Copy link
Contributor Author

I can submit a proper fix in evening, I just wanted to quickly re-enable my nightly built server, at first, I though it's just a typo

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 13, 2019
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 13, 2019
@lafriks lafriks merged commit 23414ac into go-gitea:master Feb 13, 2019
@gzsombor gzsombor deleted the fix-panic-in-template branch February 13, 2019 08:17
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants