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

Revert "curl_xml plugin: Fixed tautological pointer comparison error." #935

Closed
wants to merge 2 commits into from

Conversation

faxm0dem
Copy link
Contributor

@faxm0dem faxm0dem commented Feb 9, 2015

Fixes #931
This reverts commit 0afea60.

@mfournier mfournier added the Bug A genuine bug label Feb 24, 2015
Change-Id: I9a3fc3ded9566bd68c80e5fbce2d8b717ea1848d
@faxm0dem
Copy link
Contributor Author

As suggested by @mfournier, rather than reverting the patch I fixed the test.

Notes

Sorry if any or all of these seem obvious to the reader:

  • The initial patch fixed a clang compiler error: it detected the codepath inside the if was never reached
  • The patch 0afea60 introduced a new bug: it unlocked the previously hidden codepath and made it impossible to use Xpath/InstanceFrom if the XPath expression returns more than one result (is_table)
  • The proposed change 94ba3c7 fixes the test (tested with our initial config where XPath expression returns more than one result)

Conclusion

I suggest using one of the following solutions:

  1. The one proposed in commit 94ba3c7
  2. Remove the if ... {} code altogether

The first solution seems to be the best approach, however due to lacking test suite it would be safer to use the second: it would fix the clang error and not change the plugin functionally

@mfournier
Copy link

Thanks for taking care of this @faxm0dem !

I grabbed the opportunity to test out this CI system I working on, and these 2 patches together build fine on a range of gcc and clang versions, with -Wall -Werror. So at least the toolchain deities would be satisfied with this :)

I'd favor the 1st option too. As you seem to be familiar with this issue, would you mind sharing some XML and corresponding collectd config snippets, both with and without the xpath table (ie: some way to test the different conditions which would pass through this block of code) ? Thanks !

@faxm0dem
Copy link
Contributor Author

faxm0dem commented May 3, 2015

I'll do that ASAP. Shall I create a directory maybe in src/tests/fixtures/curl_xml/?

@mfournier
Copy link

@faxm0dem mmh, I don't think it's a good idea to start adding random bits of input/output/config to the git repo, without the tests that go with them. If you're able to prove this patchset doesn't change the functionnality of the plugin with a couple of xml & config snippets (shared as comments in this PR would be sufficient AFAIC), it would be great!

You're of course welcome to add some actual tests. But I didn't dig into this much yet, so I won't be of much help. Maybe @octo could give some guidance on how this would be done in this case ?

faxm0dem pushed a commit to faxm0dem/collectd that referenced this pull request May 6, 2015
See collectd#935

Change-Id: I930f4bf00c8d14bf6784c6372e8b7386d6ecd971
faxm0dem pushed a commit to faxm0dem/collectd that referenced this pull request May 6, 2015
See collectd#935

Change-Id: I930f4bf00c8d14bf6784c6372e8b7386d6ecd971
@faxm0dem
Copy link
Contributor Author

faxm0dem commented May 6, 2015

Okay, no problem just thought we could start adding some fixtures there.
Here's what I came up with

mfournier pushed a commit to mfournier/collectd that referenced this pull request May 12, 2015
Discovered while testing the previous 2 commits. NB: valgrind
already complained about these before 0afea60 was applied, so this
isn't related to issue collectd#935.
@mfournier
Copy link

Thanks @faxm0dem, this was very helpful !

I noticed that the examples you provided triggered a couple of resource leaks I corrected in af8f87e. Are you able to test curl_xml with this last patch on other configs than the 2 you provided above ?

Other than that, I tested this patchset on a couple of different distros, with different libxml versions, built both with clang and gcc with -Wall -Werror, and all went well.

So just waiting for your feedback on af8f87e before merging this branch.

@faxm0dem
Copy link
Contributor Author

Unfortunately although slightly stripped down this is the only use-case I h̶a̶v̶e̶had.

mfournier pushed a commit that referenced this pull request May 19, 2015
Discovered while testing the previous 2 commits. NB: valgrind
already complained about these before 0afea60 was applied, so this
isn't related to issue #935.
@mfournier
Copy link

Merged to the oldest release branch as 5e9542b, 6ad8d0d and c6da31f. Many thanks @faxm0dem !!

@mfournier mfournier closed this May 19, 2015
@octo octo added Fix A pull request fixing a bug and removed Bug A genuine bug labels Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix A pull request fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

curl_xml: Tables broken
3 participants