Wiki template error with golang 1.14 #4977

Closed
opened 2025-11-02 06:09:49 -06:00 by GiteaMirror · 16 comments
Owner

Originally created by @kode9 on GitHub (Mar 1, 2020).

  • Gitea version (or commit ref): 1.11.1
  • Git version: 2.24.1
  • Operating system: Docker Alpine 3.11
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

When building an image (not the official one) with golang:alpine (which, as of now, points to 1.14.0-alpine3.11), trying to view a wiki page result on a blank html page with this error from the template engine :

template: repo/wiki/view:48:14: executing "repo/wiki/view" at <(not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))>: can't give argument to non-function not $.DisableHTTP

I did no try to rebuild the official image using golang 1.14, but it works fine if I build the same image with golang:1.13-alpine.

Also the issue was quite hard (for me) to track as there is no error in the logs even with all levels set to trace.

I think it might be related to #5697 and #4817

Screenshots

The wiki pages

gitea-issue-wiki1

After clicking on the page

gitea-issue-wiki2

P.S Note that the build layer of my image is nothing fancy :

  apk --no-cache add \
  build-base \
  git \
  nodejs \
  npm \
  && \
  git clone --single-branch --branch "v${GITEA_VERSION}" --depth 1 'https://github.com/go-gitea/gitea' && \
  cd gitea && \
  make clean build
Originally created by @kode9 on GitHub (Mar 1, 2020). - Gitea version (or commit ref): 1.11.1 - Git version: 2.24.1 - Operating system: Docker Alpine 3.11 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description When building an image (not the official one) with `golang:alpine` (which, as of now, points to `1.14.0-alpine3.11`), trying to view a wiki page result on a blank html page with this error from the template engine : ``` template: repo/wiki/view:48:14: executing "repo/wiki/view" at <(not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))>: can't give argument to non-function not $.DisableHTTP ``` I did no try to rebuild the official image using golang 1.14, but it works fine if I build the same image with `golang:1.13-alpine`. Also the issue was quite hard (for me) to track as there is no error in the logs even with all levels set to `trace`. I think it might be related to #5697 and #4817 ## Screenshots The wiki pages ![gitea-issue-wiki1](https://user-images.githubusercontent.com/1242014/75624237-827cb400-5baa-11ea-8409-96e9d759c4e5.png) After clicking on the page ![gitea-issue-wiki2](https://user-images.githubusercontent.com/1242014/75624239-86103b00-5baa-11ea-9e31-1535d88a3897.png) P.S Note that the build layer of my image is nothing fancy : ``` apk --no-cache add \ build-base \ git \ nodejs \ npm \ && \ git clone --single-branch --branch "v${GITEA_VERSION}" --depth 1 'https://github.com/go-gitea/gitea' && \ cd gitea && \ make clean build ```
GiteaMirror added the type/bug label 2025-11-02 06:09:49 -06:00
Author
Owner

@zeripath commented on GitHub (Mar 3, 2020):

Problem is here:

bea497ff96/templates/repo/wiki/view.tmpl (L48)

The encoding parentheses on the or are unnecessary

@zeripath commented on GitHub (Mar 3, 2020): Problem is here: https://github.com/go-gitea/gitea/blob/bea497ff96f4deae617e54468576d11d105e2125/templates/repo/wiki/view.tmpl#L48 The encoding parentheses on the or are unnecessary
Author
Owner

@dkelsey commented on GitHub (Apr 28, 2020):

The problem persists for me

I upgraded go and giteea at the same time to:

component version
go 1.14.2
gitea 1.11.4

I clicked the wiki link (after restarting) and got the same error as was described by @kode9 in this ticket

template: repo/wiki/view:48:14: executing "repo/wiki/view" at <(not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))>: can't give argument to non-function not $.DisableHTTP

I had a look at the merged fix from this issue: it described removing the opening and closing parentheses on line 48 of the wiki template. I did so on my local setup.
I re-compiled and ...

The problem persists.

template: repo/wiki/view:48:14: executing "repo/wiki/view" at <(not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))>: can't give argument to non-function not $.DisableHTTP

Did the fix not get merged to 1.11.4?

@dkelsey commented on GitHub (Apr 28, 2020): # The problem persists for me I upgraded go and giteea at the same time to: | component | version | | --- | --- | | go | 1.14.2 | | gitea | 1.11.4 | I clicked the wiki link (after restarting) and got the same error as was described by @kode9 in this ticket ``` template: repo/wiki/view:48:14: executing "repo/wiki/view" at <(not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))>: can't give argument to non-function not $.DisableHTTP ``` I had a look at the merged _fix_ from this issue: it described removing the opening and closing parentheses on line 48 of the wiki template. I did so on my local setup. I re-compiled and ... ## The problem persists. ``` template: repo/wiki/view:48:14: executing "repo/wiki/view" at <(not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))>: can't give argument to non-function not $.DisableHTTP ``` Did the fix not get merged to `1.11.4`?
Author
Owner

@guillep2k commented on GitHub (Apr 29, 2020):

@dkelsey No, this was not backported to 1.11. We're building 1.11 with go 1.13. See #10584.

@guillep2k commented on GitHub (Apr 29, 2020): @dkelsey No, this was not backported to 1.11. We're building 1.11 with go 1.13. See #10584.
Author
Owner

@dkelsey commented on GitHub (Apr 29, 2020):

@guillep2k Thanks I'll rebuild with go 1.13.

Edit: that worked. Thanks.

@dkelsey commented on GitHub (Apr 29, 2020): @guillep2k Thanks I'll rebuild with go 1.13. _Edit: that worked. Thanks._
Author
Owner

@stblassitude commented on GitHub (May 4, 2020):

Any chance of this getting backported to 1.11? Some distributions (like FreeBSD) have switched to go 1.14 as a default, exposing this bug. Or what's the timeline for a 1.12 release, which presumably would be compatible with go 1.14?

@stblassitude commented on GitHub (May 4, 2020): Any chance of this getting backported to 1.11? Some distributions (like FreeBSD) have switched to go 1.14 as a default, exposing this bug. Or what's the timeline for a 1.12 release, which presumably would be compatible with go 1.14?
Author
Owner

@guillep2k commented on GitHub (May 5, 2020):

@stblassitude 1.12.0 has entered the "feature freeze" stage. A release candidate will be out within a couple of weeks, I suppose. But these are strange days and things are not as predictible as they used to be. 😓

@guillep2k commented on GitHub (May 5, 2020): @stblassitude 1.12.0 has entered the "feature freeze" stage. A release candidate will be out within a couple of weeks, I suppose. But these are strange days and things are not as predictible as they used to be. 😓
Author
Owner

@pvgoran commented on GitHub (May 18, 2020):

Looks like the same problem occurs with the "Page Revision" page:

template: repo/wiki/revision:24:14: executing "repo/wiki/revision" at <(not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))>: can't give argument to non-function not $.DisableHTTP

(Sorry, I'm too lazy for creation of a proper issue at the moment.)

@pvgoran commented on GitHub (May 18, 2020): Looks like the same problem occurs with the "Page Revision" page: ``` template: repo/wiki/revision:24:14: executing "repo/wiki/revision" at <(not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))>: can't give argument to non-function not $.DisableHTTP ``` (Sorry, I'm too lazy for creation of a proper issue at the moment.)
Author
Owner

@zeripath commented on GitHub (May 18, 2020):

We don't intend to fix 1.11's templates for go 1.14 - if however you were to do the work to do this and open a PR for it I'd approve it. The only trouble is we will not build 1.11 with go1.14 so our ci would not be able to assert that your template changes were sufficient or required for 1.14.

@zeripath commented on GitHub (May 18, 2020): We don't intend to fix 1.11's templates for go 1.14 - if however you were to do the work to do this and open a PR for it I'd approve it. The only trouble is we will not build 1.11 with go1.14 so our ci would not be able to assert that your template changes were sufficient or required for 1.14.
Author
Owner

@pvgoran commented on GitHub (May 18, 2020):

@zeripath Done.

@pvgoran commented on GitHub (May 18, 2020): @zeripath Done.
Author
Owner

@stblassitude commented on GitHub (May 31, 2020):

Huh, so #11481 fixes this for 1.11.6, but this issue doesn't get merged?

Any interaction with wiki pages continues to be broken when Gitea is built with Go 1.14.

@stblassitude commented on GitHub (May 31, 2020): Huh, so #11481 fixes this for 1.11.6, but this issue doesn't get merged? Any interaction with wiki pages continues to be broken when Gitea is built with Go 1.14.
Author
Owner

@pvgoran commented on GitHub (May 31, 2020):

Oh... Seems like #10583 wasn't merged into release/v1.11 .

@pvgoran commented on GitHub (May 31, 2020): Oh... Seems like #10583 wasn't merged into release/v1.11 .
Author
Owner

@guillep2k commented on GitHub (May 31, 2020):

@pvgoran https://github.com/go-gitea/gitea/pull/11481 is the PR you're looking for.

@stblassitude it was merged 13 days ago and released yesterday:
https://github.com/go-gitea/gitea/tree/v1.11.6

Unless I misunderstood your comments.

@guillep2k commented on GitHub (May 31, 2020): @pvgoran https://github.com/go-gitea/gitea/pull/11481 is the PR you're looking for. @stblassitude it was merged 13 days ago and released yesterday: https://github.com/go-gitea/gitea/tree/v1.11.6 Unless I misunderstood your comments.
Author
Owner

@pvgoran commented on GitHub (May 31, 2020):

@guillep2k #11481 - this one is mine, I made it after #10583, and it got merged. This fixed the problem with the Wiki revision page.

However, the earlier #10583 which fixes #10552 (the problem with Wiki's view page) was not merged into the 1.11 branch.

@pvgoran commented on GitHub (May 31, 2020): @guillep2k #11481 - this one is mine, I made it after #10583, and it got merged. This fixed the problem with the Wiki **revision** page. However, the earlier #10583 which fixes #10552 (the problem with Wiki's **view** page) was not merged into the 1.11 branch.
Author
Owner

@zeripath commented on GitHub (Jun 5, 2020):

@pvgoran please send a backport I think we will have one more 1.11 release so we can get that in

@zeripath commented on GitHub (Jun 5, 2020): @pvgoran please send a backport I think we will have one more 1.11 release so we can get that in
Author
Owner

@pvgoran commented on GitHub (Jun 6, 2020):

@zeripath Done.

@pvgoran commented on GitHub (Jun 6, 2020): @zeripath Done.
Author
Owner

@zeripath commented on GitHub (Jun 6, 2020):

So go 1.14 has an issue with preempting and that there's likely another fix needed to prefix calls with GODEBUG=asyncpreemptoff=1

@zeripath commented on GitHub (Jun 6, 2020): So go 1.14 has an issue with preempting and that there's likely another fix needed to prefix calls with GODEBUG=asyncpreemptoff=1
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4977