Skip to content
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

Closed
icinga-migration opened this issue Jan 27, 2015 · 11 comments
Closed
Labels
area/livestatus Legacy interface bug Something isn't working
Milestone

Comments

@icinga-migration
Copy link

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)

Icinga Version: 2.2.4
Include in Changelog: 1

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

Livestatus: Fix case-insensitive comparison operator

fixes #8289

Signed-off-by: Michael Friedrich <[email protected]>

2015-02-05 17:07:23 +00:00 by mfriedrich b189965

Livestatus: Fix case-insensitive comparison operator

fixes #8289

Signed-off-by: Michael Friedrich <[email protected]>
@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-02-01 10:22:20 +00:00

Do you have a patch by chance?

@icinga-migration
Copy link
Author

Updated by jyoung15 on 2015-02-02 16:27:01 +00:00

  • File added 0001-Update-Livestatus-operator-to-check-equality-ignorin.patch

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.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-02-04 20:53:36 +00:00

  • File added 0001-Livestatus-Fix-case-insensitive-comparison-operator.patch
  • Status changed from New to Feedback
  • Assigned to set to jyoung15

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.

@icinga-migration
Copy link
Author

Updated by jyoung15 on 2015-02-05 16:29:51 +00:00

I tested your patch and it works as expected. Thank You!

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-02-05 17:07:08 +00:00

  • Status changed from Feedback to Assigned
  • Assigned to changed from jyoung15 to mfriedrich
  • Target Version set to 243

Ok thanks for testing. I"m stuffed with other tasks which is why I did that patch yesterday evening on-the-fly :)

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-02-05 17:10:03 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset d868930.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-02-09 15:35:38 +00:00

  • Target Version changed from 243 to 2.3.0

@icinga-migration
Copy link
Author

Updated by gbeutner on 2015-02-12 15:01:38 +00:00

  • Include in Changelog set to 0

@icinga-migration
Copy link
Author

Updated by gbeutner on 2015-02-12 15:02:55 +00:00

  • Icinga Version changed from 2 to 2
  • Include in Changelog changed from 0 to 1

@icinga-migration
Copy link
Author

Updated by gbeutner on 2015-02-13 07:08:49 +00:00

  • Subject changed from problem with livestatus =~ operator to Livestatus operator =~ is not case-insensitive

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-02-13 16:27:04 +00:00

  • Estimated Hours set to 2

@icinga-migration icinga-migration added bug Something isn't working area/livestatus Legacy interface labels Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.3.0 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/livestatus Legacy interface bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant