After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 570209 - tracker_data_manager_set_db_option_int() uses incorrect parameter order for SetOption
tracker_data_manager_set_db_option_int() uses incorrect parameter order for S...
Status: RESOLVED FIXED
Product: tracker
Classification: Core
Component: General
git master
Other All
: Normal major
: ---
Assigned To: tracker-daemon
Jamie McCracken
Depends on:
Blocks:
 
 
Reported: 2009-02-02 13:31 UTC by TJ
Modified: 2010-05-17 13:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Correct parameter order (trunk) (652 bytes, patch)
2009-02-02 13:33 UTC, TJ
committed Details | Review
Correct parameter order (0.6.6) (519 bytes, patch)
2009-02-02 13:33 UTC, TJ
none Details | Review

Description TJ 2009-02-02 13:31:49 UTC
Please describe the problem:
Note: This also affects 0.6.6 in src/trackerd/tracker-db-sqlite.c::tracker_db_set_option_string()

The sqlite stored procedure defined in data/sqlite-stored-procs.sql

 SetOption REPLACE into Options (OptionKey, OptionValue) values (?,?);

is incorrectly called from src/trackerd/tracker-db-sqlite.c::tracker_db_set_option_string()

	tracker_exec_proc (db_con->common, "SetOption", 2, value, option);

parameters 'value' and 'option' order is back-to-front.

This has a serious knock-on effect since the sqlite database at ~/.local/share/tracker/data/common.db has the table "Options" with two columns: OptionKey, OptionValue and in the system *tries* to store the "IntegrityCheck" option

Steps to reproduce:
1. Examine the Options table of common.db after several trackerd cycles
2. There will be one or more IntegrityCheck entries in the OptionValue column, with the value in the OptionKey column



Actual results:
The incorrect parameter order is seen

Expected results:
OptionKey=IntegrityCheck, OptionValue=0 or 1

Does this happen every time?
Yes

Other information:
Existing installations will need a post-install/update script to clean the incorrect entries from the table.

sqlite3 common.db "delete from Options where OptionValue='IntegrityCheck';"
Comment 1 TJ 2009-02-02 13:33:14 UTC
Created attachment 127760 [details] [review]
Correct parameter order (trunk)
Comment 2 TJ 2009-02-02 13:33:59 UTC
Created attachment 127761 [details] [review]
Correct parameter order (0.6.6)
Comment 3 TJ 2009-02-02 14:21:24 UTC
On trunk the bug is in src/libtracker-data/tracker-data-manager.c::tracker_data_manager_set_db_option_int():

result_set = tracker_data_manager_exec_proc (iface, "SetOption", option, str, NULL);
Comment 4 Martyn Russell 2009-02-02 14:39:48 UTC
TJ, thanks for the patch, I will look into this.
Comment 5 Martyn Russell 2009-02-02 14:50:12 UTC
Thanks for the patch TJ, committed.
Comment 6 Martyn Russell 2010-05-17 13:35:20 UTC
Moving "Daemon" component bugs to "General" since "Daemon" refers to the old 0.6 architecture