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 755327 - Logs force quit while the field value in search text is a number
Logs force quit while the field value in search text is a number
Status: RESOLVED FIXED
Product: gnome-logs
Classification: Other
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: gnome-logs maintainer(s)
gnome-logs maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-09-21 08:11 UTC by Jonathan Kang
Modified: 2015-09-22 10:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for this bug (1.07 KB, patch)
2015-09-21 08:14 UTC, Jonathan Kang
needs-work Details | Review
patch updated (2.39 KB, patch)
2015-09-21 11:44 UTC, Jonathan Kang
committed Details | Review

Description Jonathan Kang 2015-09-21 08:11:40 UTC
If field_value of search text is a number, for example "_MESSAGE=628" or "_COMM=systemd _MESSAGE=25", Logs will force stop.
Comment 1 Jonathan Kang 2015-09-21 08:14:43 UTC
Created attachment 311733 [details] [review]
patch for this bug
Comment 2 David King 2015-09-21 08:53:34 UTC
Review of attachment 311733 [details] [review]:

::: src/gl-eventviewlist.c
@@ +157,2 @@
         g_scanner_get_next_token (scanner);
+        if (scanner->token == G_TOKEN_INT)

Does this also deal with other token types, such as G_TOKEN_HEX and G_TOKEN_FLOAT?
Comment 3 Lars Karlitski 2015-09-21 09:21:57 UTC
Review of attachment 311733 [details] [review]:

Yes, this is good.

However, there are more unchecked uses of v_identifier in that file. Please always check the token type before accessing the union, otherwise we might see more crashes like this.

More generally, why is gnome-logs doing the matching itself? I think it would be much more efficient to let the journal do the matching (it has indices for many fields).
Comment 4 Jonathan Kang 2015-09-21 11:44:49 UTC
Created attachment 311744 [details] [review]
patch updated
Comment 5 David King 2015-09-22 10:44:37 UTC
Review of attachment 311744 [details] [review]:

Works for me! Pushed to master as commit 5e18cf0c9ca2c3146e7a58bd0ccc42386e1c4290.
Comment 6 David King 2015-09-22 10:51:14 UTC
(In reply to Lars Uebernickel from comment #3)
> More generally, why is gnome-logs doing the matching itself? I think it
> would be much more efficient to let the journal do the matching (it has
> indices for many fields).

It has always done so, by using the filtering and sorting in GtkListBox. It was the simplest approach at the time, but now that GListModel is used, we should be using the journal APIs (so that we can search for items that are not shown in the list box, at the very least).