{"action":"created","issue":{"url":"https://api.github.com/repos/vim-jp/issues/issues/961","repository_url":"https://api.github.com/repos/vim-jp/issues","labels_url":"https://api.github.com/repos/vim-jp/issues/issues/961/labels{/name}","comments_url":"https://api.github.com/repos/vim-jp/issues/issues/961/comments","events_url":"https://api.github.com/repos/vim-jp/issues/issues/961/events","html_url":"https://github.com/vim-jp/issues/issues/961","id":180511680,"number":961,"title":"Windows で job_start にダブルクオート付き引数を渡すと正しくエスケープされない。","user":{"login":"mattn","id":10111,"avatar_url":"https://avatars.githubusercontent.com/u/10111?v=3","gravatar_id":"","url":"https://api.github.com/users/mattn","html_url":"https://github.com/mattn","followers_url":"https://api.github.com/users/mattn/followers","following_url":"https://api.github.com/users/mattn/following{/other_user}","gists_url":"https://api.github.com/users/mattn/gists{/gist_id}","starred_url":"https://api.github.com/users/mattn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattn/subscriptions","organizations_url":"https://api.github.com/users/mattn/orgs","repos_url":"https://api.github.com/users/mattn/repos","events_url":"https://api.github.com/users/mattn/events{/privacy}","received_events_url":"https://api.github.com/users/mattn/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/vim-jp/issues/labels/kind/bug","name":"kind/bug","color":"e10c02"},{"url":"https://api.github.com/repos/vim-jp/issues/labels/related/windows","name":"related/windows","color":"02e10c"},{"url":"https://api.github.com/repos/vim-jp/issues/labels/status/patched","name":"status/patched","color":"e102d8"}],"state":"open","locked":false,"assignee":{"login":"mattn","id":10111,"avatar_url":"https://avatars.githubusercontent.com/u/10111?v=3","gravatar_id":"","url":"https://api.github.com/users/mattn","html_url":"https://github.com/mattn","followers_url":"https://api.github.com/users/mattn/followers","following_url":"https://api.github.com/users/mattn/following{/other_user}","gists_url":"https://api.github.com/users/mattn/gists{/gist_id}","starred_url":"https://api.github.com/users/mattn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattn/subscriptions","organizations_url":"https://api.github.com/users/mattn/orgs","repos_url":"https://api.github.com/users/mattn/repos","events_url":"https://api.github.com/users/mattn/events{/privacy}","received_events_url":"https://api.github.com/users/mattn/received_events","type":"User","site_admin":false},"assignees":[{"login":"mattn","id":10111,"avatar_url":"https://avatars.githubusercontent.com/u/10111?v=3","gravatar_id":"","url":"https://api.github.com/users/mattn","html_url":"https://github.com/mattn","followers_url":"https://api.github.com/users/mattn/followers","following_url":"https://api.github.com/users/mattn/following{/other_user}","gists_url":"https://api.github.com/users/mattn/gists{/gist_id}","starred_url":"https://api.github.com/users/mattn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattn/subscriptions","organizations_url":"https://api.github.com/users/mattn/orgs","repos_url":"https://api.github.com/users/mattn/repos","events_url":"https://api.github.com/users/mattn/events{/privacy}","received_events_url":"https://api.github.com/users/mattn/received_events","type":"User","site_admin":false}],"milestone":null,"comments":6,"created_at":"2016-10-02T13:12:08Z","updated_at":"2016-10-02T14:34:35Z","closed_at":null,"body":"https://github.com/vim-jp/issues/issues/957 から派生。\r\n\r\n![](https://camo.githubusercontent.com/cc7d0b5bb68922a7c07893ffed0a2311692ebe0d/687474703a2f2f676f2d6779617a6f2e61707073706f742e636f6d2f343132323030353739636135366563372e706e67)\r\n\r\njob_start で第一引数が配列場合は shellescape を使ってエスケープしてますが、その際 `\"` は `\"\"` にエスケープされる。ただしコマンドが期待するのは `\\\"\"` なので何かしらの対処が必要。ちなみに\r\n\r\n```c\r\n#include <stdio.h>\r\n\r\nint\r\nmain(int argc, char* argv[]) {\r\n\tputs(argv[1]);\r\n\treturn 0;\r\n}\r\n```\r\n\r\nこのコマンドに `\"\"` を渡す為には `\"\\\"\"\"` でないとダメ。\r\n\r\n![](http://go-gyazo.appspot.com/b2ac03e4812b62eb.png)\r\n\r\n再現バージョン 8.0.0019 Windows10 64bit\r\n"},"comment":{"url":"https://api.github.com/repos/vim-jp/issues/issues/comments/250974272","html_url":"https://github.com/vim-jp/issues/issues/961#issuecomment-250974272","issue_url":"https://api.github.com/repos/vim-jp/issues/issues/961","id":250974272,"user":{"login":"mattn","id":10111,"avatar_url":"https://avatars.githubusercontent.com/u/10111?v=3","gravatar_id":"","url":"https://api.github.com/users/mattn","html_url":"https://github.com/mattn","followers_url":"https://api.github.com/users/mattn/followers","following_url":"https://api.github.com/users/mattn/following{/other_user}","gists_url":"https://api.github.com/users/mattn/gists{/gist_id}","starred_url":"https://api.github.com/users/mattn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattn/subscriptions","organizations_url":"https://api.github.com/users/mattn/orgs","repos_url":"https://api.github.com/users/mattn/repos","events_url":"https://api.github.com/users/mattn/events{/privacy}","received_events_url":"https://api.github.com/users/mattn/received_events","type":"User","site_admin":false},"created_at":"2016-10-02T14:34:35Z","updated_at":"2016-10-02T14:34:35Z","body":"今の僕の認識だと、シェル(cmd)を通すかどうかで動作が変わるはずで、今回の様にシェルを通さない `job_start([])` の場合には shellescape は使えないという認識です。上記のパッチは shellescape に当ててしまいましたが、フラグか何かを設けて `job_start([])` 向けのエスケープと通常の shellescape を分けるべきだと思います。それを証拠に\r\n\r\n```c\r\n#include <stdio.h>\r\n\r\nint\r\nmain(int argc, char* argv[]) {\r\n    puts(argv[1]);\r\n    return 0;\r\n}\r\n```\r\n\r\nにシングルクオートを1つ渡すのに \r\n\r\n```\r\n:echo system(\"foo \" . shellescape('\"'))\r\n```\r\n\r\nとすると現状のパッチだとE484が発生します。ただし現状の vim が作るエスケープ(`\"\"\"\"`)だと job_start には使えません。\r\n"}}
{"actor":{"display_login":"mattn"}}