{"action":"created","issue":{"url":"https://api.github.com/repos/vim-jp/issues/issues/1192","repository_url":"https://api.github.com/repos/vim-jp/issues","labels_url":"https://api.github.com/repos/vim-jp/issues/issues/1192/labels{/name}","comments_url":"https://api.github.com/repos/vim-jp/issues/issues/1192/comments","events_url":"https://api.github.com/repos/vim-jp/issues/issues/1192/events","html_url":"https://github.com/vim-jp/issues/issues/1192","id":367052098,"node_id":"MDU6SXNzdWUzNjcwNTIwOTg=","number":1192,"title":"Windows の executable() の実装がおかしい","user":{"login":"mattn","id":10111,"node_id":"MDQ6VXNlcjEwMTEx","avatar_url":"https://avatars0.githubusercontent.com/u/10111?v=4","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":[{"id":150583,"node_id":"MDU6TGFiZWwxNTA1ODM=","url":"https://api.github.com/repos/vim-jp/issues/labels/kind/bug","name":"kind/bug","color":"e10c02","default":false},{"id":158962,"node_id":"MDU6TGFiZWwxNTg5NjI=","url":"https://api.github.com/repos/vim-jp/issues/labels/related/windows","name":"related/windows","color":"02e10c","default":false},{"id":150585,"node_id":"MDU6TGFiZWwxNTA1ODU=","url":"https://api.github.com/repos/vim-jp/issues/labels/status/sent%20patch","name":"status/sent patch","color":"e102d8","default":false}],"state":"closed","locked":false,"assignee":{"login":"mattn","id":10111,"node_id":"MDQ6VXNlcjEwMTEx","avatar_url":"https://avatars0.githubusercontent.com/u/10111?v=4","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,"node_id":"MDQ6VXNlcjEwMTEx","avatar_url":"https://avatars0.githubusercontent.com/u/10111?v=4","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":2,"created_at":"2018-10-05T04:04:50Z","updated_at":"2018-10-06T14:13:07Z","closed_at":"2018-10-06T14:13:07Z","author_association":"MEMBER","body":"本来の「あるべき」動作\r\n\r\n* ファイル名が PATHEXT にある拡張子を持っていて、そのファイルがカレントディレクトリか PATH のどこかに存在するなら実行可能\r\n* ファイル名の末尾にPATHEXT にある拡張子のいずれかを引っ付けたファイル名がカレントディレクトリか PATH のどこかに存在するなら実行可能\r\n\r\n現状\r\n\r\n* 拡張子があって PATH もしくはカレントディレクトリ内にファイルが存在する\r\n* ファイル名の末尾にPATHEXT にある拡張子のいずれかを引っ付けたファイル名がカレントディレクトリか PATH のどこかに存在するなら実行可能\r\n\r\nhttps://github.com/vim/vim/blob/2bc152ab53c4b01072edf6ec2ff61e504cb03cbe/src/os_win32.c#L3529-L3568\r\n\r\nよって `executable('shell32.dll')` が意図せず 1 を返してしまっている。\r\n\r\n```diff\r\ndiff --git a/src/os_win32.c b/src/os_win32.c\r\nindex 53b8ab365..cd749d7f0 100644\r\n--- a/src/os_win32.c\r\n+++ b/src/os_win32.c\r\n@@ -3530,7 +3530,7 @@ mch_can_exe(char_u *name, char_u **path, int use_path)\r\n {\r\n     char_u\tbuf[_MAX_PATH];\r\n     int\t\tlen = (int)STRLEN(name);\r\n-    char_u\t*p;\r\n+    char_u\t*p, *saved;\r\n \r\n     if (len >= _MAX_PATH)\t/* safety check */\r\n \treturn FALSE;\r\n@@ -3543,6 +3543,31 @@ mch_can_exe(char_u *name, char_u **path, int use_path)\r\n     /*\r\n      * Loop over all extensions in $PATHEXT.\r\n      */\r\n+    p = mch_getenv(\"PATHEXT\");\r\n+    if (p == NULL)\r\n+\tp = (char_u *)\".com;.exe;.bat;.cmd\";\r\n+    saved = vim_strsave(p);\r\n+    if (saved == NULL)\r\n+\treturn FALSE;\r\n+    p = saved;\r\n+    while (*p)\r\n+    {\r\n+\tchar_u\t*tmp = vim_strchr(p, ';');\r\n+\tif (tmp != NULL)\r\n+\t    *tmp = NUL;\r\n+\tif (_stricoll((char *)name + len - STRLEN(p), (char*) p) == 0\r\n+\t    && executable_exists((char*) name, path, use_path))\r\n+\t{\r\n+\t    vim_free(saved);\r\n+\t    return TRUE;\r\n+\t}\r\n+\tif (tmp != NULL)\r\n+\t    p = tmp + 1;\r\n+\telse\r\n+\t    break;\r\n+    }\r\n+    vim_free(saved);\r\n+\r\n     vim_strncpy(buf, name, _MAX_PATH - 1);\r\n     p = mch_getenv(\"PATHEXT\");\r\n     if (p == NULL)\r\n```"},"comment":{"url":"https://api.github.com/repos/vim-jp/issues/issues/comments/427576839","html_url":"https://github.com/vim-jp/issues/issues/1192#issuecomment-427576839","issue_url":"https://api.github.com/repos/vim-jp/issues/issues/1192","id":427576839,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNzU3NjgzOQ==","user":{"login":"mattn","id":10111,"node_id":"MDQ6VXNlcjEwMTEx","avatar_url":"https://avatars0.githubusercontent.com/u/10111?v=4","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":"2018-10-06T14:13:07Z","updated_at":"2018-10-06T14:13:07Z","author_association":"MEMBER","body":"3512 の代わりに 3412 が閉じられてしまった模様。\r\n\r\nhttps://github.com/vim/vim/commit/8295666dc2c65e42135b91d5c61e2a140d002333"}}
{"actor":{"display_login":"mattn"}}