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

Update of repository mirror settings cause: "PANIC: runtime error" #18204

Closed
zpericic opened this issue Jan 7, 2022 · 1 comment · Fixed by #18205
Closed

Update of repository mirror settings cause: "PANIC: runtime error" #18204

zpericic opened this issue Jan 7, 2022 · 1 comment · Fixed by #18205

Comments

@zpericic
Copy link
Contributor

zpericic commented Jan 7, 2022

Gitea Version

0acc6a4 - main branch

Git Version

2.33.1

Operating System

No response

How are you running Gitea?

git clone https://github.com/go-gitea/gitea
git checkout main
TAGS="bindata" make build

Running using systemd

Database

No response

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

Update of repository mirror settings cause:

2022/01/07 19:26:36 routers/web/base.go:130:1() [E] PANIC: runtime error: invalid memory address or nil pointer dereference
    /usr/lib/golang/src/runtime/panic.go:212 (0x437afa)
        panicmem: panic(memoryError)
    /usr/lib/golang/src/runtime/signal_unix.go:734 (0x451ad2)
        sigpanic: panicmem()
    /srv/gitea/gitea/routers/web/repo/setting.go:208 (0x215ca9f)
        SettingsPost: ctx.Repo.Mirror.EnablePrune = form.EnablePrune
    /srv/gitea/gitea/modules/web/route.go:74 (0x207f703)
        Wrap.func1: t(ctx)
    /usr/lib/golang/src/net/http/server.go:2050 (0x7d70c3)
        HandlerFunc.ServeHTTP: f(w, r)

It seams that "ctx.Repo.Mirror" is nil.

Tried to trace it to "modules/context/repo.go" and code under repo.IsMirror in repoAssignment() function is evaluated. But no luck.

If someone could at least give a pointer...

Screenshots

No response

zeripath added a commit to zeripath/gitea that referenced this issue Jan 7, 2022
In go-gitea#17933 repoAssignment no longer sets the ctx.Repo.Mirror field meaning that
attempting change mirror settings results in an NPE. This PR simply restores this.

Either we should remove this field or, we should set it. At present it seems simplest
to set it instead of going looking in the Data for the value although converting the
context to a bag of things may be the correct approach in the future.

Fix go-gitea#18204

Signed-off-by: Andrew Thornton <art27@cantab.net>
@zpericic
Copy link
Contributor Author

zpericic commented Jan 7, 2022

It's regression of #17933.

Have created zpericic@5418716 which resolve this issue.

I will wait with PR as there is another approach by @zeripath...

lunny pushed a commit that referenced this issue Jan 8, 2022
In #17933 repoAssignment no longer sets the ctx.Repo.Mirror field meaning that
attempting change mirror settings results in an NPE. This PR simply restores this.

Either we should remove this field or, we should set it. At present it seems simplest
to set it instead of going looking in the Data for the value although converting the
context to a bag of things may be the correct approach in the future.

Fix #18204

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Chianina pushed a commit to Chianina/gitea that referenced this issue Mar 28, 2022
In go-gitea#17933 repoAssignment no longer sets the ctx.Repo.Mirror field meaning that
attempting change mirror settings results in an NPE. This PR simply restores this.

Either we should remove this field or, we should set it. At present it seems simplest
to set it instead of going looking in the Data for the value although converting the
context to a bag of things may be the correct approach in the future.

Fix go-gitea#18204

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant