{"action":"created","comment":{"url":"https://api.github.com/repos/opencontainers/runc/pulls/comments/85905952","pull_request_review_id":6591774,"id":85905952,"diff_hunk":"@@ -96,13 +96,13 @@ func (n *Namespaces) Remove(t NamespaceType) bool {\n \treturn true\n }\n \n-func (n *Namespaces) Add(t NamespaceType, path string) {\n+func (n *Namespaces) Add(t NamespaceType, path string) bool {\n \ti := n.index(t)\n \tif i == -1 {\n \t\t*n = append(*n, Namespace{Type: t, Path: path})\n-\t\treturn\n+\t\treturn true\n \t}\n-\t(*n)[i].Path = path\n+\treturn false\n }","path":"libcontainer/configs/namespaces_unix.go","position":14,"original_position":14,"commit_id":"aa06c0a18d394cac7c4b72acc8eed7638286648c","original_commit_id":"aa06c0a18d394cac7c4b72acc8eed7638286648c","user":{"login":"cyphar","id":2888411,"avatar_url":"https://avatars.githubusercontent.com/u/2888411?v=3","gravatar_id":"","url":"https://api.github.com/users/cyphar","html_url":"https://github.com/cyphar","followers_url":"https://api.github.com/users/cyphar/followers","following_url":"https://api.github.com/users/cyphar/following{/other_user}","gists_url":"https://api.github.com/users/cyphar/gists{/gist_id}","starred_url":"https://api.github.com/users/cyphar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyphar/subscriptions","organizations_url":"https://api.github.com/users/cyphar/orgs","repos_url":"https://api.github.com/users/cyphar/repos","events_url":"https://api.github.com/users/cyphar/events{/privacy}","received_events_url":"https://api.github.com/users/cyphar/received_events","type":"User","site_admin":false},"body":"I don't see how this modification is sufficient to forbit duplicate namespaces. Also, you haven't changed any of the callers of `.Add` to use the new function signature (so the build is failing).","created_at":"2016-11-01T10:36:54Z","updated_at":"2016-11-01T10:36:54Z","html_url":"https://github.com/opencontainers/runc/pull/1169#discussion_r85905952","pull_request_url":"https://api.github.com/repos/opencontainers/runc/pulls/1169","_links":{"self":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/comments/85905952"},"html":{"href":"https://github.com/opencontainers/runc/pull/1169#discussion_r85905952"},"pull_request":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/1169"}}},"pull_request":{"url":"https://api.github.com/repos/opencontainers/runc/pulls/1169","id":91753638,"html_url":"https://github.com/opencontainers/runc/pull/1169","diff_url":"https://github.com/opencontainers/runc/pull/1169.diff","patch_url":"https://github.com/opencontainers/runc/pull/1169.patch","issue_url":"https://api.github.com/repos/opencontainers/runc/issues/1169","number":1169,"state":"open","locked":false,"title":"Forbid adding duplicated namespace","user":{"login":"YummyPeng","id":20569488,"avatar_url":"https://avatars.githubusercontent.com/u/20569488?v=3","gravatar_id":"","url":"https://api.github.com/users/YummyPeng","html_url":"https://github.com/YummyPeng","followers_url":"https://api.github.com/users/YummyPeng/followers","following_url":"https://api.github.com/users/YummyPeng/following{/other_user}","gists_url":"https://api.github.com/users/YummyPeng/gists{/gist_id}","starred_url":"https://api.github.com/users/YummyPeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YummyPeng/subscriptions","organizations_url":"https://api.github.com/users/YummyPeng/orgs","repos_url":"https://api.github.com/users/YummyPeng/repos","events_url":"https://api.github.com/users/YummyPeng/events{/privacy}","received_events_url":"https://api.github.com/users/YummyPeng/received_events","type":"User","site_admin":false},"body":"We now forbid duplicated namespace in spec([#1150](https://github.com/opencontainers/runc/pull/1150)), if there is a duplicated namespace, then it'll just return with error in `CreateLibcontainerConfig()`:\r\n\r\n```bash\r\nfor _, ns := range spec.Linux.Namespaces {\r\n                t, exists := namespaceMapping[ns.Type]\r\n                if !exists {\r\n                        return nil, fmt.Errorf(\"namespace %q does not exist\", ns)\r\n                }\r\n                if config.Namespaces.Contains(t) {\r\n                        return nil, fmt.Errorf(\"malformed spec file: duplicated ns %q\", ns)\r\n                }\r\n                config.Namespaces.Add(t, ns.Path)\r\n        }\r\n```\r\n\r\nSo, as far as I can see, the last line of code in `Add()` will never be reached here. Therefore, I just modified this func to be consistent with `Remove()`. Besides, this modification also forbids adding duplicated namespace to make the logic more clear.\r\n\r\nSigned-off-by: Yuanhong Peng pengyuanhong@huawei.com","created_at":"2016-11-01T09:27:11Z","updated_at":"2016-11-01T10:36:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"131cd2988700cf8969640486282b4a20b0ad600e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/opencontainers/runc/pulls/1169/commits","review_comments_url":"https://api.github.com/repos/opencontainers/runc/pulls/1169/comments","review_comment_url":"https://api.github.com/repos/opencontainers/runc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opencontainers/runc/issues/1169/comments","statuses_url":"https://api.github.com/repos/opencontainers/runc/statuses/aa06c0a18d394cac7c4b72acc8eed7638286648c","head":{"label":"YummyPeng:forbid_adding_duplicated_namespace","ref":"forbid_adding_duplicated_namespace","sha":"aa06c0a18d394cac7c4b72acc8eed7638286648c","user":{"login":"YummyPeng","id":20569488,"avatar_url":"https://avatars.githubusercontent.com/u/20569488?v=3","gravatar_id":"","url":"https://api.github.com/users/YummyPeng","html_url":"https://github.com/YummyPeng","followers_url":"https://api.github.com/users/YummyPeng/followers","following_url":"https://api.github.com/users/YummyPeng/following{/other_user}","gists_url":"https://api.github.com/users/YummyPeng/gists{/gist_id}","starred_url":"https://api.github.com/users/YummyPeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YummyPeng/subscriptions","organizations_url":"https://api.github.com/users/YummyPeng/orgs","repos_url":"https://api.github.com/users/YummyPeng/repos","events_url":"https://api.github.com/users/YummyPeng/events{/privacy}","received_events_url":"https://api.github.com/users/YummyPeng/received_events","type":"User","site_admin":false},"repo":{"id":67466818,"name":"runc","full_name":"YummyPeng/runc","owner":{"login":"YummyPeng","id":20569488,"avatar_url":"https://avatars.githubusercontent.com/u/20569488?v=3","gravatar_id":"","url":"https://api.github.com/users/YummyPeng","html_url":"https://github.com/YummyPeng","followers_url":"https://api.github.com/users/YummyPeng/followers","following_url":"https://api.github.com/users/YummyPeng/following{/other_user}","gists_url":"https://api.github.com/users/YummyPeng/gists{/gist_id}","starred_url":"https://api.github.com/users/YummyPeng/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/YummyPeng/subscriptions","organizations_url":"https://api.github.com/users/YummyPeng/orgs","repos_url":"https://api.github.com/users/YummyPeng/repos","events_url":"https://api.github.com/users/YummyPeng/events{/privacy}","received_events_url":"https://api.github.com/users/YummyPeng/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/YummyPeng/runc","description":"runc container cli tools","fork":true,"url":"https://api.github.com/repos/YummyPeng/runc","forks_url":"https://api.github.com/repos/YummyPeng/runc/forks","keys_url":"https://api.github.com/repos/YummyPeng/runc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/YummyPeng/runc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/YummyPeng/runc/teams","hooks_url":"https://api.github.com/repos/YummyPeng/runc/hooks","issue_events_url":"https://api.github.com/repos/YummyPeng/runc/issues/events{/number}","events_url":"https://api.github.com/repos/YummyPeng/runc/events","assignees_url":"https://api.github.com/repos/YummyPeng/runc/assignees{/user}","branches_url":"https://api.github.com/repos/YummyPeng/runc/branches{/branch}","tags_url":"https://api.github.com/repos/YummyPeng/runc/tags","blobs_url":"https://api.github.com/repos/YummyPeng/runc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/YummyPeng/runc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/YummyPeng/runc/git/refs{/sha}","trees_url":"https://api.github.com/repos/YummyPeng/runc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/YummyPeng/runc/statuses/{sha}","languages_url":"https://api.github.com/repos/YummyPeng/runc/languages","stargazers_url":"https://api.github.com/repos/YummyPeng/runc/stargazers","contributors_url":"https://api.github.com/repos/YummyPeng/runc/contributors","subscribers_url":"https://api.github.com/repos/YummyPeng/runc/subscribers","subscription_url":"https://api.github.com/repos/YummyPeng/runc/subscription","commits_url":"https://api.github.com/repos/YummyPeng/runc/commits{/sha}","git_commits_url":"https://api.github.com/repos/YummyPeng/runc/git/commits{/sha}","comments_url":"https://api.github.com/repos/YummyPeng/runc/comments{/number}","issue_comment_url":"https://api.github.com/repos/YummyPeng/runc/issues/comments{/number}","contents_url":"https://api.github.com/repos/YummyPeng/runc/contents/{+path}","compare_url":"https://api.github.com/repos/YummyPeng/runc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/YummyPeng/runc/merges","archive_url":"https://api.github.com/repos/YummyPeng/runc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/YummyPeng/runc/downloads","issues_url":"https://api.github.com/repos/YummyPeng/runc/issues{/number}","pulls_url":"https://api.github.com/repos/YummyPeng/runc/pulls{/number}","milestones_url":"https://api.github.com/repos/YummyPeng/runc/milestones{/number}","notifications_url":"https://api.github.com/repos/YummyPeng/runc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/YummyPeng/runc/labels{/name}","releases_url":"https://api.github.com/repos/YummyPeng/runc/releases{/id}","deployments_url":"https://api.github.com/repos/YummyPeng/runc/deployments","created_at":"2016-09-06T02:37:44Z","updated_at":"2016-09-06T02:37:47Z","pushed_at":"2016-11-01T09:33:22Z","git_url":"git://github.com/YummyPeng/runc.git","ssh_url":"git@github.com:YummyPeng/runc.git","clone_url":"https://github.com/YummyPeng/runc.git","svn_url":"https://github.com/YummyPeng/runc","homepage":"https://www.opencontainers.org/","size":3784,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"opencontainers:master","ref":"master","sha":"bc462c96bf7b15b68ab40e86335cefcb692707c1","user":{"login":"opencontainers","id":12563465,"avatar_url":"https://avatars.githubusercontent.com/u/12563465?v=3","gravatar_id":"","url":"https://api.github.com/users/opencontainers","html_url":"https://github.com/opencontainers","followers_url":"https://api.github.com/users/opencontainers/followers","following_url":"https://api.github.com/users/opencontainers/following{/other_user}","gists_url":"https://api.github.com/users/opencontainers/gists{/gist_id}","starred_url":"https://api.github.com/users/opencontainers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencontainers/subscriptions","organizations_url":"https://api.github.com/users/opencontainers/orgs","repos_url":"https://api.github.com/users/opencontainers/repos","events_url":"https://api.github.com/users/opencontainers/events{/privacy}","received_events_url":"https://api.github.com/users/opencontainers/received_events","type":"Organization","site_admin":false},"repo":{"id":36960321,"name":"runc","full_name":"opencontainers/runc","owner":{"login":"opencontainers","id":12563465,"avatar_url":"https://avatars.githubusercontent.com/u/12563465?v=3","gravatar_id":"","url":"https://api.github.com/users/opencontainers","html_url":"https://github.com/opencontainers","followers_url":"https://api.github.com/users/opencontainers/followers","following_url":"https://api.github.com/users/opencontainers/following{/other_user}","gists_url":"https://api.github.com/users/opencontainers/gists{/gist_id}","starred_url":"https://api.github.com/users/opencontainers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opencontainers/subscriptions","organizations_url":"https://api.github.com/users/opencontainers/orgs","repos_url":"https://api.github.com/users/opencontainers/repos","events_url":"https://api.github.com/users/opencontainers/events{/privacy}","received_events_url":"https://api.github.com/users/opencontainers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opencontainers/runc","description":"CLI tool for spawning and running containers according to the OCI specification","fork":false,"url":"https://api.github.com/repos/opencontainers/runc","forks_url":"https://api.github.com/repos/opencontainers/runc/forks","keys_url":"https://api.github.com/repos/opencontainers/runc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opencontainers/runc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opencontainers/runc/teams","hooks_url":"https://api.github.com/repos/opencontainers/runc/hooks","issue_events_url":"https://api.github.com/repos/opencontainers/runc/issues/events{/number}","events_url":"https://api.github.com/repos/opencontainers/runc/events","assignees_url":"https://api.github.com/repos/opencontainers/runc/assignees{/user}","branches_url":"https://api.github.com/repos/opencontainers/runc/branches{/branch}","tags_url":"https://api.github.com/repos/opencontainers/runc/tags","blobs_url":"https://api.github.com/repos/opencontainers/runc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opencontainers/runc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opencontainers/runc/git/refs{/sha}","trees_url":"https://api.github.com/repos/opencontainers/runc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opencontainers/runc/statuses/{sha}","languages_url":"https://api.github.com/repos/opencontainers/runc/languages","stargazers_url":"https://api.github.com/repos/opencontainers/runc/stargazers","contributors_url":"https://api.github.com/repos/opencontainers/runc/contributors","subscribers_url":"https://api.github.com/repos/opencontainers/runc/subscribers","subscription_url":"https://api.github.com/repos/opencontainers/runc/subscription","commits_url":"https://api.github.com/repos/opencontainers/runc/commits{/sha}","git_commits_url":"https://api.github.com/repos/opencontainers/runc/git/commits{/sha}","comments_url":"https://api.github.com/repos/opencontainers/runc/comments{/number}","issue_comment_url":"https://api.github.com/repos/opencontainers/runc/issues/comments{/number}","contents_url":"https://api.github.com/repos/opencontainers/runc/contents/{+path}","compare_url":"https://api.github.com/repos/opencontainers/runc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opencontainers/runc/merges","archive_url":"https://api.github.com/repos/opencontainers/runc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opencontainers/runc/downloads","issues_url":"https://api.github.com/repos/opencontainers/runc/issues{/number}","pulls_url":"https://api.github.com/repos/opencontainers/runc/pulls{/number}","milestones_url":"https://api.github.com/repos/opencontainers/runc/milestones{/number}","notifications_url":"https://api.github.com/repos/opencontainers/runc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opencontainers/runc/labels{/name}","releases_url":"https://api.github.com/repos/opencontainers/runc/releases{/id}","deployments_url":"https://api.github.com/repos/opencontainers/runc/deployments","created_at":"2015-06-05T23:30:45Z","updated_at":"2016-10-31T10:59:48Z","pushed_at":"2016-11-01T09:33:22Z","git_url":"git://github.com/opencontainers/runc.git","ssh_url":"git@github.com:opencontainers/runc.git","clone_url":"https://github.com/opencontainers/runc.git","svn_url":"https://github.com/opencontainers/runc","homepage":"https://www.opencontainers.org/","size":6551,"stargazers_count":3209,"watchers_count":3209,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":472,"mirror_url":null,"open_issues_count":92,"forks":472,"open_issues":92,"watchers":3209,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/1169"},"html":{"href":"https://github.com/opencontainers/runc/pull/1169"},"issue":{"href":"https://api.github.com/repos/opencontainers/runc/issues/1169"},"comments":{"href":"https://api.github.com/repos/opencontainers/runc/issues/1169/comments"},"review_comments":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/1169/comments"},"review_comment":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/1169/commits"},"statuses":{"href":"https://api.github.com/repos/opencontainers/runc/statuses/aa06c0a18d394cac7c4b72acc8eed7638286648c"}}}}
{"actor":{"display_login":"cyphar"}}