{"action":"created","comment":{"url":"https://api.github.com/repos/snapcore/snapd/pulls/comments/224345179","pull_request_review_id":163684537,"id":224345179,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNDM0NTE3OQ==","diff_hunk":"@@ -218,6 +222,29 @@ var (\n \tclassicModelOptional = []string{\"architecture\", \"gadget\"}\n )\n \n+var almostValidName = regexp.MustCompile(\"^[a-z0-9-]*[a-z][a-z0-9-]*$\")\n+\n+// validateSnapName checks whether the name can be used as a snap name\n+//\n+// This function should be synchronized with the reference implementation\n+// snap.ValidateName() in snap/validate.go\n+func validateSnapName(name string) error {\n+\tisValidName := func() bool {\n+\t\tif !almostValidName.MatchString(name) {\n+\t\t\treturn false\n+\t\t}\n+\t\tif name[0] == '-' || name[len(name)-1] == '-' || strings.Contains(name, \"--\") {\n+\t\t\treturn false\n+\t\t}\n+\t\treturn true\n+\t}\n+\n+\tif len(name) > 40 || !isValidName() {\n+\t\treturn fmt.Errorf(\"invalid snap name: %q\", name)","path":"asserts/device_asserts.go","position":33,"original_position":33,"commit_id":"7b3e08cc515cc840fe8ae3dc700921859ba48381","original_commit_id":"7b3e08cc515cc840fe8ae3dc700921859ba48381","user":{"login":"pedronis","id":975757,"node_id":"MDQ6VXNlcjk3NTc1Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/975757?v=4","gravatar_id":"","url":"https://api.github.com/users/pedronis","html_url":"https://github.com/pedronis","followers_url":"https://api.github.com/users/pedronis/followers","following_url":"https://api.github.com/users/pedronis/following{/other_user}","gists_url":"https://api.github.com/users/pedronis/gists{/gist_id}","starred_url":"https://api.github.com/users/pedronis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedronis/subscriptions","organizations_url":"https://api.github.com/users/pedronis/orgs","repos_url":"https://api.github.com/users/pedronis/repos","events_url":"https://api.github.com/users/pedronis/events{/privacy}","received_events_url":"https://api.github.com/users/pedronis/received_events","type":"User","site_admin":false},"body":"would be good to follow the style of errors here and have  \"invalid snap name in header %q: %s\" in this","created_at":"2018-10-11T07:41:01Z","updated_at":"2018-10-11T07:43:38Z","html_url":"https://github.com/snapcore/snapd/pull/5948#discussion_r224345179","pull_request_url":"https://api.github.com/repos/snapcore/snapd/pulls/5948","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/comments/224345179"},"html":{"href":"https://github.com/snapcore/snapd/pull/5948#discussion_r224345179"},"pull_request":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/5948"}}},"pull_request":{"url":"https://api.github.com/repos/snapcore/snapd/pulls/5948","id":221059683,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIxMDU5Njgz","html_url":"https://github.com/snapcore/snapd/pull/5948","diff_url":"https://github.com/snapcore/snapd/pull/5948.diff","patch_url":"https://github.com/snapcore/snapd/pull/5948.patch","issue_url":"https://api.github.com/repos/snapcore/snapd/issues/5948","number":5948,"state":"open","locked":false,"title":"asserts, image: ensure kernel, gadget, base and required-snaps use valid snap names","user":{"login":"bboozzoo","id":41870,"node_id":"MDQ6VXNlcjQxODcw","avatar_url":"https://avatars3.githubusercontent.com/u/41870?v=4","gravatar_id":"","url":"https://api.github.com/users/bboozzoo","html_url":"https://github.com/bboozzoo","followers_url":"https://api.github.com/users/bboozzoo/followers","following_url":"https://api.github.com/users/bboozzoo/following{/other_user}","gists_url":"https://api.github.com/users/bboozzoo/gists{/gist_id}","starred_url":"https://api.github.com/users/bboozzoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bboozzoo/subscriptions","organizations_url":"https://api.github.com/users/bboozzoo/orgs","repos_url":"https://api.github.com/users/bboozzoo/repos","events_url":"https://api.github.com/users/bboozzoo/events{/privacy}","received_events_url":"https://api.github.com/users/bboozzoo/received_events","type":"User","site_admin":false},"body":"Drop a similar check in `image`, since this is enforced when decoding model assertion.\r\n","created_at":"2018-10-08T09:57:26Z","updated_at":"2018-10-11T07:43:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b5cde7f2c0c5734fb49380e0160274beebaa2ec","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1010194691,"node_id":"MDU6TGFiZWwxMDEwMTk0Njkx","url":"https://api.github.com/repos/snapcore/snapd/labels/Parallel%20installs%20%E2%9B%93","name":"Parallel installs ⛓","color":"40afd1","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/snapcore/snapd/pulls/5948/commits","review_comments_url":"https://api.github.com/repos/snapcore/snapd/pulls/5948/comments","review_comment_url":"https://api.github.com/repos/snapcore/snapd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/snapcore/snapd/issues/5948/comments","statuses_url":"https://api.github.com/repos/snapcore/snapd/statuses/7b3e08cc515cc840fe8ae3dc700921859ba48381","head":{"label":"bboozzoo:bboozzoo/parallel-installs-deviceasserts-valid-snap-names","ref":"bboozzoo/parallel-installs-deviceasserts-valid-snap-names","sha":"7b3e08cc515cc840fe8ae3dc700921859ba48381","user":{"login":"bboozzoo","id":41870,"node_id":"MDQ6VXNlcjQxODcw","avatar_url":"https://avatars3.githubusercontent.com/u/41870?v=4","gravatar_id":"","url":"https://api.github.com/users/bboozzoo","html_url":"https://github.com/bboozzoo","followers_url":"https://api.github.com/users/bboozzoo/followers","following_url":"https://api.github.com/users/bboozzoo/following{/other_user}","gists_url":"https://api.github.com/users/bboozzoo/gists{/gist_id}","starred_url":"https://api.github.com/users/bboozzoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bboozzoo/subscriptions","organizations_url":"https://api.github.com/users/bboozzoo/orgs","repos_url":"https://api.github.com/users/bboozzoo/repos","events_url":"https://api.github.com/users/bboozzoo/events{/privacy}","received_events_url":"https://api.github.com/users/bboozzoo/received_events","type":"User","site_admin":false},"repo":{"id":109232638,"node_id":"MDEwOlJlcG9zaXRvcnkxMDkyMzI2Mzg=","name":"snapd","full_name":"bboozzoo/snapd","private":false,"owner":{"login":"bboozzoo","id":41870,"node_id":"MDQ6VXNlcjQxODcw","avatar_url":"https://avatars3.githubusercontent.com/u/41870?v=4","gravatar_id":"","url":"https://api.github.com/users/bboozzoo","html_url":"https://github.com/bboozzoo","followers_url":"https://api.github.com/users/bboozzoo/followers","following_url":"https://api.github.com/users/bboozzoo/following{/other_user}","gists_url":"https://api.github.com/users/bboozzoo/gists{/gist_id}","starred_url":"https://api.github.com/users/bboozzoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bboozzoo/subscriptions","organizations_url":"https://api.github.com/users/bboozzoo/orgs","repos_url":"https://api.github.com/users/bboozzoo/repos","events_url":"https://api.github.com/users/bboozzoo/events{/privacy}","received_events_url":"https://api.github.com/users/bboozzoo/received_events","type":"User","site_admin":false},"html_url":"https://github.com/bboozzoo/snapd","description":"The snapd and snap tools enable systems to work with .snap files.","fork":true,"url":"https://api.github.com/repos/bboozzoo/snapd","forks_url":"https://api.github.com/repos/bboozzoo/snapd/forks","keys_url":"https://api.github.com/repos/bboozzoo/snapd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bboozzoo/snapd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bboozzoo/snapd/teams","hooks_url":"https://api.github.com/repos/bboozzoo/snapd/hooks","issue_events_url":"https://api.github.com/repos/bboozzoo/snapd/issues/events{/number}","events_url":"https://api.github.com/repos/bboozzoo/snapd/events","assignees_url":"https://api.github.com/repos/bboozzoo/snapd/assignees{/user}","branches_url":"https://api.github.com/repos/bboozzoo/snapd/branches{/branch}","tags_url":"https://api.github.com/repos/bboozzoo/snapd/tags","blobs_url":"https://api.github.com/repos/bboozzoo/snapd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bboozzoo/snapd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bboozzoo/snapd/git/refs{/sha}","trees_url":"https://api.github.com/repos/bboozzoo/snapd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bboozzoo/snapd/statuses/{sha}","languages_url":"https://api.github.com/repos/bboozzoo/snapd/languages","stargazers_url":"https://api.github.com/repos/bboozzoo/snapd/stargazers","contributors_url":"https://api.github.com/repos/bboozzoo/snapd/contributors","subscribers_url":"https://api.github.com/repos/bboozzoo/snapd/subscribers","subscription_url":"https://api.github.com/repos/bboozzoo/snapd/subscription","commits_url":"https://api.github.com/repos/bboozzoo/snapd/commits{/sha}","git_commits_url":"https://api.github.com/repos/bboozzoo/snapd/git/commits{/sha}","comments_url":"https://api.github.com/repos/bboozzoo/snapd/comments{/number}","issue_comment_url":"https://api.github.com/repos/bboozzoo/snapd/issues/comments{/number}","contents_url":"https://api.github.com/repos/bboozzoo/snapd/contents/{+path}","compare_url":"https://api.github.com/repos/bboozzoo/snapd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bboozzoo/snapd/merges","archive_url":"https://api.github.com/repos/bboozzoo/snapd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bboozzoo/snapd/downloads","issues_url":"https://api.github.com/repos/bboozzoo/snapd/issues{/number}","pulls_url":"https://api.github.com/repos/bboozzoo/snapd/pulls{/number}","milestones_url":"https://api.github.com/repos/bboozzoo/snapd/milestones{/number}","notifications_url":"https://api.github.com/repos/bboozzoo/snapd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bboozzoo/snapd/labels{/name}","releases_url":"https://api.github.com/repos/bboozzoo/snapd/releases{/id}","deployments_url":"https://api.github.com/repos/bboozzoo/snapd/deployments","created_at":"2017-11-02T07:37:26Z","updated_at":"2018-09-17T10:22:14Z","pushed_at":"2018-10-11T07:03:40Z","git_url":"git://github.com/bboozzoo/snapd.git","ssh_url":"git@github.com:bboozzoo/snapd.git","clone_url":"https://github.com/bboozzoo/snapd.git","svn_url":"https://github.com/bboozzoo/snapd","homepage":"","size":74548,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"snapcore:master","ref":"master","sha":"e42fa7bac59e8d3e0d4c0f246678899e1c2acec3","user":{"login":"snapcore","id":19532717,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NTMyNzE3","avatar_url":"https://avatars1.githubusercontent.com/u/19532717?v=4","gravatar_id":"","url":"https://api.github.com/users/snapcore","html_url":"https://github.com/snapcore","followers_url":"https://api.github.com/users/snapcore/followers","following_url":"https://api.github.com/users/snapcore/following{/other_user}","gists_url":"https://api.github.com/users/snapcore/gists{/gist_id}","starred_url":"https://api.github.com/users/snapcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snapcore/subscriptions","organizations_url":"https://api.github.com/users/snapcore/orgs","repos_url":"https://api.github.com/users/snapcore/repos","events_url":"https://api.github.com/users/snapcore/events{/privacy}","received_events_url":"https://api.github.com/users/snapcore/received_events","type":"Organization","site_admin":false},"repo":{"id":44672744,"node_id":"MDEwOlJlcG9zaXRvcnk0NDY3Mjc0NA==","name":"snapd","full_name":"snapcore/snapd","private":false,"owner":{"login":"snapcore","id":19532717,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5NTMyNzE3","avatar_url":"https://avatars1.githubusercontent.com/u/19532717?v=4","gravatar_id":"","url":"https://api.github.com/users/snapcore","html_url":"https://github.com/snapcore","followers_url":"https://api.github.com/users/snapcore/followers","following_url":"https://api.github.com/users/snapcore/following{/other_user}","gists_url":"https://api.github.com/users/snapcore/gists{/gist_id}","starred_url":"https://api.github.com/users/snapcore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snapcore/subscriptions","organizations_url":"https://api.github.com/users/snapcore/orgs","repos_url":"https://api.github.com/users/snapcore/repos","events_url":"https://api.github.com/users/snapcore/events{/privacy}","received_events_url":"https://api.github.com/users/snapcore/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/snapcore/snapd","description":"The snapd and snap tools enable systems to work with .snap files.","fork":false,"url":"https://api.github.com/repos/snapcore/snapd","forks_url":"https://api.github.com/repos/snapcore/snapd/forks","keys_url":"https://api.github.com/repos/snapcore/snapd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/snapcore/snapd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/snapcore/snapd/teams","hooks_url":"https://api.github.com/repos/snapcore/snapd/hooks","issue_events_url":"https://api.github.com/repos/snapcore/snapd/issues/events{/number}","events_url":"https://api.github.com/repos/snapcore/snapd/events","assignees_url":"https://api.github.com/repos/snapcore/snapd/assignees{/user}","branches_url":"https://api.github.com/repos/snapcore/snapd/branches{/branch}","tags_url":"https://api.github.com/repos/snapcore/snapd/tags","blobs_url":"https://api.github.com/repos/snapcore/snapd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/snapcore/snapd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/snapcore/snapd/git/refs{/sha}","trees_url":"https://api.github.com/repos/snapcore/snapd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/snapcore/snapd/statuses/{sha}","languages_url":"https://api.github.com/repos/snapcore/snapd/languages","stargazers_url":"https://api.github.com/repos/snapcore/snapd/stargazers","contributors_url":"https://api.github.com/repos/snapcore/snapd/contributors","subscribers_url":"https://api.github.com/repos/snapcore/snapd/subscribers","subscription_url":"https://api.github.com/repos/snapcore/snapd/subscription","commits_url":"https://api.github.com/repos/snapcore/snapd/commits{/sha}","git_commits_url":"https://api.github.com/repos/snapcore/snapd/git/commits{/sha}","comments_url":"https://api.github.com/repos/snapcore/snapd/comments{/number}","issue_comment_url":"https://api.github.com/repos/snapcore/snapd/issues/comments{/number}","contents_url":"https://api.github.com/repos/snapcore/snapd/contents/{+path}","compare_url":"https://api.github.com/repos/snapcore/snapd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/snapcore/snapd/merges","archive_url":"https://api.github.com/repos/snapcore/snapd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/snapcore/snapd/downloads","issues_url":"https://api.github.com/repos/snapcore/snapd/issues{/number}","pulls_url":"https://api.github.com/repos/snapcore/snapd/pulls{/number}","milestones_url":"https://api.github.com/repos/snapcore/snapd/milestones{/number}","notifications_url":"https://api.github.com/repos/snapcore/snapd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/snapcore/snapd/labels{/name}","releases_url":"https://api.github.com/repos/snapcore/snapd/releases{/id}","deployments_url":"https://api.github.com/repos/snapcore/snapd/deployments","created_at":"2015-10-21T11:51:46Z","updated_at":"2018-10-11T07:07:23Z","pushed_at":"2018-10-11T07:07:14Z","git_url":"git://github.com/snapcore/snapd.git","ssh_url":"git@github.com:snapcore/snapd.git","clone_url":"https://github.com/snapcore/snapd.git","svn_url":"https://github.com/snapcore/snapd","homepage":"","size":73637,"stargazers_count":1023,"watchers_count":1023,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":257,"mirror_url":null,"archived":false,"open_issues_count":35,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":257,"open_issues":35,"watchers":1023,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/5948"},"html":{"href":"https://github.com/snapcore/snapd/pull/5948"},"issue":{"href":"https://api.github.com/repos/snapcore/snapd/issues/5948"},"comments":{"href":"https://api.github.com/repos/snapcore/snapd/issues/5948/comments"},"review_comments":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/5948/comments"},"review_comment":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/snapcore/snapd/pulls/5948/commits"},"statuses":{"href":"https://api.github.com/repos/snapcore/snapd/statuses/7b3e08cc515cc840fe8ae3dc700921859ba48381"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"pedronis"}}