-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Repo page returns 500 error when repo has multiple branch names that only differ in case #29477
Comments
Please switch your DB collation to a case-sensitive one. |
Shouldn't the database schema in gitea enforce this for fields that require case sensitive collation? I guess you are saying that this may be coming in 1.22? I know that we can change it ourselves. The problem would still exist for anyone else though. |
Ah, the PR I had in mind was #28662.
The problem is, Gitea is mainly written for case-sensitive DBs, but MySQL is also somehow supported. |
Regarding how to fix it: |
Ya reading this PR it seems to only take action on gitea startup if the database tables haven't been created yet. Makes this statement
It is possible to make mysql and mariadb case sensitive. Looking at our database and tables it appears that the database default character set is One thing that makes me hesitate doing this by hand is that #28662 seems to use some heuristic for determining the best collation. Would be best to apply that same process automatically if possible. Additionally, the override of #28662 makes no mention of mysql/mariadb being unsupported. In fact the db preparation document says that mysql is one of the most used databases. It would be good to consider communicating database limitations like this more directly. Finally if we do end up taking manual intervention is this the sort of modification you would expect for
|
Reading #28662 more closely I think what we will likely end up doing is running the My main concern at this point is if new tables (like the new branch table) or columns will end up getting correctly created because gitea does seem to override database defaults based on what I can see in our current db content. |
Description
We have at least one repo that we can no longer view in gitea after the upgrade to 1.21 from 1.20. The repo in question has branches
stable/kilo
andstable/Kilo
. Loading the top level repo page for this repo returns a 500 error. Gitea records this in the logs:This
Error 1062
is coming from MariaDB because it is trying to add non unique entries to the database. This appears to arise from case insensitive branch names in the database but case sensitive names in git (kilo
vsKilo
). Gitea even comments that this is an issue here: https://github.com/go-gitea/gitea/blob/v1.21.7/models/git/branch.go#L106.The underlying problem likely started with 6e19484 which is why this was working until semi recently. However, since 87db4a4 this may also be a problem for new pushes to gitea being rejected in addition to creating problems for existing repos that may already be in this state.
It would be nice if this could be corrected since this repo was functional in this state prior to these updates (this is a regression). Additionally gitea shouldn't reject valid git pushes or error when loading content from valid git repos. It should be possible to make this table column case sensitive and match the git behavior.
Note: I am not trying to reproduce this behavior on the gitea demo site as I suspect it will prevent the new branches from being created in the first place.
Gitea Version
1.21.7
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
2.39.2-1.1 from Debian Bookworm
Operating System
Debian Bookworm
How are you running Gitea?
We build our own container images based on Debian Bookworm and build gitea from scratch using the v1.21.7 tag. We then run this gitea container using docker-compose.
Database
MySQL/MariaDB
The text was updated successfully, but these errors were encountered: