Package: tracker-utils Version: 0.6.3-3+b1 Severity: normal Hi,
The tracker-tag utility has a bug which makes it ignore tags in Chinese (Big5 encoding, as per LC_CTYPE). Here is how to reproduce the bug: $ /usr/bin/tracker-tag -s <some Chinese string> /usr/bin/tracker-tag: internal tracker error: No keywords supplied $ Although not tested, I believe that the bug also affects tags in non-ASCII, non-UTF8 encodings. I traced the bug to program segments that (unnecessarily) attempt to convert tags from current locale to UTF8 using g_locale_to_utf8(). The conversions fail for non-ASCII, non-UTF8 strings (it looks like because some other glib function already converted the strings to UTF8?), and because tracker-tag does not check error returns from g_locale_to_utf8(), it silently ignores those tags. I found that removing the conversion code segments eliminates the bug and makes tracker-tag function correctly (tested adding, querying, and removing tags). The attached patch implements this fix. -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (900, 'testing'), (300, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.22.6 (PREEMPT) Locale: LANG=C, LC_CTYPE=zh_TW.Big5 (charmap=BIG5) Shell: /bin/sh linked to /bin/bash Versions of packages tracker-utils depends on: ii libc6 2.7-3 GNU C Library: Shared libraries ii libglib2.0-0 2.14.3-1 The GLib library of C routines ii libtrackerclient0 0.6.3-3+b1 metadata database, indexer and sea ii tracker 0.6.3-3+b1 metadata database, indexer and sea tracker-utils recommends no packages. -- no debconf information -- Chuan-kai Lin http://web.cecs.pdx.edu/~cklin/
diff -r 1eb992409382 src/libtracker/tracker-tag.c --- a/src/libtracker/tracker-tag.c Sat Dec 08 22:40:56 2007 -0800 +++ b/src/libtracker/tracker-tag.c Sat Dec 08 23:30:01 2007 -0800 @@ -155,21 +155,6 @@ } if (add || delete || remove_all) { - - if (add) - for (i = 0; add[i] != NULL; i++) { - gchar *tmp = g_locale_to_utf8 (add[i], -1, NULL, NULL, NULL); - g_free (add[i]); - add[i] = tmp; - } - - if (delete) - for (i = 0; delete[i] != NULL; i++) { - gchar *tmp = g_locale_to_utf8 (delete[i], -1, NULL, NULL, NULL); - g_free (delete[i]); - delete[i] = tmp; - } - for (i = 0; files[i] != NULL; i++) { @@ -249,15 +234,6 @@ } if (search) { - - int i = 0; - - for (i = 0; search[i] != NULL; i++) { - gchar *tmp = g_locale_to_utf8 (search[i], -1, NULL, NULL, NULL); - g_free (search[i]); - search[i] = tmp; - } - gchar **results = tracker_keywords_search (client, -1, SERVICE_FILES, search, 0, 512, &error); if (error)