libct/cgroup/utils: fix GetCgroupMounts(all=true) #2689
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
all
argument was introduced by commit f557996 (PR #1049) specificallyfor use by cAdvisor (see google/cadvisor#1476), but there were no test cases added,
so it was later accidentally broken by 5ee0648 (#1817) which started incrementing
numFound
unconditionally.Fix this (by not checking
numFound
whenall
is true), and add asimple test case to avoid future regressions.
PS It appears to be that cadvisor is the only user of
all=true
functionality.If we could eliminate it, we would remove
all=true
entirely, but it's not clearhow to do that. I sincerely hope one day cgroup v1 is going away entirely,
including all this code.