Gitea panics when no conf/locale directory #4996

Closed
opened 2025-11-02 06:10:28 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @dballard on GitHub (Mar 4, 2020).

  • Gitea version (or commit ref): 1.11.1 built with GNU Make 4.1, go1.13.8 : bindata, sqlite, sqlite_unlock_notify
  • Git version: 2.7.4
  • Operating system: ubuntu 16.04
  • Database (use [x]):
    • MySQL
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

https://gist.github.com/dballard/e5058e469cda1a9994f38edc23040b5c

Description

For some reason my gitea installation (started as gogs, upgraded to gitea 1.3 then up to 1.9.3 and it was working fine. Upgraded to 1.11.1 today and the dates are broken:

ago%!(EXTRA string=1 minute %s)
Updated ago%!(EXTRA string=2 hours %!s(MISSING))

etc, which lead me to believe there was an i18n problem. I noticed I still had a conf/locale directory with old translations and suspected removing it might force and update or using the bindist ones. instead it causes a panic

...

Screenshots

gitea error

Originally created by @dballard on GitHub (Mar 4, 2020). - Gitea version (or commit ref): 1.11.1 built with GNU Make 4.1, go1.13.8 : bindata, sqlite, sqlite_unlock_notify - Git version: 2.7.4 - Operating system: ubuntu 16.04 - Database (use `[x]`): - [x] MySQL - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: https://gist.github.com/dballard/e5058e469cda1a9994f38edc23040b5c ## Description For some reason my gitea installation (started as gogs, upgraded to gitea 1.3 then up to 1.9.3 and it was working fine. Upgraded to 1.11.1 today and the dates are broken: ``` ago%!(EXTRA string=1 minute %s) Updated ago%!(EXTRA string=2 hours %!s(MISSING)) ``` etc, which lead me to believe there was an i18n problem. I noticed I still had a conf/locale directory with old translations and suspected removing it might force and update or using the bindist ones. instead it causes a panic ... ## Screenshots ![gitea error](https://user-images.githubusercontent.com/543120/75832249-95d67d80-5d6a-11ea-9cf7-693f5c154491.png)
GiteaMirror added the type/question label 2025-11-02 06:10:28 -06:00
Author
Owner

@guillep2k commented on GitHub (Mar 4, 2020):

Most probably you were running a Gitea with all the resources embedded, but now you've compiled one without them and so they're missing.

If you're not having your own set of static files (I don't think you should), you need to add TAGS=bindata to the enviroment before compiling.

@guillep2k commented on GitHub (Mar 4, 2020): Most probably you were running a Gitea with all the resources embedded, but now you've compiled one without them and so they're missing. If you're not having your own set of static files (I don't think you should), you need to add `TAGS=bindata` to the enviroment [before compiling](https://docs.gitea.io/en-us/install-from-source/#build).
Author
Owner

@dballard commented on GitHub (Mar 4, 2020):

I'm using the binary downloaded from https://dl.gitea.io/gitea/
and from what I read, the version it says has "bindata" included which means, yeah, it should not need the conf/locale dir. hence my confusion

@dballard commented on GitHub (Mar 4, 2020): I'm using the binary downloaded from https://dl.gitea.io/gitea/ and from what I read, the version it says has "bindata" included which means, yeah, it should not need the conf/locale dir. hence my confusion
Author
Owner

@guillep2k commented on GitHub (Mar 4, 2020):

Sounds like a configuration issue. We're no longer including translations with less than 30% of coverage. I think you maybe have gl-ES listed in app.ini:

[i18n]
LANG = ...

Please remove it, or perhaps you may somehow download that file from Crowdin and put it inside custom/options/locale? I'm not sure of the procedure.

PS: We don't even have a Galician translation started!

https://crowdin.com/project/gitea
https://crowdin.com/project/gitea/gl-ES

@guillep2k commented on GitHub (Mar 4, 2020): Sounds like a configuration issue. ~~We're no longer including translations with less than 30% of coverage~~. I think you maybe have `gl-ES` listed in `app.ini`: ``` [i18n] LANG = ... ``` Please remove it, ~~or perhaps you may somehow download that file from Crowdin and put it inside `custom/options/locale`? I'm not sure of the procedure.~~ PS: We don't even have a Galician translation started! https://crowdin.com/project/gitea https://crowdin.com/project/gitea/gl-ES
Author
Owner

@dballard commented on GitHub (Mar 4, 2020):

So the conf file has been hand migrated since gogs days so that gl-ES translation may be a relic of that.

So I deleted just it

and it then failed with the same error for en-GB

panic: fail to set message file(en-GB): open conf/locale/locale_en-GB.ini: no such file or directory

here's me downloading a fresh binary and running it:

https://gist.github.com/dballard/6cdb8bc87a0c17b3bfdd85f5b31d94d4

So taking a cue from a freshly generated app.ini on a testing instance which had no [i18n] section at all, I deleted the entire section from the config and then it worked... sort of. it runs.

so a) you may have some legacy code handling that deprecated config option not doing exactly what you want it do any more

but b) The dates are still broken

https://git.openprivacy.ca/explore/repos

You can see, and sign up for an account to test if you need.

But good news, all the languages are still available for selection in user settings, so it does seem to be loading the bindist locales now at least.

German and English:

Aktualisiert vor%!(EXTRA string=%!s(BADINDEX) 4 Stunden)
Updated ago%!(EXTRA string=4 hours %!s(MISSING))
@dballard commented on GitHub (Mar 4, 2020): So the conf file has been hand migrated since gogs days so that gl-ES translation may be a relic of that. So I deleted just it and it then failed with the same error for en-GB `panic: fail to set message file(en-GB): open conf/locale/locale_en-GB.ini: no such file or directory` here's me downloading a fresh binary and running it: https://gist.github.com/dballard/6cdb8bc87a0c17b3bfdd85f5b31d94d4 So taking a cue from a freshly generated app.ini on a testing instance which had no [i18n] section at all, I deleted the entire section from the config and then it worked... sort of. it runs. so a) you may have some legacy code handling that deprecated config option not doing exactly what you want it do any more but b) The dates are still broken https://git.openprivacy.ca/explore/repos You can see, and sign up for an account to test if you need. But good news, all the languages are still available for selection in user settings, so it does seem to be loading the bindist locales now at least. German and English: ``` Aktualisiert vor%!(EXTRA string=%!s(BADINDEX) 4 Stunden) Updated ago%!(EXTRA string=4 hours %!s(MISSING)) ```
Author
Owner

@guillep2k commented on GitHub (Mar 4, 2020):

You probably have some old locale files leftover as well that are being picked up by Gitea. Or maybe you've got custom templates that need updating. Check /opt/gitea/custom; try moving anything that's inside to a different place and see if that helps.

This is the list of locales supported in that version:

https://github.com/go-gitea/gitea/tree/v1.11.1/options/locale

BTW, I'm running 1.11.1 myself 😄

image

@guillep2k commented on GitHub (Mar 4, 2020): You probably have some old locale files leftover as well that are being picked up by Gitea. Or maybe you've got custom templates that need updating. Check `/opt/gitea/custom`; try moving anything that's inside to a different place and see if that helps. This is the list of locales supported in that version: https://github.com/go-gitea/gitea/tree/v1.11.1/options/locale BTW, I'm running 1.11.1 myself 😄 ![image](https://user-images.githubusercontent.com/18600385/75846091-ef19cd80-5db9-11ea-8b27-38f40af67fd6.png)
Author
Owner

@dballard commented on GitHub (Mar 4, 2020):

Ah sorry I never meant to imply I thought this was a general 1.11.1 bug, but clearly something my long history of upgrades had semi uniquely created

And yes, I also deleted custom/conf/locale and it started working.

Thanks!

@dballard commented on GitHub (Mar 4, 2020): Ah sorry I never meant to imply I thought this was a general 1.11.1 bug, but clearly something my long history of upgrades had semi uniquely created And yes, I also deleted custom/conf/locale and it started working. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4996