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 647331 - Tracker backend hits SPARQL constraint failure when saving contact with email address
Tracker backend hits SPARQL constraint failure when saving contact with email...
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: Tracker backend
git master
Other Linux
: Normal normal
: Unset
Assigned To: folks-maint
folks-maint
Depends on:
Blocks: 646831
 
 
Reported: 2011-04-10 00:42 UTC by Travis Reitter
Modified: 2011-04-11 15:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Tracker backend output and stack trace for the email address insert warning (8.01 KB, text/plain)
2011-04-10 00:42 UTC, Travis Reitter
  Details
Add convience has_email method to EmailDetails interface (1.08 KB, patch)
2011-04-10 14:51 UTC, Raul Gutierrez Segales
none Details | Review
Handle setting an email that alreaady exists in Tracker (4.91 KB, patch)
2011-04-10 14:51 UTC, Raul Gutierrez Segales
none Details | Review
Add a test for the problem being approached (setting existing emails) (7.64 KB, patch)
2011-04-10 14:52 UTC, Raul Gutierrez Segales
none Details | Review
Add convience has_email method to EmailDetails interface (1.08 KB, patch)
2011-04-11 11:02 UTC, Raul Gutierrez Segales
accepted-commit_now Details | Review
Handle setting an email or phone that alreaady exists in Tracker (9.77 KB, patch)
2011-04-11 11:03 UTC, Raul Gutierrez Segales
accepted-commit_now Details | Review
Add a test for setting an existing email (7.64 KB, patch)
2011-04-11 11:04 UTC, Raul Gutierrez Segales
accepted-commit_now Details | Review

Description Travis Reitter 2011-04-10 00:42:32 UTC
Created attachment 185623 [details]
Tracker backend output and stack trace for the email address insert warning

I've hit the attached warning when saving changes to a contact that has an email address. It doesn't happen for phone numbers, which are nearly identical (from a Folks perspective).
Comment 1 Raul Gutierrez Segales 2011-04-10 08:18:44 UTC
This is related, if not a duplicate, to bug #646831.
Comment 2 Raul Gutierrez Segales 2011-04-10 14:51:21 UTC
Created attachment 185641 [details] [review]
Add convience has_email method to EmailDetails interface
Comment 3 Raul Gutierrez Segales 2011-04-10 14:51:49 UTC
Created attachment 185642 [details] [review]
Handle setting an email that alreaady exists in Tracker
Comment 4 Raul Gutierrez Segales 2011-04-10 14:52:17 UTC
Created attachment 185643 [details] [review]
Add a test for the problem being approached (setting existing emails)
Comment 5 Raul Gutierrez Segales 2011-04-10 14:53:00 UTC
The attached patch-set fixes the problem, I also add a new public method (to the EmailDetails interface) so that should receive special attention when reviewed.
Comment 6 Raul Gutierrez Segales 2011-04-11 11:02:42 UTC
Created attachment 185692 [details] [review]
Add convience has_email method to EmailDetails interface

Refreshing the patch-set to also handle setting phones.
Comment 7 Raul Gutierrez Segales 2011-04-11 11:03:46 UTC
Created attachment 185693 [details] [review]
Handle setting an email or phone that alreaady exists in Tracker
Comment 8 Raul Gutierrez Segales 2011-04-11 11:04:34 UTC
Created attachment 185694 [details] [review]
Add a test for setting an existing email
Comment 9 Travis Reitter 2011-04-11 14:12:10 UTC
Review of attachment 185692 [details] [review]:

+  public bool has_email (string email)

I think this should be private. In theory, it's generally-useful, but I think it crowds the API more than it's worth.

After fixing that, please merge.
Comment 10 Travis Reitter 2011-04-11 14:18:09 UTC
Review of attachment 185693 [details] [review]:

+  private async void _build_update_query (
+      Tracker.Sparql.Builder builder,
+      owned GLib.List<FieldDetails> properties,
+      string contact_var,
+      Trf.Attrib what)

"what" isn't very descriptive for a variable. Please rename to "attrib" or "attribute"

+  internal async void _set_unique_attrib (Folks.Persona persona,
+      owned GLib.List<FieldDetails> properties, Trf.Attrib what)

same here

After those changes, please merge

This seems to also completely fix bug #646831, so please include that in the NEWS as well, and close it after closing this.
Comment 11 Travis Reitter 2011-04-11 14:18:17 UTC
Review of attachment 185694 [details] [review]:

Looks good.
Comment 12 Raul Gutierrez Segales 2011-04-11 14:52:09 UTC
(In reply to comment #9)
> Review of attachment 185692 [details] [review]:
> 
> +  public bool has_email (string email)
> 
> I think this should be private. In theory, it's generally-useful, but I think
> it crowds the API more than it's worth.
> 
> After fixing that, please merge.

As discussed in IRC, has_email can't be private (since it needs to be called from tests so I'll just move this code to the specific test that needs it.
Comment 13 Raul Gutierrez Segales 2011-04-11 15:26:47 UTC
Merged:

commit 6064e680ea0154579d499dd3d9140f2a9fbcef54
Author: Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>
Date:   Sun Apr 10 15:18:02 2011 +0100

    Add test for setting an existing email an a Trf.Persona

 tests/tracker/Makefile.am              |    6 +
 tests/tracker/set-duplicate-email.vala |  226 ++++++++++++++++++++++++++++++++
 2 files changed, 232 insertions(+), 0 deletions(-)

commit 80ad989ec0f785561986ab417917a46554fc9636
Author: Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk>
Date:   Sun Apr 10 15:17:30 2011 +0100

    Handle setting existing emails/phones in a Trf.Persona

 NEWS                                        |    2 +
 backends/tracker/lib/trf-persona-store.vala |  191 ++++++++++++++++-----------
 2 files changed, 117 insertions(+), 76 deletions(-)