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

Wiki template error with golang 1.14 #10552

Closed
2 of 7 tasks
kode9 opened this issue Mar 1, 2020 · 16 comments · Fixed by #10583
Closed
2 of 7 tasks

Wiki template error with golang 1.14 #10552

kode9 opened this issue Mar 1, 2020 · 16 comments · Fixed by #10583
Labels

Comments

@kode9
Copy link

kode9 commented 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
@zeripath
Copy link
Contributor

zeripath commented Mar 3, 2020

Problem is here:

{{if or ((not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)))}}

The encoding parentheses on the or are unnecessary

@dkelsey
Copy link

dkelsey commented 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?

@guillep2k
Copy link
Member

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

@dkelsey
Copy link

dkelsey commented Apr 29, 2020

@guillep2k Thanks I'll rebuild with go 1.13.

Edit: that worked. Thanks.

@stblassitude
Copy link
Contributor

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?

Jehops pushed a commit to Jehops/freebsd-ports-legacy that referenced this issue May 4, 2020
From the PR:

Right now, the version of gitea shipped in ports fails to display wiki
pages. Any wiki page opened results in the following error:

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

This is due to extra parentheses in templates/repo/wiki/view.tmpl and
has already been fixed upstream in [1], [2].

I've pulled the single line template fix from upstream and added the
patch to our port. As a workaround, users can also fix the problem by
placing the corrected template in
/usr/local/etc/gitea/templates/repo/wiki/view.tmpl.

Cheers,
Sascha

[1] go-gitea/gitea#10552
[2] zeripath/gitea@1830d0e

PR:		246020
Submitted by:	Sascha Biberhofer
Approved by:	maintainer


git-svn-id: svn+ssh:https://svn.freebsd.org/ports/head@533935 35697150-7ecd-e111-bb59-0022644237b5
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue May 4, 2020
From the PR:

Right now, the version of gitea shipped in ports fails to display wiki
pages. Any wiki page opened results in the following error:

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

This is due to extra parentheses in templates/repo/wiki/view.tmpl and
has already been fixed upstream in [1], [2].

I've pulled the single line template fix from upstream and added the
patch to our port. As a workaround, users can also fix the problem by
placing the corrected template in
/usr/local/etc/gitea/templates/repo/wiki/view.tmpl.

Cheers,
Sascha

[1] go-gitea/gitea#10552
[2] zeripath/gitea@1830d0e

PR:		246020
Submitted by:	Sascha Biberhofer
Approved by:	maintainer


git-svn-id: svn+ssh:https://svn.freebsd.org/ports/head@533935 35697150-7ecd-e111-bb59-0022644237b5
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue May 4, 2020
From the PR:

Right now, the version of gitea shipped in ports fails to display wiki
pages. Any wiki page opened results in the following error:

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

This is due to extra parentheses in templates/repo/wiki/view.tmpl and
has already been fixed upstream in [1], [2].

I've pulled the single line template fix from upstream and added the
patch to our port. As a workaround, users can also fix the problem by
placing the corrected template in
/usr/local/etc/gitea/templates/repo/wiki/view.tmpl.

Cheers,
Sascha

[1] go-gitea/gitea#10552
[2] zeripath/gitea@1830d0e

PR:		246020
Submitted by:	Sascha Biberhofer
Approved by:	maintainer
uqs pushed a commit to freebsd/freebsd-ports that referenced this issue May 4, 2020
gitea: Update to 1.1.4

Update Gitea to 1.11.4

This release fixes ten bugs.

Release notes: https://blog.gitea.io/2020/04/gitea-1.11.4-is-released/

PR:		245602
Submitted by:	maintainer

gitea: Add GIT_LFS option

Add a GIT_LFS option (on by default) for environments that don't want to
make LFS available.

While here, change the pkg-message UCL to only show when upgrading from
< 1.8.0.

Approved by:	maintainer

gitea: Fix wiki page display

From the PR:

Right now, the version of gitea shipped in ports fails to display wiki
pages. Any wiki page opened results in the following error:

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

This is due to extra parentheses in templates/repo/wiki/view.tmpl and
has already been fixed upstream in [1], [2].

I've pulled the single line template fix from upstream and added the
patch to our port. As a workaround, users can also fix the problem by
placing the corrected template in
/usr/local/etc/gitea/templates/repo/wiki/view.tmpl.

Cheers,
Sascha

[1] go-gitea/gitea#10552
[2] zeripath/gitea@1830d0e

PR:		246020
Submitted by:	Sascha Biberhofer
Approved by:	maintainer

Approved by:	portmgr (with hat)
@guillep2k
Copy link
Member

@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. 😓

florianjacob added a commit to florianjacob/nixpkgs that referenced this issue May 6, 2020
as gitea 1.11 does not support go 1.14
This repairs the gitea wiki on NixOS 20.03.
See go-gitea/gitea#10552 for upstream issue.
@pvgoran
Copy link

pvgoran commented 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.)

@zeripath
Copy link
Contributor

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.

pvgoran added a commit to pvgoran/gitea that referenced this issue May 18, 2020
This fixes the error on "Page Revision" page, similar to go-gitea#10552.
@pvgoran
Copy link

pvgoran commented May 18, 2020

@zeripath Done.

zeripath pushed a commit that referenced this issue May 18, 2020
This fixes the error on "Page Revision" page, similar to #10552.
@stblassitude
Copy link
Contributor

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.

@pvgoran
Copy link

pvgoran commented May 31, 2020

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

@guillep2k
Copy link
Member

@pvgoran #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.

@pvgoran
Copy link

pvgoran commented 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.

@zeripath
Copy link
Contributor

zeripath commented Jun 5, 2020

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

@pvgoran
Copy link

pvgoran commented Jun 6, 2020

@zeripath Done.

@zeripath
Copy link
Contributor

zeripath commented 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 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.

6 participants