-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
utils: fix parsing of cgroup with : in the name #6823
utils: fix parsing of cgroup with : in the name #6823
Conversation
a cgroup can have ':' in its name. Make sure the parser doesn't split more than 3 fields and leave untouched the ':' in the cgroup name. commit 6ee5f74 introduced the issue. Signed-off-by: Giuseppe Scrivano <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: giuseppe The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
LGTM |
/lgtm |
@@ -116,7 +116,7 @@ func MoveUnderCgroupSubtree(subtree string) error { | |||
scanner := bufio.NewScanner(f) | |||
for scanner.Scan() { | |||
line := scanner.Text() | |||
parts := strings.Split(line, ":") | |||
parts := strings.SplitN(line, ":", 3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SplitN is your friend, I'd this very lesson this week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/lgtm |
/hold cancel |
a cgroup can have ':' in its name. Make sure the parser doesn't split
more than 3 fields and leave untouched the ':' in the cgroup name.
commit 6ee5f74 introduced the issue.
Signed-off-by: Giuseppe Scrivano [email protected]