Bug 122168 - Collection scanner can't read tags with non-ASCII characters
Summary: Collection scanner can't read tags with non-ASCII characters
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 1.4-SVN
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
: 122345 122614 122615 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-02-17 18:10 UTC by Thomas Stuart
Modified: 2006-06-11 12:32 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Stuart 2006-02-17 18:10:25 UTC
Version:           1.4-SVN (using KDE KDE 3.5.0KDE 3.4.2)
Installed from:    Compiled From SourcesCompiled From Sources
Compiler:          gcc 4.0.2 
OS:                Linux

Seems like there have been similar problems with previous versions, but I've not come across this before, and it's only been happening for me on recent (post 1.4-beta1) SVN builds. Amarok reads the tags of these files (like Hoppípolla by Sigur Rós) fine, but they don't get added to the collection on a scan. An example file is available to download at http://therye.org/users/mortice/test/
Comment 1 Thomas Stuart 2006-02-17 18:22:52 UTC
I should say that the example track is Glósóli by Sigur Rós, since I've uploaded two other files to that directory for other bug reports. :)
Comment 2 Mark Kretschmann 2006-02-17 19:16:30 UTC
Yeah that's a problem with the new SQLite 3.3.4 library, which we just upgraded to. See this SQLite bug report we made:

http://www.sqlite.org/cvstrac/tktview?tn=1681
Comment 3 Mark Kretschmann 2006-02-20 14:23:54 UTC
*** Bug 122345 has been marked as a duplicate of this bug. ***
Comment 4 Lukas Wolf 2006-02-23 13:47:08 UTC
I have exactly the same results with SQLite as reported on www.sqlite.org. But with MySql I have the bug too! On stderr there is no ERROR message like with SQLite...
Comment 5 Dany Martineau 2006-02-24 04:57:53 UTC
It's strange because i tried to compile amarok-SVN with --without-included-sqlite (using sqlite 3.2.8 from ubuntu dapper) and i have this bug too!  More than 1000 songs are not scanned.  I reinstalled amarok-1.4 beta 1 and the problem's gone!
I also tried with mysql and the bug persist!  Strange indeed!
Comment 6 Mark Kretschmann 2006-02-24 11:07:57 UTC
Just to be sure, I went back to SQLite 3.2.7 and tested. No errors at all with this version.

So, it's definitely a SQLite 3.3.X issue.
Comment 7 Mark Kretschmann 2006-02-24 11:28:44 UTC
*** Bug 122614 has been marked as a duplicate of this bug. ***
Comment 8 Mark Kretschmann 2006-02-24 11:29:09 UTC
*** Bug 122615 has been marked as a duplicate of this bug. ***
Comment 9 Mark Kretschmann 2006-02-24 18:27:52 UTC
SVN commit 513240 by markey:

Downgrade SQLite to version 3.2.7, until the problems with non-ASCII characters are fixed. 

NOTE: You may need to delete your collection.db, since the database format was changed between 3.2 and 3.3.

CCBUG: 122168


 M  +0 -1      ChangeLog  
 M  +0 -1      src/sqlite/Makefile.am  
 M  +31 -36    src/sqlite/alter.c  
 M  +11 -28    src/sqlite/analyze.c  
 M  +123 -264  src/sqlite/attach.c  
 M  +3 -10     src/sqlite/auth.c  
 M  +283 -1089 src/sqlite/btree.c  
 M  +2 -6      src/sqlite/btree.h  
 M  +220 -503  src/sqlite/build.c  
 M  +11 -20    src/sqlite/callback.c  
 M  +2 -2      src/sqlite/complete.c  
 M  +12 -14    src/sqlite/date.c  
 M  +24 -31    src/sqlite/delete.c  
 M  +98 -151   src/sqlite/expr.c  
 M  +46 -65    src/sqlite/func.c  
 M  +0 -5      src/sqlite/hash.c  
 M  +50 -60    src/sqlite/insert.c  
 M  +31 -32    src/sqlite/keywordhash.h  
 M  +6 -3      src/sqlite/legacy.c  
 M  +196 -369  src/sqlite/main.c  
 M  +101 -108  src/sqlite/opcodes.c  
 M  +111 -121  src/sqlite/opcodes.h  
 D             src/sqlite/os.c  
 M  +41 -274   src/sqlite/os.h  
 M  +1 -66     src/sqlite/os_common.h  
 M  +229 -697  src/sqlite/os_unix.c  
 M  +132 -708  src/sqlite/os_win.c  
 M  +363 -535  src/sqlite/pager.c  
 M  +1 -7      src/sqlite/pager.h  
 M  +2087 -1941 src/sqlite/parse.c  
 M  +145 -151  src/sqlite/parse.h  
 M  +58 -84    src/sqlite/pragma.c  
 M  +87 -180   src/sqlite/prepare.c  
 M  +15 -17    src/sqlite/printf.c  
 M  +199 -369  src/sqlite/select.c  
 M  +8 -211    src/sqlite/sqlite3.h  
 M  +107 -217  src/sqlite/sqliteInt.h  
 M  +1 -6      src/sqlite/table.c  
 M  +9 -19     src/sqlite/tokenize.c  
 M  +52 -61    src/sqlite/trigger.c  
 M  +14 -16    src/sqlite/update.c  
 M  +4 -30     src/sqlite/utf.c  
 M  +239 -664  src/sqlite/util.c  
 M  +18 -37    src/sqlite/vacuum.c  
 M  +299 -552  src/sqlite/vdbe.c  
 M  +1 -13     src/sqlite/vdbe.h  
 M  +7 -18     src/sqlite/vdbeInt.h  
 M  +34 -112   src/sqlite/vdbeapi.c  
 M  +117 -257  src/sqlite/vdbeaux.c  
 M  +29 -73    src/sqlite/vdbemem.c  
 M  +75 -145   src/sqlite/where.c  
Comment 10 Andrew Gaydenko 2006-02-24 19:31:03 UTC
I have tried with downgraded sqlite and have got the same result. To be sure I have renamed (old) ~/.kde/share/apps/amarok dir. And, to be more sure :-), I have found the sqlite3.h file has this string:

#define SQLITE_VERSION         "3.2.7"
Comment 11 LuRan 2006-02-25 11:26:31 UTC
I tried the new svn code, tags with non-ascii chars works fine, however amarok somehow ignored the directory with non-ascii chars, maybe that was the problme Andrew mentioned, should I open a new bug?
Comment 12 Andrew Gaydenko 2006-02-25 12:54:03 UTC
Dir's name? Not in my case. A dir name and 'ls' out are below. Only 4th and 6th tracks were hooked with scanner. All tracks with 'é' char in file name are skipped.

# cd /x/sound/ARCHIVE/Jazz/jacquesLoussier/bach1
anli bach1 # ls
01 - Prélude #1.flac                                                05 - Choral 'Jésus Que Ma Joie Demeure'.flac
02 - Partita En Si Bémol - Allemande, Courante.flac                 06 - Aria.flac
03 - Partita En Si Bémol - Sarabande, Menuet1, Menuet2, Gigue.flac  07 - Toccata Et Fugue En Ré Mineur.flac
04 - Choral #1.flac                                                 08 - Prélude #12.flac
Comment 13 LuRan 2006-02-25 13:02:30 UTC
I should say dirs and files instead of dirs :)
Comment 14 Mark Kretschmann 2006-02-25 13:23:59 UTC
Yeah it's a regression in the directory reading code, which I've just ported 
over from 1.3. Gonna look at it sometime.
Comment 15 Mark Kretschmann 2006-02-25 17:26:56 UTC
SVN commit 513565 by markey:

Fix problems with non-ASCII paths.

CCBUG: 122168



 M  +1 -1      collectionscanner.cpp  


--- trunk/extragear/multimedia/amarok/src/collectionscanner/collectionscanner.cpp #513564:513565
@@ -229,7 +229,7 @@
         }
 
         else if( S_ISREG( statBuf.st_mode ) )
-            entries.append( entry );
+            entries.append( QFile::decodeName( entry ) );
     }
 
     closedir( d );
Comment 16 Andrew Gaydenko 2006-02-25 19:00:46 UTC
Mark,

Thanks! The problem is resolved for me. I'm ready to try with sqlite 3.3.x.
Comment 17 Mark Kretschmann 2006-03-04 10:14:39 UTC
Now, some news: Richard Hipp (SQLite creator) has replied to our bug report. Check this:

http://www.sqlite.org/cvstrac/tktview?tn=1681

Not too encouraging. Any SQLite expert here who could look at what we might be doing wrong?
Comment 18 Lukas Wolf 2006-03-05 23:35:07 UTC
Hi Mark! 

Thanks a lot for you investment! Amarok is incredible!
I first had the bug with mysql which you resolved with your patch. After reading your latest post I tried it with sqlite and everything is working perfectly for me. So why should you be doing something wrong? ;-)

Thanks and greetings, Lukas Wolf
Comment 19 Gábor Lehel 2006-03-13 22:54:40 UTC
SVN commit 518398 by illissius:

fix the sqlite-doesn't-like-weird-characters bug with later versions (3.3.4 e.g.)
the bug turned out to be that sqlite3_prepare() expects length as the number of bytes, not characters -- so using string.length() just happened to work when only the ASCII subset of UTF-8 was used, but otherwise broke. This is fixed by telling it to just read until the null at the end. (Maybe previous versions of SQLite do this always, which is why they don't trigger the bug?)
BUG:122168


 M  +2 -2      collectiondb.cpp  


--- trunk/extragear/multimedia/amarok/src/collectiondb.cpp #518397:518398
@@ -3148,7 +3148,7 @@
     sqlite3_stmt* stmt;
 
     //compile SQL program to virtual machine
-    error = sqlite3_prepare( m_db, statement.utf8(), statement.length(), &stmt, &tail );
+    error = sqlite3_prepare( m_db, statement.utf8(), -1, &stmt, &tail );
 
     if ( error != SQLITE_OK )
     {
@@ -3208,7 +3208,7 @@
     const char* tail;
     sqlite3_stmt* stmt;
     //compile SQL program to virtual machine
-    error = sqlite3_prepare( m_db, statement.utf8(), statement.length(), &stmt, &tail );
+    error = sqlite3_prepare( m_db, statement.utf8(), -1, &stmt, &tail );
 
     if ( error != SQLITE_OK )
     {