{"action":"closed","number":4,"pull_request":{"url":"https://api.github.com/repos/kballard/go-shellquote/pulls/4","id":41956631,"html_url":"https://github.com/kballard/go-shellquote/pull/4","diff_url":"https://github.com/kballard/go-shellquote/pull/4.diff","patch_url":"https://github.com/kballard/go-shellquote/pull/4.patch","issue_url":"https://api.github.com/repos/kballard/go-shellquote/issues/4","number":4,"state":"closed","locked":false,"title":"Fix prefix-repeat bug in Join when arguments include special characters and no whitespace","user":{"login":"tillberg","id":104587,"avatar_url":"https://avatars.githubusercontent.com/u/104587?v=3","gravatar_id":"","url":"https://api.github.com/users/tillberg","html_url":"https://github.com/tillberg","followers_url":"https://api.github.com/users/tillberg/followers","following_url":"https://api.github.com/users/tillberg/following{/other_user}","gists_url":"https://api.github.com/users/tillberg/gists{/gist_id}","starred_url":"https://api.github.com/users/tillberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tillberg/subscriptions","organizations_url":"https://api.github.com/users/tillberg/orgs","repos_url":"https://api.github.com/users/tillberg/repos","events_url":"https://api.github.com/users/tillberg/events{/privacy}","received_events_url":"https://api.github.com/users/tillberg/received_events","type":"User","site_admin":false},"body":"I encountered a bug with the Join method that is triggered by meeting two conditions in an argument (\"word\" in the quote method) that are just narrowly missed in the existing test suite:\r\n- no whitespace (if there is whitespace, the quoted-string method is used instead)\r\n- two or more special characters\r\n\r\nWhen these conditions are met, then you get results like this:\r\n```\r\n> shellquote.Join(\"some(parentheses)\")\r\n\"some\\\\(some(parent\\\\)\"\r\n> shellquote.Join(\"$some_ot~her_)spe!cial_*_characters\")\r\n\"\\\\$$some_ot~her\\\\)$so\\\\!$some\\\\*_characters\"\r\n```\r\n\r\nIn each case, you can see that the beginning (\"some(pa...\" and \"$some...\", respectively) is repeated before each of the special characters.\r\n\r\nThis patch includes two test cases that exercise this bug as well as a simple fix. `word[0:...]` will always return a segment starting at the beginning of the current argument, as `word` is unmodified throughout `quote`, while `prev` is used to denote the segment to write either when the end of the string or a special character is encountered.","created_at":"2015-08-08T16:32:24Z","updated_at":"2015-08-10T07:47:51Z","closed_at":"2015-08-10T07:47:51Z","merged_at":"2015-08-10T07:47:51Z","merge_commit_sha":"eef443aea02a3d80c854ce5593bfeed3348285be","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/kballard/go-shellquote/pulls/4/commits","review_comments_url":"https://api.github.com/repos/kballard/go-shellquote/pulls/4/comments","review_comment_url":"https://api.github.com/repos/kballard/go-shellquote/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kballard/go-shellquote/issues/4/comments","statuses_url":"https://api.github.com/repos/kballard/go-shellquote/statuses/39fd79a1c54f23142ac8915a31cc22c049053464","head":{"label":"tillberg:fix-prefix-repeat","ref":"fix-prefix-repeat","sha":"39fd79a1c54f23142ac8915a31cc22c049053464","user":{"login":"tillberg","id":104587,"avatar_url":"https://avatars.githubusercontent.com/u/104587?v=3","gravatar_id":"","url":"https://api.github.com/users/tillberg","html_url":"https://github.com/tillberg","followers_url":"https://api.github.com/users/tillberg/followers","following_url":"https://api.github.com/users/tillberg/following{/other_user}","gists_url":"https://api.github.com/users/tillberg/gists{/gist_id}","starred_url":"https://api.github.com/users/tillberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tillberg/subscriptions","organizations_url":"https://api.github.com/users/tillberg/orgs","repos_url":"https://api.github.com/users/tillberg/repos","events_url":"https://api.github.com/users/tillberg/events{/privacy}","received_events_url":"https://api.github.com/users/tillberg/received_events","type":"User","site_admin":false},"repo":{"id":40408278,"name":"go-shellquote","full_name":"tillberg/go-shellquote","owner":{"login":"tillberg","id":104587,"avatar_url":"https://avatars.githubusercontent.com/u/104587?v=3","gravatar_id":"","url":"https://api.github.com/users/tillberg","html_url":"https://github.com/tillberg","followers_url":"https://api.github.com/users/tillberg/followers","following_url":"https://api.github.com/users/tillberg/following{/other_user}","gists_url":"https://api.github.com/users/tillberg/gists{/gist_id}","starred_url":"https://api.github.com/users/tillberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tillberg/subscriptions","organizations_url":"https://api.github.com/users/tillberg/orgs","repos_url":"https://api.github.com/users/tillberg/repos","events_url":"https://api.github.com/users/tillberg/events{/privacy}","received_events_url":"https://api.github.com/users/tillberg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tillberg/go-shellquote","description":"Go utilities for performing shell-like word splitting/joining","fork":true,"url":"https://api.github.com/repos/tillberg/go-shellquote","forks_url":"https://api.github.com/repos/tillberg/go-shellquote/forks","keys_url":"https://api.github.com/repos/tillberg/go-shellquote/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tillberg/go-shellquote/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tillberg/go-shellquote/teams","hooks_url":"https://api.github.com/repos/tillberg/go-shellquote/hooks","issue_events_url":"https://api.github.com/repos/tillberg/go-shellquote/issues/events{/number}","events_url":"https://api.github.com/repos/tillberg/go-shellquote/events","assignees_url":"https://api.github.com/repos/tillberg/go-shellquote/assignees{/user}","branches_url":"https://api.github.com/repos/tillberg/go-shellquote/branches{/branch}","tags_url":"https://api.github.com/repos/tillberg/go-shellquote/tags","blobs_url":"https://api.github.com/repos/tillberg/go-shellquote/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tillberg/go-shellquote/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tillberg/go-shellquote/git/refs{/sha}","trees_url":"https://api.github.com/repos/tillberg/go-shellquote/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tillberg/go-shellquote/statuses/{sha}","languages_url":"https://api.github.com/repos/tillberg/go-shellquote/languages","stargazers_url":"https://api.github.com/repos/tillberg/go-shellquote/stargazers","contributors_url":"https://api.github.com/repos/tillberg/go-shellquote/contributors","subscribers_url":"https://api.github.com/repos/tillberg/go-shellquote/subscribers","subscription_url":"https://api.github.com/repos/tillberg/go-shellquote/subscription","commits_url":"https://api.github.com/repos/tillberg/go-shellquote/commits{/sha}","git_commits_url":"https://api.github.com/repos/tillberg/go-shellquote/git/commits{/sha}","comments_url":"https://api.github.com/repos/tillberg/go-shellquote/comments{/number}","issue_comment_url":"https://api.github.com/repos/tillberg/go-shellquote/issues/comments{/number}","contents_url":"https://api.github.com/repos/tillberg/go-shellquote/contents/{+path}","compare_url":"https://api.github.com/repos/tillberg/go-shellquote/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tillberg/go-shellquote/merges","archive_url":"https://api.github.com/repos/tillberg/go-shellquote/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tillberg/go-shellquote/downloads","issues_url":"https://api.github.com/repos/tillberg/go-shellquote/issues{/number}","pulls_url":"https://api.github.com/repos/tillberg/go-shellquote/pulls{/number}","milestones_url":"https://api.github.com/repos/tillberg/go-shellquote/milestones{/number}","notifications_url":"https://api.github.com/repos/tillberg/go-shellquote/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tillberg/go-shellquote/labels{/name}","releases_url":"https://api.github.com/repos/tillberg/go-shellquote/releases{/id}","created_at":"2015-08-08T16:05:32Z","updated_at":"2015-08-08T16:05:33Z","pushed_at":"2015-08-08T16:29:45Z","git_url":"git://github.com/tillberg/go-shellquote.git","ssh_url":"git@github.com:tillberg/go-shellquote.git","clone_url":"https://github.com/tillberg/go-shellquote.git","svn_url":"https://github.com/tillberg/go-shellquote","homepage":null,"size":84,"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":"kballard:master","ref":"master","sha":"e5c918b80c17694cbc49aab32a759f9a40067f5d","user":{"login":"kballard","id":714,"avatar_url":"https://avatars.githubusercontent.com/u/714?v=3","gravatar_id":"","url":"https://api.github.com/users/kballard","html_url":"https://github.com/kballard","followers_url":"https://api.github.com/users/kballard/followers","following_url":"https://api.github.com/users/kballard/following{/other_user}","gists_url":"https://api.github.com/users/kballard/gists{/gist_id}","starred_url":"https://api.github.com/users/kballard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kballard/subscriptions","organizations_url":"https://api.github.com/users/kballard/orgs","repos_url":"https://api.github.com/users/kballard/repos","events_url":"https://api.github.com/users/kballard/events{/privacy}","received_events_url":"https://api.github.com/users/kballard/received_events","type":"User","site_admin":false},"repo":{"id":4984253,"name":"go-shellquote","full_name":"kballard/go-shellquote","owner":{"login":"kballard","id":714,"avatar_url":"https://avatars.githubusercontent.com/u/714?v=3","gravatar_id":"","url":"https://api.github.com/users/kballard","html_url":"https://github.com/kballard","followers_url":"https://api.github.com/users/kballard/followers","following_url":"https://api.github.com/users/kballard/following{/other_user}","gists_url":"https://api.github.com/users/kballard/gists{/gist_id}","starred_url":"https://api.github.com/users/kballard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kballard/subscriptions","organizations_url":"https://api.github.com/users/kballard/orgs","repos_url":"https://api.github.com/users/kballard/repos","events_url":"https://api.github.com/users/kballard/events{/privacy}","received_events_url":"https://api.github.com/users/kballard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kballard/go-shellquote","description":"Go utilities for performing shell-like word splitting/joining","fork":false,"url":"https://api.github.com/repos/kballard/go-shellquote","forks_url":"https://api.github.com/repos/kballard/go-shellquote/forks","keys_url":"https://api.github.com/repos/kballard/go-shellquote/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kballard/go-shellquote/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kballard/go-shellquote/teams","hooks_url":"https://api.github.com/repos/kballard/go-shellquote/hooks","issue_events_url":"https://api.github.com/repos/kballard/go-shellquote/issues/events{/number}","events_url":"https://api.github.com/repos/kballard/go-shellquote/events","assignees_url":"https://api.github.com/repos/kballard/go-shellquote/assignees{/user}","branches_url":"https://api.github.com/repos/kballard/go-shellquote/branches{/branch}","tags_url":"https://api.github.com/repos/kballard/go-shellquote/tags","blobs_url":"https://api.github.com/repos/kballard/go-shellquote/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kballard/go-shellquote/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kballard/go-shellquote/git/refs{/sha}","trees_url":"https://api.github.com/repos/kballard/go-shellquote/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kballard/go-shellquote/statuses/{sha}","languages_url":"https://api.github.com/repos/kballard/go-shellquote/languages","stargazers_url":"https://api.github.com/repos/kballard/go-shellquote/stargazers","contributors_url":"https://api.github.com/repos/kballard/go-shellquote/contributors","subscribers_url":"https://api.github.com/repos/kballard/go-shellquote/subscribers","subscription_url":"https://api.github.com/repos/kballard/go-shellquote/subscription","commits_url":"https://api.github.com/repos/kballard/go-shellquote/commits{/sha}","git_commits_url":"https://api.github.com/repos/kballard/go-shellquote/git/commits{/sha}","comments_url":"https://api.github.com/repos/kballard/go-shellquote/comments{/number}","issue_comment_url":"https://api.github.com/repos/kballard/go-shellquote/issues/comments{/number}","contents_url":"https://api.github.com/repos/kballard/go-shellquote/contents/{+path}","compare_url":"https://api.github.com/repos/kballard/go-shellquote/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kballard/go-shellquote/merges","archive_url":"https://api.github.com/repos/kballard/go-shellquote/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kballard/go-shellquote/downloads","issues_url":"https://api.github.com/repos/kballard/go-shellquote/issues{/number}","pulls_url":"https://api.github.com/repos/kballard/go-shellquote/pulls{/number}","milestones_url":"https://api.github.com/repos/kballard/go-shellquote/milestones{/number}","notifications_url":"https://api.github.com/repos/kballard/go-shellquote/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kballard/go-shellquote/labels{/name}","releases_url":"https://api.github.com/repos/kballard/go-shellquote/releases{/id}","created_at":"2012-07-11T04:08:43Z","updated_at":"2015-07-01T21:20:58Z","pushed_at":"2015-08-10T07:47:51Z","git_url":"git://github.com/kballard/go-shellquote.git","ssh_url":"git@github.com:kballard/go-shellquote.git","clone_url":"https://github.com/kballard/go-shellquote.git","svn_url":"https://github.com/kballard/go-shellquote","homepage":null,"size":156,"stargazers_count":21,"watchers_count":21,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":1,"forks":7,"open_issues":1,"watchers":21,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kballard/go-shellquote/pulls/4"},"html":{"href":"https://github.com/kballard/go-shellquote/pull/4"},"issue":{"href":"https://api.github.com/repos/kballard/go-shellquote/issues/4"},"comments":{"href":"https://api.github.com/repos/kballard/go-shellquote/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/kballard/go-shellquote/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/kballard/go-shellquote/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kballard/go-shellquote/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/kballard/go-shellquote/statuses/39fd79a1c54f23142ac8915a31cc22c049053464"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"kballard","id":714,"avatar_url":"https://avatars.githubusercontent.com/u/714?v=3","gravatar_id":"","url":"https://api.github.com/users/kballard","html_url":"https://github.com/kballard","followers_url":"https://api.github.com/users/kballard/followers","following_url":"https://api.github.com/users/kballard/following{/other_user}","gists_url":"https://api.github.com/users/kballard/gists{/gist_id}","starred_url":"https://api.github.com/users/kballard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kballard/subscriptions","organizations_url":"https://api.github.com/users/kballard/orgs","repos_url":"https://api.github.com/users/kballard/repos","events_url":"https://api.github.com/users/kballard/events{/privacy}","received_events_url":"https://api.github.com/users/kballard/received_events","type":"User","site_admin":false},"comments":0,"review_comments":0,"commits":1,"additions":3,"deletions":1,"changed_files":2}}