-
Notifications
You must be signed in to change notification settings - Fork 582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[dev.icinga.com #8289] Livestatus operator =~ is not case-insensitive #2551
Comments
Updated by mfriedrich on 2015-02-01 10:22:20 +00:00 Do you have a patch by chance? |
Updated by jyoung15 on 2015-02-02 16:27:01 +00:00
I have attached a proposed patch. I did not initially submit a patch because I"m not sure the best way to address this. Based on the code comments, it appears the original string_iless struct was based on boost::algorithm::is_iless, however for Livestatus we want to compare for equality. I chose to rename string_iless to string_iequal to better reflect it"s purpose, and because string_iless was not used anywhere else in the code base. Feel free to modify as you see fit. |
Updated by mfriedrich on 2015-02-04 20:53:36 +00:00
Thanks. Although I think it"s better not to modify string_iless but rather use an existing case-insensitive string comparison, as shown in http://stackoverflow.com/a/315463 Please test the attached patch. |
Updated by jyoung15 on 2015-02-05 16:29:51 +00:00 I tested your patch and it works as expected. Thank You! |
Updated by mfriedrich on 2015-02-05 17:07:08 +00:00
Ok thanks for testing. I"m stuffed with other tasks which is why I did that patch yesterday evening on-the-fly :) |
Updated by mfriedrich on 2015-02-05 17:10:03 +00:00
Applied in changeset d868930. |
Updated by mfriedrich on 2015-02-09 15:35:38 +00:00
|
Updated by gbeutner on 2015-02-12 15:01:38 +00:00
|
Updated by gbeutner on 2015-02-12 15:02:55 +00:00
|
Updated by gbeutner on 2015-02-13 07:08:49 +00:00
|
Updated by mfriedrich on 2015-02-13 16:27:04 +00:00
|
This issue has been migrated from Redmine: https://dev.icinga.com/issues/8289
Created by jyoung15 on 2015-01-27 01:03:00 +00:00
Assignee: mfriedrich
Status: Resolved (closed on 2015-02-05 17:10:03 +00:00)
Target Version: 2.3.0
Last Update: 2015-02-13 16:27:04 +00:00 (in Redmine)
According to documentation the =~ operator is supposed to check for equality ignoring case, but this does not happen
In attributefilter.cpp, this calls string_iless, which in turn calls strcasecmp (in string.hpp) and checks that the value is less than 0. strcasecmp returns 0 if the two strings are equal. So either change the string_iless function to check that strcasecmp == 0, or use a different string comparison function.
Attachments
Changesets
2015-02-05 17:06:10 +00:00 by mfriedrich d868930
2015-02-05 17:07:23 +00:00 by mfriedrich b189965
The text was updated successfully, but these errors were encountered: