{"action":"created","comment":{"url":"https://api.github.com/repos/opencontainers/runc/pulls/comments/63462149","id":63462149,"diff_hunk":"@@ -1,138 +1,27 @@\n-// +build linux\n-\n package main\n \n import (\n-\t\"os\"\n-\t\"runtime\"\n+\t\"syscall\"\n \n \t\"github.com/codegangsta/cli\"\n-\t\"github.com/coreos/go-systemd/activation\"\n-\t\"github.com/opencontainers/runc/libcontainer\"\n-\t\"github.com/opencontainers/runtime-spec/specs-go\"\n )\n \n-// default action is to start a container\n var startCommand = cli.Command{\n \tName:  \"start\",\n-\tUsage: \"create and run a container\",\n+\tUsage: \"start signals a created container to execute the users defined process\",\n \tArgsUsage: `<container-id>\n \n Where \"<container-id>\" is your name for the instance of the container that you\n are starting. The name you provide for the container instance must be unique on\n your host.`,\n-\tDescription: `The start command creates an instance of a container for a bundle. The bundle\n-is a directory with a specification file named \"` + specConfig + `\" and a root\n-filesystem.\n-\n-The specification file includes an args parameter. The args parameter is used\n-to specify command(s) that get run when the container is started. To change the\n-command(s) that get executed on start, edit the args parameter of the spec. See\n-\"runc spec --help\" for more explanation.`,\n-\tFlags: []cli.Flag{\n-\t\tcli.StringFlag{\n-\t\t\tName:  \"bundle, b\",\n-\t\t\tValue: \"\",\n-\t\t\tUsage: `path to the root of the bundle directory, defaults to the current directory`,\n-\t\t},\n-\t\tcli.StringFlag{\n-\t\t\tName:  \"console\",\n-\t\t\tValue: \"\",\n-\t\t\tUsage: \"specify the pty slave path for use with the container\",\n-\t\t},\n-\t\tcli.BoolFlag{\n-\t\t\tName:  \"detach,d\",\n-\t\t\tUsage: \"detach from the container's process\",\n-\t\t},\n-\t\tcli.StringFlag{\n-\t\t\tName:  \"pid-file\",\n-\t\t\tValue: \"\",\n-\t\t\tUsage: \"specify the file to write the process id to\",\n-\t\t},\n-\t\tcli.BoolFlag{\n-\t\t\tName:  \"no-subreaper\",\n-\t\t\tUsage: \"disable the use of the subreaper used to reap reparented processes\",\n-\t\t},\n-\t\tcli.BoolFlag{\n-\t\t\tName:  \"no-pivot\",\n-\t\t\tUsage: \"do not use pivot root to jail process inside rootfs.  This should be used whenever the rootfs is on top of a ramdisk\",\n-\t\t},\n-\t},\n+\tDescription: `The start command signals the container to start the user's defined process.`,\n \tAction: func(context *cli.Context) {\n-\t\tbundle := context.String(\"bundle\")\n-\t\tif bundle != \"\" {\n-\t\t\tif err := os.Chdir(bundle); err != nil {\n-\t\t\t\tfatal(err)\n-\t\t\t}\n-\t\t}\n-\t\tspec, err := loadSpec(specConfig)\n+\t\tcontainer, err := getContainer(context)\n \t\tif err != nil {\n \t\t\tfatal(err)\n \t\t}\n-\n-\t\tnotifySocket := os.Getenv(\"NOTIFY_SOCKET\")\n-\t\tif notifySocket != \"\" {\n-\t\t\tsetupSdNotify(spec, notifySocket)\n-\t\t}\n-\n-\t\tif os.Geteuid() != 0 {\n-\t\t\tfatalf(\"runc should be run as root\")\n-\t\t}\n-\n-\t\tstatus, err := startContainer(context, spec)\n-\t\tif err != nil {\n+\t\tif err := container.Signal(syscall.SIGCONT); err != nil {","path":"start.go","position":88,"original_position":88,"commit_id":"572055dddd466279cc8c56c858b2bbd7e1f3fd3f","original_commit_id":"572055dddd466279cc8c56c858b2bbd7e1f3fd3f","user":{"login":"wking","id":209920,"avatar_url":"https://avatars.githubusercontent.com/u/209920?v=3","gravatar_id":"","url":"https://api.github.com/users/wking","html_url":"https://github.com/wking","followers_url":"https://api.github.com/users/wking/followers","following_url":"https://api.github.com/users/wking/following{/other_user}","gists_url":"https://api.github.com/users/wking/gists{/gist_id}","starred_url":"https://api.github.com/users/wking/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wking/subscriptions","organizations_url":"https://api.github.com/users/wking/orgs","repos_url":"https://api.github.com/users/wking/repos","events_url":"https://api.github.com/users/wking/events{/privacy}","received_events_url":"https://api.github.com/users/wking/received_events","type":"User","site_admin":false},"body":"On Mon, May 16, 2016 at 09:00:22PM -0700, Kenfe-Mickaël Laventure wrote:\n> We can also simply reset the signal handler before doing the execve.\n\nThat happens automatically, no?  Also from signal(7):\n\n  “During an execve(2), the dispositions of handled signals are reset\n  to the default; the dispositions of ignored signals are left\n  unchanged.”\n\nWhat needs to happen is that after a SIGCONT is received, you block\n(somehow) ‘create’ from sending further SIGCONTs, then consume any\nSIGCONTs from the pending queue, and then execve the user code.\n","created_at":"2016-05-17T04:10:49Z","updated_at":"2016-05-17T04:10:49Z","html_url":"https://github.com/opencontainers/runc/pull/827#discussion_r63462149","pull_request_url":"https://api.github.com/repos/opencontainers/runc/pulls/827","_links":{"self":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/comments/63462149"},"html":{"href":"https://github.com/opencontainers/runc/pull/827#discussion_r63462149"},"pull_request":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/827"}}},"pull_request":{"url":"https://api.github.com/repos/opencontainers/runc/pulls/827","id":70276278,"html_url":"https://github.com/opencontainers/runc/pull/827","diff_url":"https://github.com/opencontainers/runc/pull/827.diff","patch_url":"https://github.com/opencontainers/runc/pull/827.patch","issue_url":"https://api.github.com/repos/opencontainers/runc/issues/827","number":827,"state":"open","locked":false,"title":"Implement create and start","user":{"login":"crosbymichael","id":749551,"avatar_url":"https://avatars.githubusercontent.com/u/749551?v=3","gravatar_id":"","url":"https://api.github.com/users/crosbymichael","html_url":"https://github.com/crosbymichael","followers_url":"https://api.github.com/users/crosbymichael/followers","following_url":"https://api.github.com/users/crosbymichael/following{/other_user}","gists_url":"https://api.github.com/users/crosbymichael/gists{/gist_id}","starred_url":"https://api.github.com/users/crosbymichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crosbymichael/subscriptions","organizations_url":"https://api.github.com/users/crosbymichael/orgs","repos_url":"https://api.github.com/users/crosbymichael/repos","events_url":"https://api.github.com/users/crosbymichael/events{/privacy}","received_events_url":"https://api.github.com/users/crosbymichael/received_events","type":"User","site_admin":false},"body":"This implements create and start in runc without the need for a unix socket or other complexity.  It implements it by blocking the init process waiting on a `SIGCONT` before the users process is started.  \r\n\r\nThis does not remove hooks, that can be done separately.  This also updates the libcontainer stats to correctly report if the container is created vs running(user code).  \r\n\r\nIt does not bind mount namespaces, if you want namespaces to be bind mounted then you can write code to bind them after `create` returns and before calling `start`.  \r\n\r\nIt retains the current functionality of `start` today by adding a `runc run` command that does the same workflow as today. ","created_at":"2016-05-16T23:06:31Z","updated_at":"2016-05-17T04:10:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aba652120909ff677828d54158f772a447ec4f6f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/opencontainers/runc/pulls/827/commits","review_comments_url":"https://api.github.com/repos/opencontainers/runc/pulls/827/comments","review_comment_url":"https://api.github.com/repos/opencontainers/runc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opencontainers/runc/issues/827/comments","statuses_url":"https://api.github.com/repos/opencontainers/runc/statuses/572055dddd466279cc8c56c858b2bbd7e1f3fd3f","head":{"label":"crosbymichael:create-start","ref":"create-start","sha":"572055dddd466279cc8c56c858b2bbd7e1f3fd3f","user":{"login":"crosbymichael","id":749551,"avatar_url":"https://avatars.githubusercontent.com/u/749551?v=3","gravatar_id":"","url":"https://api.github.com/users/crosbymichael","html_url":"https://github.com/crosbymichael","followers_url":"https://api.github.com/users/crosbymichael/followers","following_url":"https://api.github.com/users/crosbymichael/following{/other_user}","gists_url":"https://api.github.com/users/crosbymichael/gists{/gist_id}","starred_url":"https://api.github.com/users/crosbymichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crosbymichael/subscriptions","organizations_url":"https://api.github.com/users/crosbymichael/orgs","repos_url":"https://api.github.com/users/crosbymichael/repos","events_url":"https://api.github.com/users/crosbymichael/events{/privacy}","received_events_url":"https://api.github.com/users/crosbymichael/received_events","type":"User","site_admin":false},"repo":{"id":38062262,"name":"runc","full_name":"crosbymichael/runc","owner":{"login":"crosbymichael","id":749551,"avatar_url":"https://avatars.githubusercontent.com/u/749551?v=3","gravatar_id":"","url":"https://api.github.com/users/crosbymichael","html_url":"https://github.com/crosbymichael","followers_url":"https://api.github.com/users/crosbymichael/followers","following_url":"https://api.github.com/users/crosbymichael/following{/other_user}","gists_url":"https://api.github.com/users/crosbymichael/gists{/gist_id}","starred_url":"https://api.github.com/users/crosbymichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crosbymichael/subscriptions","organizations_url":"https://api.github.com/users/crosbymichael/orgs","repos_url":"https://api.github.com/users/crosbymichael/repos","events_url":"https://api.github.com/users/crosbymichael/events{/privacy}","received_events_url":"https://api.github.com/users/crosbymichael/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/crosbymichael/runc","description":"runc container cli tools","fork":true,"url":"https://api.github.com/repos/crosbymichael/runc","forks_url":"https://api.github.com/repos/crosbymichael/runc/forks","keys_url":"https://api.github.com/repos/crosbymichael/runc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crosbymichael/runc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crosbymichael/runc/teams","hooks_url":"https://api.github.com/repos/crosbymichael/runc/hooks","issue_events_url":"https://api.github.com/repos/crosbymichael/runc/issues/events{/number}","events_url":"https://api.github.com/repos/crosbymichael/runc/events","assignees_url":"https://api.github.com/repos/crosbymichael/runc/assignees{/user}","branches_url":"https://api.github.com/repos/crosbymichael/runc/branches{/branch}","tags_url":"https://api.github.com/repos/crosbymichael/runc/tags","blobs_url":"https://api.github.com/repos/crosbymichael/runc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crosbymichael/runc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crosbymichael/runc/git/refs{/sha}","trees_url":"https://api.github.com/repos/crosbymichael/runc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crosbymichael/runc/statuses/{sha}","languages_url":"https://api.github.com/repos/crosbymichael/runc/languages","stargazers_url":"https://api.github.com/repos/crosbymichael/runc/stargazers","contributors_url":"https://api.github.com/repos/crosbymichael/runc/contributors","subscribers_url":"https://api.github.com/repos/crosbymichael/runc/subscribers","subscription_url":"https://api.github.com/repos/crosbymichael/runc/subscription","commits_url":"https://api.github.com/repos/crosbymichael/runc/commits{/sha}","git_commits_url":"https://api.github.com/repos/crosbymichael/runc/git/commits{/sha}","comments_url":"https://api.github.com/repos/crosbymichael/runc/comments{/number}","issue_comment_url":"https://api.github.com/repos/crosbymichael/runc/issues/comments{/number}","contents_url":"https://api.github.com/repos/crosbymichael/runc/contents/{+path}","compare_url":"https://api.github.com/repos/crosbymichael/runc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crosbymichael/runc/merges","archive_url":"https://api.github.com/repos/crosbymichael/runc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crosbymichael/runc/downloads","issues_url":"https://api.github.com/repos/crosbymichael/runc/issues{/number}","pulls_url":"https://api.github.com/repos/crosbymichael/runc/pulls{/number}","milestones_url":"https://api.github.com/repos/crosbymichael/runc/milestones{/number}","notifications_url":"https://api.github.com/repos/crosbymichael/runc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crosbymichael/runc/labels{/name}","releases_url":"https://api.github.com/repos/crosbymichael/runc/releases{/id}","deployments_url":"https://api.github.com/repos/crosbymichael/runc/deployments","created_at":"2015-06-25T16:59:57Z","updated_at":"2016-02-20T12:32:13Z","pushed_at":"2016-05-17T00:47:47Z","git_url":"git://github.com/crosbymichael/runc.git","ssh_url":"git@github.com:crosbymichael/runc.git","clone_url":"https://github.com/crosbymichael/runc.git","svn_url":"https://github.com/crosbymichael/runc","homepage":"","size":3130,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"opencontainers:master","ref":"master","sha":"f0ec80b93c7b7ae9549d1ecd2ca870873f329656","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":"runc container cli tools","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-05-17T01:46:48Z","pushed_at":"2016-05-17T02:32:21Z","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":5454,"stargazers_count":2766,"watchers_count":2766,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":353,"mirror_url":null,"open_issues_count":70,"forks":353,"open_issues":70,"watchers":2766,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/827"},"html":{"href":"https://github.com/opencontainers/runc/pull/827"},"issue":{"href":"https://api.github.com/repos/opencontainers/runc/issues/827"},"comments":{"href":"https://api.github.com/repos/opencontainers/runc/issues/827/comments"},"review_comments":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/827/comments"},"review_comment":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opencontainers/runc/pulls/827/commits"},"statuses":{"href":"https://api.github.com/repos/opencontainers/runc/statuses/572055dddd466279cc8c56c858b2bbd7e1f3fd3f"}}}}