Skip to content

Oauth2 don't fly with mysql/mariadb #3944

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

Closed
1 of 6 tasks
agaida opened this issue May 10, 2018 · 5 comments · Fixed by #3955
Closed
1 of 6 tasks

Oauth2 don't fly with mysql/mariadb #3944

agaida opened this issue May 10, 2018 · 5 comments · Fixed by #3955
Labels
type/enhancement An improvement of existing functionality
Milestone

Comments

@agaida
Copy link

agaida commented May 10, 2018

  • Gitea version (or commit ref): latest git
  • Git version: 2.17.0
  • Operating system: debian stretch
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • [X ] Not relevant
  • Log gist:

Description

after upgrading to current git i get an

2018/05/10 15:30:48 [...itea/routers/init.go:64 GlobalInit()] [E] Failed to initialize OAuth2 support: Error 1071: Specified key was too long; max key length is 767 bytes

this is clearly a 'bug' with mariadb - gitea try to create the oauth2_ table and fails creating it because the primary key is to long, refs: https://stackoverflow.com/questions/41176482/mariadb-wont-create-table-with-large-varchar-as-primary-key

@agaida
Copy link
Author

agaida commented May 10, 2018

going back to v1.1.0-1167-g8d5f58d83 kind of 'solve' that for me

@agaida
Copy link
Author

agaida commented May 10, 2018

https://dev.mysql.com/doc/refman/5.5/en/charset-charsets.html - might give some hints too. So right now i 'fixed' it with

CREATE TABLE IF NOT EXISTS `oauth2_session` (`id` VARCHAR(400) PRIMARY KEY NOT NULL, `data` TEXT NULL, `created_unix` BIGINT(20) NULL, `updated_unix` BIGINT(20) NULL, `expires_unix` BIGINT(20) NULL) DEFAULT CHARSET latin1 ENGINE = myisam;

but imho this is really dirty

Edit: Hmm, innodb would work too, but such long primary keys should be considered dirty anyways - what about a hash as id?

@techknowlogick
Copy link
Member

utf8mb4 doesn't work, however utf8 does. no need for latin1 or myisam.

@thehowl
Copy link
Contributor

thehowl commented May 10, 2018

See #3859

@agaida
Copy link
Author

agaida commented May 10, 2018

utf8 don't work - #3859 (comment)

mysql> SHOW CHARACTER SET;
+----------+-----------------------------+---------------------+--------+
| Charset  | Description                 | Default collation   | Maxlen |
+----------+-----------------------------+---------------------+--------+
| latin1   | cp1252 West European        | latin1_swedish_ci   |      1 |
| ascii    | US ASCII                    | ascii_general_ci    |      1 |
| utf8     | UTF-8 Unicode               | utf8_general_ci     |      3 |
| utf8mb4  | UTF-8 Unicode               | utf8mb4_general_ci  |      4 |
| utf16    | UTF-16 Unicode              | utf16_general_ci    |      4 |
| utf32    | UTF-32 Unicode              | utf32_general_ci    |      4 |
+----------+-----------------------------+---------------------+--------+

@lunny lunny added the type/enhancement An improvement of existing functionality label May 11, 2018
@lafriks lafriks added this to the 1.5.0 milestone May 12, 2018
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants