Project

General

Profile

Actions

Defect #24030

closed

When SVN or Git repository has a commit comment include an emoji (4 bytes charactor), error occurs

Added by Jiamin Wang over 7 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

I already set the MySQL and all databases' charset to utb8mb4

the error is in fetch_changeset method, when insert the commit comment into database table


Files

error.png (34.2 KB) error.png Toshi MARUYAMA, 2020-04-15 18:13
env.png (49.1 KB) env.png Toshi MARUYAMA, 2020-04-15 18:13
subversion_repository.dump.gz (113 KB) subversion_repository.dump.gz Toshi MARUYAMA, 2020-04-15 19:02
svn.diff (4.8 KB) svn.diff Toshi MARUYAMA, 2020-04-15 19:02
mercurial.hg (445 Bytes) mercurial.hg Toshi MARUYAMA, 2020-04-15 19:08
mercurial.png (36.8 KB) mercurial.png Toshi MARUYAMA, 2020-04-15 19:08
same-with-r19706.diff (1.95 KB) same-with-r19706.diff Toshi MARUYAMA, 2020-04-20 04:33

Related issues

Related to Redmine - Feature #31921: Changes to properly support 4 byte characters (emoji) when database is MySQLClosedGo MAEDA

Actions
Actions #1

Updated by Jiamin Wang over 7 years ago

error occurs in save_revision method in /app/models/git.rb or /app/models/subversion.rb

Actions #2

Updated by Toshi MARUYAMA over 7 years ago

  • Category changed from Database to SCM
Actions #3

Updated by Tobias Fischer over 4 years ago

This is still an issue in Redmine 3.4.11

Environment:
  Redmine version                3.4.11.stable.18254
  Ruby version                   2.2.1-p85 (2015-02-26) [x86_64-linux]
  Rails version                  4.2.11.1
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.6.17
  Git                            1.7.9.5
  Filesystem                     

Error message in log:

Started GET "/projects/PROJECT/repository/REPO_ID" for 37.24.44.210 at 2019-07-31 09:43:30 +0200
Processing by RepositoriesController#show as HTML
  Parameters: {"id"=>"PROJECT", "repository_id"=>"REPO_ID"}
  Current user: USERNAME (id=5)
Completed 500 Internal Server Error in 145ms (ActiveRecord: 13.2ms)

ActiveRecord::StatementInvalid (Mysql2::Error: Incorrect string value: '\xF0\x9F\xA4\xA6' for column 'comments' at row 1: INSERT INTO `changesets` (`repository_id`, `revision`, `scmid`, `committer`, `commit_date`, `committed_on`, `comments`, `user_id`) VALUES (18, 'a5814b480017f7702d46d084da1aa1a7cb5d05b0', 'a5814b480017f7702d46d084da1aa1a7cb5d05b0', 'Tobias Fischer <tobias.fischer@domain.tld>', '2019-07-04', '2019-07-04 21:35:45', '[ci] gradle file bei vorherigem Commit vergessen
Actions #4

Updated by Tobias Fischer over 4 years ago

Funny thing: Also the comment here above get's truncated at the position of the emoji in my log message. Emojis are a big issue for Redmine!

Actions #5

Updated by Marius BĂLTEANU over 4 years ago

  • Related to Feature #31921: Changes to properly support 4 byte characters (emoji) when database is MySQL added
Actions #6

Updated by Toshi MARUYAMA about 4 years ago

I have added new test repository and tests because existing test repository encoding is 'ISO-8859-1'.
source:trunk/test/unit/repository_git_test.rb@19705#L42

On my CentOS 7 MySQL 5.5.62, utf8mb4 environment passes test.

With this change,

diff --git a/test/unit/repository_git_test.rb b/test/unit/repository_git_test.rb
--- a/test/unit/repository_git_test.rb
+++ b/test/unit/repository_git_test.rb
@@ -592,7 +592,8 @@ class RepositoryGitTest < ActiveSupport:
   end

   if File.directory?(REPOSITORY_UTF8_PATH) &&
-      !(Redmine::Database::mysql? && !is_mysql_utf8mb4)
+      # !(Redmine::Database::mysql? && !is_mysql_utf8mb4)
+      true
     def test_utf8_emoji
       repo = Repository::Git.create(
                           :project      => @project,

NOT utf8mb4 environment causes error.

Actions #7

Updated by Toshi MARUYAMA about 4 years ago

This is Subversion test repository and test code.
Same results with git.

I give up to commit because it is very risky
if CI server is NOT utf8mb4, tests skip.

Actions #8

Updated by Toshi MARUYAMA about 4 years ago

This is Mercurial bundle file and its results.

Actions #9

Updated by Marius BĂLTEANU about 4 years ago

  • Priority changed from High to Normal

Toshi, what do you think if we assign this to 4.2.0? We already have a ticket there for utf8mb4 support on mysql (#32054).

Actions #10

Updated by Toshi MARUYAMA about 4 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

Conclusion:

No error with correct server configuration and "encoding: utf8mb4" of database.yml.
source:trunk/config/database.yml.example@19705#L12

Actions #11

Updated by Toshi MARUYAMA about 4 years ago

Marius BALTEANU wrote:

Toshi, what do you think if we assign this to 4.2.0? We already have a ticket there for utf8mb4 support on mysql, please see #32054.

Good idea.

Actions #12

Updated by Toshi MARUYAMA about 4 years ago

This is additional patch.
"use same "Redmine::Database.mysql?" as with r19706".

Actions

Also available in: Atom PDF