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

patch for issue #39 #121

Closed
wants to merge 2 commits into from
Closed

Conversation

jhjeong-kr
Copy link
Contributor

Signed-off-by: Jin-Hwan Jeong jhjeong.kr@gmail.com

@lizf-os
Copy link
Contributor

lizf-os commented Jul 14, 2015

You should write better commit message, like use a proper subject.

You may take this one as an example:4e24410

@jhjeong-kr
Copy link
Contributor Author

@lizf-os Sorry for the simple comment. I revised the comment.

@jhjeong-kr jhjeong-kr changed the title patch for issue #39: see my comment on issue #39 for the detail explanation patch for issue #39 Jul 14, 2015
if cmdline, err := ioutil.ReadFile(procPath); err == nil {
_, exeName := filepath.Split(string(cmdline))
exeName = exeName[0:4]
if exeName[0:4] == "runc" {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point exeName[0:4] is equal to exeName. You should remove the line above or just use exeName here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikedanese Actually, exeName ends with white character and the length of exeName is 5. Therefore the expression is required. Instead, the line can be refined as exeName[0:len(runcName) - 1] if "runc" is assigned into contant runcName.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I'm following you. I'm saying at line 168 exeName is equal to exeName[0:4] and len(exeName) == 4 because you set exeName = exeName[0:4] the line before. In the same way, for any string s s == s[0:len(s)]. This code would function the exact same way without line 167.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikedanese oh, I got the point. I understood.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another thought, line 167 will panic with 'slice bounds out of range' if the exeName is less than 4 characters long.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mikedanese yes, thanks. I will modify the code

@mikedanese
Copy link

What if runc is called from an absolute path?

@jhjeong-kr
Copy link
Contributor Author

@mikedanese it works fine

@mikedanese
Copy link

Ahh ok I see.

	runc always shows "container in use" if /var/run/ocf/container exists
	However, there are two cases
		1) case 1: "container in use"
		2) case 2: /var/run/ocf/container still exists after runc was terminated by SIGKILL or abnormal crash
	For case 2, runc should yield "delete the lock dir" instead of "container in use"
	This patch is for this issue using "pid" file in /var/run/ocf/container/task

Signed-off-by: Jin-Hwan Jeong <jhjeong.kr@gmail.com>

    patch for issue opencontainers#39:
        runc always shows "container in use" if /var/run/ocf/container exists
        However, there are two cases
                1) case 1: "container in use"
                2) case 2: /var/run/ocf/container still exists after runc was terminated by SIGKILL or abnormal crash
        For case 2, runc should yield "delete the lock dir" instead of "container in use"
        This patch is for this issue using "pid" file in /var/run/ocf/container/task
	Also, I refined indentation and added code for slice length check

Signed-off-by: Jin-Hwan Jeong <jhjeong.kr@gmail.com>
@jhjeong-kr
Copy link
Contributor Author

I revised the code as commented

     runc always shows "container in use" if /var/run/ocf/container exists
     However, there are two cases
         1) case 1: "container in use"
         2) case 2: /var/run/ocf/container still exists after runc was terminated by SIGKILL or abnormal crash
     For case 2, runc should yield "delete the lock dir" instead of "container in use"
     This patch is for this issue using "pid" file in /var/run/ocf/container/task
     minor revision opencontainers#1: error indentation, slice length check for "exeName"
     minor revision opencontainers#2: use "filepath.join" instead of "fmt.Sprintf"

Signed-off-by: Jin-Hwan Jeong <jhjeong.kr@gmail.com>
@mrunalp
Copy link
Contributor

mrunalp commented Aug 18, 2015

I think we can close this as kill command was added in #178

@mrunalp mrunalp closed this Aug 18, 2015
stefanberger pushed a commit to stefanberger/runc that referenced this pull request Sep 8, 2017
…omment-typo

runtime_config_linux: Fix 'LinuxSpec' -> 'LinuxRuntimeSpec' in comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants