<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>313914</bug_id>
          
          <creation_ts>2013-01-26 02:57:03 +0000</creation_ts>
          <short_desc>MySQL database creation failed when path to the database contains Cyrillic characters</short_desc>
          <delta_ts>2013-05-15 12:55:57 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>amarok</product>
          <component>Collections/Local</component>
          <version>2.7.0</version>
          <rep_platform>Ubuntu</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.8</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Artem Vorotnikov">artem</reporter>
          <assigned_to name="Amarok Bugs">amarok-bugs-null</assigned_to>
          <cc>matej</cc>
    
    <cc>ralf-engels</cc>
          
          <cf_commitlink>http://commits.kde.org/amarok/e90f7b4b8462e674275b53d550c147bbececd467</cf_commitlink>
          <cf_versionfixedin>2.7.1</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1335392</commentid>
    <comment_count>0</comment_count>
    <who name="Artem Vorotnikov">artem</who>
    <bug_when>2013-01-26 02:57:03 +0000</bug_when>
    <thetext>I have Unicode (cyrillic) user, host names and Unicode home path. Amarok starts with error and fails to import collection:

GREPME MySQLe query failed! (1006) Can&apos;t create database &apos;amarok&apos; (errno: 2) on Could not create amarok database
GREPME MySQLe query failed! (1) Can&apos;t create/write to file &apos;/home/Ð°ÑÑÑÐ¼/.kde/share/apps/amarok/mysqle/amarok/db.opt&apos; (Errcode: 2) on Could not alter database charset/collation
GREPME MySQLe query failed! (1049) Unknown database &apos;amarok&apos; on Could not select database
GREPME MySQLe query failed! (1049) Unknown database &apos;(null)&apos; on SELECT column_name FROM INFORMATION_SCHEMA.columns WHERE table_name=&apos;admin&apos;
GREPME MySQLe query failed! (1049) Unknown database &apos;(null)&apos; on SELECT column_name FROM INFORMATION_SCHEMA.columns WHERE table_name=&apos;admin&apos;
GREPME MySQLe query failed! (1049) Unknown database &apos;(null)&apos; on SELECT column_name FROM INFORMATION_SCHEMA.columns WHERE table_name=&apos;admin&apos;
GREPME MySQLe query failed! (1046) No database selected on CREATE TABLE admin (component VARCHAR(255), version INTEGER) COLLATE = utf8_bin ENGINE = MyISAM;
GREPME MySQLe query failed! (1046) No database selected on CREATE TABLE devices (id INTEGER PRIMARY KEY AUTO_INCREMENT,type VARCHAR(255),label VARCHAR(255),lastmountpoint VARCHAR(255),uuid VARCHAR(255),servername VARCHAR(80),sharename VARCHAR(240)) COLLATE = utf8_bin ENGINE = MyISAM;
GREPME MySQLe query failed! (1046) No database selected on CREATE INDEX devices_type ON devices( type );
GREPME MySQLe query failed! (1046) No database selected on CREATE UNIQUE INDEX devices_uuid ON devices( uuid );
GREPME MySQLe query failed! (1046) No database selected on CREATE INDEX devices_rshare ON devices( servername, sharename );
GREPME MySQLe query failed! (1046) No database selected on CREATE TABLE urls (id INTEGER PRIMARY KEY AUTO_INCREMENT,deviceid INTEGER,rpath VARCHAR(324) NOT NULL,directory INTEGER,uniqueid VARCHAR(128) UNIQUE) COLLATE = utf8_bin ENGINE = MyISAM;
GREPME MySQLe query failed! (1046) No database selected on CREATE UNIQUE INDEX urls_id_rpath ON urls(deviceid, rpath);
GREPME MySQLe query failed! (1046) No database selected on CREATE INDEX urls_uniqueid ON urls(uniqueid);
GREPME MySQLe query failed! (1046) No database selected on CREATE INDEX urls_directory ON urls(directory);
GREPME MySQLe query failed! (1046) No database selected on CREATE TABLE directories (id INTEGER PRIMARY KEY AUTO_INCREMENT,deviceid INTEGER,dir VARCHAR(1000) NOT NULL,changedate INTEGER) COLLATE = utf8_bin ENGINE = MyISAM;
GREPME MySQLe query failed! (1046) No database selected on CREATE INDEX directories_deviceid ON directories(deviceid);
GREPME MySQLe query failed! (1046) No database selected on CREATE TABLE artists (id INTEGER PRIMARY KEY AUTO_INCREMENT,name VARCHAR(255) NOT NULL) COLLATE = utf8_bin ENGINE = MyISAM;
GREPME MySQLe query failed! (1046) No database selected on CREATE UNIQUE INDEX artists_name ON artists(name);
GREPME MySQLe query failed! (1046) No database selected on CREATE TABLE images (id INTEGER PRIMARY KEY AUTO_INCREMENT,path VARCHAR(255) NOT NULL) COLLATE = utf8_bin ENGINE = MyISAM;

Reproducible: Always</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1335437</commentid>
    <comment_count>1</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2013-01-26 10:13:59 +0000</bug_when>
    <thetext>Try running this as normal user (NOT as root):

mysqlcheck --auto-repair --all-databases

Also I strongly recommend you use Amarok 2.7, sadly you didn&apos;t specify which version this is about.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336500</commentid>
    <comment_count>2</comment_count>
    <who name="Artem Vorotnikov">artem</who>
    <bug_when>2013-01-30 13:17:34 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Try running this as normal user (NOT as root):
&gt; 
&gt; -
&gt; 
&gt; Also I strongly recommend you use Amarok 2.7, sadly you didn&apos;t specify which
&gt; version this is about.

I have switched to gentoo, but still get the same error

Amarok 2.7.0, compiled w/ embedded USE flag
Your command yields
mysqlcheck: Got error: 2002: Can&apos;t connect to local MySQL server through socket &apos;/var/run/mysqld/mysqld.sock&apos; (2) when trying to connect</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336537</commentid>
    <comment_count>3</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2013-01-30 15:18:48 +0000</bug_when>
    <thetext>Sounds like a problem on your side, then, please make sure your MySQL is compiled with -fPIC enabled and check your file system permissions. Which MySQL version do you use?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336557</commentid>
    <comment_count>4</comment_count>
    <who name="Artem Vorotnikov">artem</who>
    <bug_when>2013-01-30 16:33:49 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Sounds like a problem on your side, then, please make sure your MySQL is
&gt; compiled with -fPIC enabled and check your file system permissions. Which
&gt; MySQL version do you use?

MySQL 5.5.29-r1 and do you want me to compile Amarok w/ standalone sql server (USE=&quot;-embedded&quot;)?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336563</commentid>
    <comment_count>5</comment_count>
    <who name="Artem Vorotnikov">artem</who>
    <bug_when>2013-01-30 16:48:12 +0000</bug_when>
    <thetext>Mmmm guess what? I don&apos;t get the error when I start Amarok via kdesu. This is clearly related to my using Unicode.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336722</commentid>
    <comment_count>6</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2013-01-31 09:02:55 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; Mmmm guess what? I don&apos;t get the error when I start Amarok via kdesu. This
&gt; is clearly related to my using Unicode.

Sorry, but that statement makes no sense :) And it also makes no sense that you run Amarok with root rights, but it clearly shows that there is a permissions issue on your MySQL installation, please make sure that the folder content of $HOME/.kde/share/apps/amarok/mysqle/amarok/ has correct permissions, it should be -rw-rw----</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1336886</commentid>
    <comment_count>7</comment_count>
    <who name="Artem Vorotnikov">artem</who>
    <bug_when>2013-01-31 19:21:00 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; (In reply to comment #5)
&gt; &gt; Mmmm guess what? I don&apos;t get the error when I start Amarok via kdesu. This
&gt; &gt; is clearly related to my using Unicode.
&gt; 
&gt; Sorry, but that statement makes no sense :) And it also makes no sense that
&gt; you run Amarok with root rights, but it clearly shows that there is a
&gt; permissions issue on your MySQL installation, please make sure that the
&gt; folder content of $HOME/.kde/share/apps/amarok/mysqle/amarok/ has correct
&gt; permissions, it should be -rw-rw----

Deleted the folder, started Amarok as normal user. Still the same error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1337018</commentid>
    <comment_count>8</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2013-02-01 08:19:41 +0000</bug_when>
    <thetext>You deleted the folder? That was your database, I didn&apos;t tell you to delete it...

You didn&apos;t answer my question about the MySQL version and whether it was compiled with -fPIC enabled, because this is most likely a problem with your MySQL installation, not with Amarok.

Since mysqlcheck didn&apos;t allow you to repair the database and gave you an error this is most likely the culprit</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1337022</commentid>
    <comment_count>9</comment_count>
    <who name="Artem Vorotnikov">artem</who>
    <bug_when>2013-02-01 08:30:46 +0000</bug_when>
    <thetext>(In reply to comment #8)
&gt; You deleted the folder? That was your database, I didn&apos;t tell you to delete
&gt; it...
&gt; 
&gt; You didn&apos;t answer my question about the MySQL version and whether it was
&gt; compiled with -fPIC enabled, because this is most likely a problem with your
&gt; MySQL installation, not with Amarok.
&gt; 
&gt; Since mysqlcheck didn&apos;t allow you to repair the database and gave you an
&gt; error this is most likely the culprit
I don&apos;t know if it was compiled with -fPIC (I didn&apos;t force it, at least)

I created a new user in latin alphanumerics and this problem is NOT present.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1337026</commentid>
    <comment_count>10</comment_count>
    <who name="Myriam Schweingruber">myriam</who>
    <bug_when>2013-02-01 08:36:32 +0000</bug_when>
    <thetext>Then something is wrong in your user configs, try erasing your $HOME/.kde/share/config/amarok* for your previous user.

Please take this to the forum at http://forum.kde.org/amarok, it is not an issue that belongs in the bug tracker.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1337027</commentid>
    <comment_count>11</comment_count>
    <who name="Artem Vorotnikov">artem</who>
    <bug_when>2013-02-01 08:40:32 +0000</bug_when>
    <thetext>(In reply to comment #10)
&gt; Then something is wrong in your user configs, try erasing your
&gt; $HOME/.kde/share/config/amarok* for your previous user.
&gt; 
&gt; Please take this to the forum at http://forum.kde.org/amarok, it is not an
&gt; issue that belongs in the bug tracker.

I have wiped all Amarok settings for cyrillic user but I still got the same error on startup.

This is an issue with Amarok/MySQL handling of UTF-8 characters, probably because of Qt&apos;s internal usage of UTF-16. Nevertheless, it clearly belongs to the bug tracker.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1337038</commentid>
    <comment_count>12</comment_count>
    <who name="Artem Vorotnikov">artem</who>
    <bug_when>2013-02-01 09:14:33 +0000</bug_when>
    <thetext>GREPME MySQLe query failed! (1) Can&apos;t create/write to file &apos;/home/Ð°ÑÑÑÐ¼/.kde/share/apps/amarok/mysqle/amarok/db.opt&apos; (Errcode: 2) on Could not alter database charset/collation

This is the error. Note the &quot;Ð°ÑÑÑÐ¼&quot; part. Most likely Qt sends the Ð°ÑÑÑÐ¼ instead of артём to MySQL. In order to solve it, Amarok has to invoke QString::fromUtf8 when sending the path to MySQL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1337041</commentid>
    <comment_count>13</comment_count>
    <who name="Kevin Funk">kfunk</who>
    <bug_when>2013-02-01 09:27:00 +0000</bug_when>
    <thetext>I suspect it&apos;s an Amarok bug. (Quickly scanned through the code base, so take this with a grain of salt).

MySqlEmbeddedStorage.cpp uses QString::toAscii() to store the database directory location from memory to my.cnf.
The data location (&apos;$HOME/.kde/...&apos;) itself comes from kdelibs&apos;s KGlobal::dirs(), that should not be an issue wrt encoding.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1337044</commentid>
    <comment_count>14</comment_count>
    <who name="Artem Vorotnikov">artem</who>
    <bug_when>2013-02-01 09:48:05 +0000</bug_when>
    <thetext>(In reply to comment #13)
&gt; I suspect it&apos;s an Amarok bug. (Quickly scanned through the code base, so
&gt; take this with a grain of salt).
&gt; 
&gt; MySqlEmbeddedStorage.cpp uses QString::toAscii() to store the database
&gt; directory location from memory to my.cnf.
&gt; The data location (&apos;$HOME/.kde/...&apos;) itself comes from kdelibs&apos;s
&gt; KGlobal::dirs(), that should not be an issue wrt encoding.

Changing 
datadir = /home/Ð°ÑÑÑÐ¼/.kde4/share/apps/amarok/mysqle
to
datadir = /home/артём/.kde4/share/apps/amarok/mysqle

does not work. Moreover, on the launch of Amarok home path in my.cnf becomes mojibake again.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1358939</commentid>
    <comment_count>15</comment_count>
    <who name="Matěj Laitl">matej</who>
    <bug_when>2013-04-09 20:11:32 +0000</bug_when>
    <thetext>(In reply to comment #14)
This is the cause:
&gt; Moreover, on the launch of Amarok home path in my.cnf becomes
&gt; mojibake again.

This is the consequence:
&gt; Changing 
&gt; datadir = /home/Ð°ÑÑÑÐ¼/.kde4/share/apps/amarok/mysqle
&gt; to
&gt; datadir = /home/артём/.kde4/share/apps/amarok/mysqle
&gt; 
&gt; does not work.

&gt; &gt; MySqlEmbeddedStorage.cpp uses QString::toAscii() to store the database
&gt; &gt; directory location from memory to my.cnf.

Looks like an easy fix, I&apos;ll have a look at it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1358956</commentid>
    <comment_count>16</comment_count>
    <who name="Matěj Laitl">matej</who>
    <bug_when>2013-04-09 20:42:46 +0000</bug_when>
    <thetext>Git commit 7b8266baf2f0c3afac70b8cbbc561c473a6f1322 by Matěj Laitl.
Committed on 09/04/2013 at 22:40.
Pushed by laitl into branch &apos;master&apos;.

MySqlEmbeddedStorage: don&apos;t use QString::toAscii(), fix bug 313914

It is 2013. We have more characters than 128.

BUGFIXES:
 * Fix inability to create database when home directory contains
   non-ASCII characters.
FIXED-IN: 2.8

M  +2    -0    ChangeLog
M  +3    -3    src/core-impl/collections/db/sql/mysqlecollection/MySqlEmbeddedStorage.cpp

http://commits.kde.org/amarok/7b8266baf2f0c3afac70b8cbbc561c473a6f1322</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1368865</commentid>
    <comment_count>17</comment_count>
    <who name="Matěj Laitl">matej</who>
    <bug_when>2013-05-14 21:25:30 +0000</bug_when>
    <thetext>Git commit e90f7b4b8462e674275b53d550c147bbececd467 by Matěj Laitl.
Committed on 09/04/2013 at 22:40.
Pushed by laitl into branch &apos;v2.7.x&apos;.

MySqlEmbeddedStorage: don&apos;t use QString::toAscii(), fix bug 313914

It is 2013. We have more characters than 128.

BUGFIXES:
 * Fix inability to create database when home directory contains
   non-ASCII characters.

M  +2    -0    ChangeLog
M  +3    -3    src/core-impl/collections/db/sql/mysqlecollection/MySqlEmbeddedStorage.cpp

http://commits.kde.org/amarok/e90f7b4b8462e674275b53d550c147bbececd467</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>