Template exception when rendering file list #3224

Closed
opened 2025-11-02 05:04:31 -06:00 by GiteaMirror · 13 comments
Owner

Originally created by @mdeboer on GitHub (Apr 22, 2019).

Running version: b83114f

I have many repo's and most of them work fine, today I entered a small one and one specific branch would not load and gave me this exception:

template: repo/view_list:82:38: executing "repo/view_list" at <$commit.Summary>: invalid value; expected string

Related template file:
https://github.com/go-gitea/gitea/blob/b83114f1407247415b184f77f8f2f6ecea8cb994/templates/repo/view_list.tmpl#L82

I did a bit of research and it appears commits with a summary ending with a ' throw this exception. For instance:

Merge branch 'foo'

However this is fine:

Merge branch 'foo' into bar

Originally created by @mdeboer on GitHub (Apr 22, 2019). **Running version**: `b83114f` I have many repo's and most of them work fine, today I entered a small one and one specific branch would not load and gave me this exception: `template: repo/view_list:82:38: executing "repo/view_list" at <$commit.Summary>: invalid value; expected string` Related template file: https://github.com/go-gitea/gitea/blob/b83114f1407247415b184f77f8f2f6ecea8cb994/templates/repo/view_list.tmpl#L82 I did a bit of research and it appears commits with a summary ending with a `'` throw this exception. For instance: `Merge branch 'foo'` However this is fine: `Merge branch 'foo' into bar`
GiteaMirror added the issue/criticaltype/bug labels 2025-11-02 05:04:31 -06:00
Author
Owner

@lafriks commented on GitHub (Apr 22, 2019):

can you reproduce this on try.gitea.io?

@lafriks commented on GitHub (Apr 22, 2019): can you reproduce this on try.gitea.io?
Author
Owner

@mdeboer commented on GitHub (Apr 22, 2019):

Unfortunately not, which is weird as it seemed to be consistent. I switched back to the latest stable release (1.8.0) which works fine.

It is weird though because it was only at that page where it loads the file list. The other views showing all commits worked fine.

Does it help to mention it is a mirrored repository and I am using docker? I'll see if I can recreate it locally using docker.

Repo on try.gitea.io: https://try.gitea.io/mdeboer/test

@mdeboer commented on GitHub (Apr 22, 2019): Unfortunately not, which is weird as it seemed to be consistent. I switched back to the latest stable release (1.8.0) which works fine. It is weird though because it was only at that page where it loads the file list. The other views showing all commits worked fine. Does it help to mention it is a mirrored repository and I am using docker? I'll see if I can recreate it locally using docker. Repo on try.gitea.io: https://try.gitea.io/mdeboer/test
Author
Owner

@lafriks commented on GitHub (Apr 23, 2019):

Try is also running in docker

@lafriks commented on GitHub (Apr 23, 2019): Try is also running in docker
Author
Owner

@Aviortheking commented on GitHub (Apr 28, 2019):

When I was on gitea.com I found the same error on one of @lunny repos
https://gitea.com/lunny/wtf

@Aviortheking commented on GitHub (Apr 28, 2019): When I was on gitea.com I found the same error on one of @lunny repos https://gitea.com/lunny/wtf
Author
Owner

@saitho commented on GitHub (Apr 28, 2019):

I cloned lunnys repository and looked into that. Those files are causing the exception:

  • .editorconfig
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • LICENSE.md

commit_info.go calculates a mapping of file paths and file hashes. The files above are added to remainingPathsForParent and ultimately to the heap array. At some point they don't seem to be processed anymore.

@saitho commented on GitHub (Apr 28, 2019): I cloned lunnys repository and looked into that. Those files are causing the exception: - .editorconfig - CODE_OF_CONDUCT.md - CONTRIBUTING.md - LICENSE.md commit_info.go calculates a mapping of file paths and file hashes. The files above are added to `remainingPathsForParent` and ultimately to the `heap` array. At some point they don't seem to be processed anymore.
Author
Owner

@saitho commented on GitHub (Apr 28, 2019):

Commit "37858d421073a878ffef2c308eb0c0bdd496960b" (Delete unused field from BarGraph widget) seems to have been visited already, which might be why the remaining files are not processed.
That's how far I've got... ^^

@saitho commented on GitHub (Apr 28, 2019): Commit "37858d421073a878ffef2c308eb0c0bdd496960b" (Delete unused field from BarGraph widget) seems to have been visited already, which might be why the remaining files are not processed. That's how far I've got... ^^
Author
Owner

@bkraul commented on GitHub (Apr 29, 2019):

As pointed in my duplicate, the only file I have in my commit that matches the list is .editorconfig. There might be something with that one.

@bkraul commented on GitHub (Apr 29, 2019): As pointed in my duplicate, the only file I have in my commit that matches the list is `.editorconfig`. There might be something with that one.
Author
Owner

@lafriks commented on GitHub (Apr 29, 2019):

Problem is in func getLastCommitForPaths, some file tree entries does not get commit info assigned so that in the end we get error in template when accessing nil pointer properties.

@filipnavara this seems to be related to your code rewrite. Could you please check this out?

While debugging it seems to me that while traversing through commit parents result[path] does not get commit assigned but it does not get added to remaining paths to check either so it gets lost

EDIT: Or actually it could be that remainingPaths is empty and heap does not contain any more commits to check.

Just for info:
.editorconfig does not get info from commit 4d090042b56bd6b041a6d386563359d6463825b6 from
in repository https://github.com/wtfutil/wtf

Last checked commit in getLastCommitsForPaths is 568276343c727c21bee583cc7c2b8ce0e6dfdd89

@lafriks commented on GitHub (Apr 29, 2019): Problem is in `func getLastCommitForPaths`, some file tree entries does not get commit info assigned so that in the end we get error in template when accessing nil pointer properties. @filipnavara this seems to be related to your code rewrite. Could you please check this out? While debugging it seems to me that while traversing through commit parents `result[path]` does not get commit assigned but it does not get added to remaining paths to check either so it gets lost **EDIT:** Or actually it could be that `remainingPaths` is empty and heap does not contain any more commits to check. Just for info: `.editorconfig` does not get info from commit `4d090042b56bd6b041a6d386563359d6463825b6` from in repository https://github.com/wtfutil/wtf Last checked commit in getLastCommitsForPaths is `568276343c727c21bee583cc7c2b8ce0e6dfdd89`
Author
Owner

@filipnavara commented on GitHub (Apr 30, 2019):

I will look into it.

@filipnavara commented on GitHub (Apr 30, 2019): I will look into it.
Author
Owner

@filipnavara commented on GitHub (Apr 30, 2019):

Removing the seen map from getLastCommitForPaths fixes it. It also makes it easier to reason about the correctness of the algorithm. Thanks to other changes made in #6686 it also doesn't noticably degrade performance. I have tested the change on the linked repositories and Rails and Linux repositories.

@filipnavara commented on GitHub (Apr 30, 2019): Removing the `seen` map from `getLastCommitForPaths` fixes it. It also makes it easier to reason about the correctness of the algorithm. Thanks to other changes made in #6686 it also doesn't noticably degrade performance. I have tested the change on the linked repositories and Rails and Linux repositories.
Author
Owner

@bkraul commented on GitHub (Apr 30, 2019):

When can we see this in upstream? @lafriks, thank you for flagging this critical!

@bkraul commented on GitHub (Apr 30, 2019): When can we see this in upstream? @lafriks, thank you for flagging this critical!
Author
Owner

@lafriks commented on GitHub (Apr 30, 2019):

@bkraul fix has been merged, please test

@filipnavara thanks for fast fix 👍

@lafriks commented on GitHub (Apr 30, 2019): @bkraul fix has been merged, please test @filipnavara thanks for fast fix 👍
Author
Owner

@bkraul commented on GitHub (Apr 30, 2019):

This is back to working on docker latest build. Thank you!

@bkraul commented on GitHub (Apr 30, 2019): This is back to working on docker latest build. Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3224