{"action":"opened","number":118,"pull_request":{"url":"https://api.github.com/repos/larsch/ocra/pulls/118","id":99802745,"html_url":"https://github.com/larsch/ocra/pull/118","diff_url":"https://github.com/larsch/ocra/pull/118.diff","patch_url":"https://github.com/larsch/ocra/pull/118.patch","issue_url":"https://api.github.com/repos/larsch/ocra/issues/118","number":118,"state":"open","locked":false,"title":"Retry directory creation when ERROR_ALREADY_EXISTS is returned.","user":{"login":"masamitsu-murase","id":940058,"avatar_url":"https://avatars.githubusercontent.com/u/940058?v=3","gravatar_id":"","url":"https://api.github.com/users/masamitsu-murase","html_url":"https://github.com/masamitsu-murase","followers_url":"https://api.github.com/users/masamitsu-murase/followers","following_url":"https://api.github.com/users/masamitsu-murase/following{/other_user}","gists_url":"https://api.github.com/users/masamitsu-murase/gists{/gist_id}","starred_url":"https://api.github.com/users/masamitsu-murase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masamitsu-murase/subscriptions","organizations_url":"https://api.github.com/users/masamitsu-murase/orgs","repos_url":"https://api.github.com/users/masamitsu-murase/repos","events_url":"https://api.github.com/users/masamitsu-murase/events{/privacy}","received_events_url":"https://api.github.com/users/masamitsu-murase/received_events","type":"User","site_admin":false},"body":"First of all, let me thank you for your great work.\r\n\r\nThis is a bug fix for a corner case.\r\n\r\nIssue:\r\n* When I ran multiple *.exe files simultaneously, which was packaged by Ocra, I faced a fatal error, \"Failed to create installation directory.\", in rare cases.\r\n\r\nCause:\r\n* This issue is caused by the following source code in `OpCreateInstDirectory`:\r\n```c\r\n   UINT tempResult = GetTempFileName(TempPath, _T(\"ocrastub\"), 0, InstDir);\r\n   if (tempResult == 0u)\r\n   {\r\n      FATAL(\"Failed to get temp file name.\");\r\n      return FALSE;\r\n   }\r\n\r\n   DEBUG(\"Creating installation directory: '%s'\", InstDir);\r\n\r\n   /* Attempt to delete the temp file created by GetTempFileName.\r\n      Ignore errors, i.e. if it doesn't exist. */\r\n   (void)DeleteFile(InstDir);\r\n\r\n   if (!CreateDirectory(InstDir, NULL))\r\n   {\r\n      FATAL(\"Failed to create installation directory.\");\r\n      return FALSE;\r\n   }\r\n   return TRUE;\r\n```\r\n\r\nIn the above function, the function may fail to create a directory.\r\nLet's assume that we run 2 *exe files packaged by Ocra.\r\n1. Run exe 1 and exe 2 simultaneously.\r\n2. Exe 1 calls `GetTempFileName` to create a temporary file.\r\n   Let's assume that the name of the file is \"ocr0123.tmp\".\r\n3. Exe 1 removes the file immediately.\r\n4. Exe 2 calls `GetTempFileName`.\r\n   In rare cases, it creates a temporary file, \"ocr0123.tmp\", whose file name is same as step 2.\r\n5. Then, exe 1 fails to create a directory because step 4 already created \"ocr0123.tmp\".\r\n\r\nLet me explain the detailed background.\r\n* Windows generates a temporary file name based on the system time in millisecond.\r\n* Therefore, step 2 and step 4 may generate identical file name because recent CPUs are so fast...\r\n\r\nMy changeset retries directory creation when ERROR_ALREADY_EXISTS is returned.\r\n\r\nRegards,\r\nMurase\r\n","created_at":"2016-12-31T10:59:25Z","updated_at":"2016-12-31T10:59:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/larsch/ocra/pulls/118/commits","review_comments_url":"https://api.github.com/repos/larsch/ocra/pulls/118/comments","review_comment_url":"https://api.github.com/repos/larsch/ocra/pulls/comments{/number}","comments_url":"https://api.github.com/repos/larsch/ocra/issues/118/comments","statuses_url":"https://api.github.com/repos/larsch/ocra/statuses/36f5e68dae1a82467bf8e015d14ab7a62b78700f","head":{"label":"masamitsu-murase:retry_directory_creation","ref":"retry_directory_creation","sha":"36f5e68dae1a82467bf8e015d14ab7a62b78700f","user":{"login":"masamitsu-murase","id":940058,"avatar_url":"https://avatars.githubusercontent.com/u/940058?v=3","gravatar_id":"","url":"https://api.github.com/users/masamitsu-murase","html_url":"https://github.com/masamitsu-murase","followers_url":"https://api.github.com/users/masamitsu-murase/followers","following_url":"https://api.github.com/users/masamitsu-murase/following{/other_user}","gists_url":"https://api.github.com/users/masamitsu-murase/gists{/gist_id}","starred_url":"https://api.github.com/users/masamitsu-murase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masamitsu-murase/subscriptions","organizations_url":"https://api.github.com/users/masamitsu-murase/orgs","repos_url":"https://api.github.com/users/masamitsu-murase/repos","events_url":"https://api.github.com/users/masamitsu-murase/events{/privacy}","received_events_url":"https://api.github.com/users/masamitsu-murase/received_events","type":"User","site_admin":false},"repo":{"id":77626948,"name":"ocra","full_name":"masamitsu-murase/ocra","owner":{"login":"masamitsu-murase","id":940058,"avatar_url":"https://avatars.githubusercontent.com/u/940058?v=3","gravatar_id":"","url":"https://api.github.com/users/masamitsu-murase","html_url":"https://github.com/masamitsu-murase","followers_url":"https://api.github.com/users/masamitsu-murase/followers","following_url":"https://api.github.com/users/masamitsu-murase/following{/other_user}","gists_url":"https://api.github.com/users/masamitsu-murase/gists{/gist_id}","starred_url":"https://api.github.com/users/masamitsu-murase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masamitsu-murase/subscriptions","organizations_url":"https://api.github.com/users/masamitsu-murase/orgs","repos_url":"https://api.github.com/users/masamitsu-murase/repos","events_url":"https://api.github.com/users/masamitsu-murase/events{/privacy}","received_events_url":"https://api.github.com/users/masamitsu-murase/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/masamitsu-murase/ocra","description":"One-Click Ruby Application Builder","fork":true,"url":"https://api.github.com/repos/masamitsu-murase/ocra","forks_url":"https://api.github.com/repos/masamitsu-murase/ocra/forks","keys_url":"https://api.github.com/repos/masamitsu-murase/ocra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/masamitsu-murase/ocra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/masamitsu-murase/ocra/teams","hooks_url":"https://api.github.com/repos/masamitsu-murase/ocra/hooks","issue_events_url":"https://api.github.com/repos/masamitsu-murase/ocra/issues/events{/number}","events_url":"https://api.github.com/repos/masamitsu-murase/ocra/events","assignees_url":"https://api.github.com/repos/masamitsu-murase/ocra/assignees{/user}","branches_url":"https://api.github.com/repos/masamitsu-murase/ocra/branches{/branch}","tags_url":"https://api.github.com/repos/masamitsu-murase/ocra/tags","blobs_url":"https://api.github.com/repos/masamitsu-murase/ocra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/masamitsu-murase/ocra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/masamitsu-murase/ocra/git/refs{/sha}","trees_url":"https://api.github.com/repos/masamitsu-murase/ocra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/masamitsu-murase/ocra/statuses/{sha}","languages_url":"https://api.github.com/repos/masamitsu-murase/ocra/languages","stargazers_url":"https://api.github.com/repos/masamitsu-murase/ocra/stargazers","contributors_url":"https://api.github.com/repos/masamitsu-murase/ocra/contributors","subscribers_url":"https://api.github.com/repos/masamitsu-murase/ocra/subscribers","subscription_url":"https://api.github.com/repos/masamitsu-murase/ocra/subscription","commits_url":"https://api.github.com/repos/masamitsu-murase/ocra/commits{/sha}","git_commits_url":"https://api.github.com/repos/masamitsu-murase/ocra/git/commits{/sha}","comments_url":"https://api.github.com/repos/masamitsu-murase/ocra/comments{/number}","issue_comment_url":"https://api.github.com/repos/masamitsu-murase/ocra/issues/comments{/number}","contents_url":"https://api.github.com/repos/masamitsu-murase/ocra/contents/{+path}","compare_url":"https://api.github.com/repos/masamitsu-murase/ocra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/masamitsu-murase/ocra/merges","archive_url":"https://api.github.com/repos/masamitsu-murase/ocra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/masamitsu-murase/ocra/downloads","issues_url":"https://api.github.com/repos/masamitsu-murase/ocra/issues{/number}","pulls_url":"https://api.github.com/repos/masamitsu-murase/ocra/pulls{/number}","milestones_url":"https://api.github.com/repos/masamitsu-murase/ocra/milestones{/number}","notifications_url":"https://api.github.com/repos/masamitsu-murase/ocra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/masamitsu-murase/ocra/labels{/name}","releases_url":"https://api.github.com/repos/masamitsu-murase/ocra/releases{/id}","deployments_url":"https://api.github.com/repos/masamitsu-murase/ocra/deployments","created_at":"2016-12-29T16:57:56Z","updated_at":"2016-12-29T16:57:58Z","pushed_at":"2016-12-30T16:01:48Z","git_url":"git://github.com/masamitsu-murase/ocra.git","ssh_url":"git@github.com:masamitsu-murase/ocra.git","clone_url":"https://github.com/masamitsu-murase/ocra.git","svn_url":"https://github.com/masamitsu-murase/ocra","homepage":"http://ocra.rubyforge.org/","size":407,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":false,"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":"larsch:master","ref":"master","sha":"2e7c88fd6ac7ae5f881d838dedd7ad437bda018b","user":{"login":"larsch","id":15712,"avatar_url":"https://avatars.githubusercontent.com/u/15712?v=3","gravatar_id":"","url":"https://api.github.com/users/larsch","html_url":"https://github.com/larsch","followers_url":"https://api.github.com/users/larsch/followers","following_url":"https://api.github.com/users/larsch/following{/other_user}","gists_url":"https://api.github.com/users/larsch/gists{/gist_id}","starred_url":"https://api.github.com/users/larsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larsch/subscriptions","organizations_url":"https://api.github.com/users/larsch/orgs","repos_url":"https://api.github.com/users/larsch/repos","events_url":"https://api.github.com/users/larsch/events{/privacy}","received_events_url":"https://api.github.com/users/larsch/received_events","type":"User","site_admin":false},"repo":{"id":178300,"name":"ocra","full_name":"larsch/ocra","owner":{"login":"larsch","id":15712,"avatar_url":"https://avatars.githubusercontent.com/u/15712?v=3","gravatar_id":"","url":"https://api.github.com/users/larsch","html_url":"https://github.com/larsch","followers_url":"https://api.github.com/users/larsch/followers","following_url":"https://api.github.com/users/larsch/following{/other_user}","gists_url":"https://api.github.com/users/larsch/gists{/gist_id}","starred_url":"https://api.github.com/users/larsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larsch/subscriptions","organizations_url":"https://api.github.com/users/larsch/orgs","repos_url":"https://api.github.com/users/larsch/repos","events_url":"https://api.github.com/users/larsch/events{/privacy}","received_events_url":"https://api.github.com/users/larsch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/larsch/ocra","description":"One-Click Ruby Application Builder","fork":false,"url":"https://api.github.com/repos/larsch/ocra","forks_url":"https://api.github.com/repos/larsch/ocra/forks","keys_url":"https://api.github.com/repos/larsch/ocra/keys{/key_id}","collaborators_url":"https://api.github.com/repos/larsch/ocra/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/larsch/ocra/teams","hooks_url":"https://api.github.com/repos/larsch/ocra/hooks","issue_events_url":"https://api.github.com/repos/larsch/ocra/issues/events{/number}","events_url":"https://api.github.com/repos/larsch/ocra/events","assignees_url":"https://api.github.com/repos/larsch/ocra/assignees{/user}","branches_url":"https://api.github.com/repos/larsch/ocra/branches{/branch}","tags_url":"https://api.github.com/repos/larsch/ocra/tags","blobs_url":"https://api.github.com/repos/larsch/ocra/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/larsch/ocra/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/larsch/ocra/git/refs{/sha}","trees_url":"https://api.github.com/repos/larsch/ocra/git/trees{/sha}","statuses_url":"https://api.github.com/repos/larsch/ocra/statuses/{sha}","languages_url":"https://api.github.com/repos/larsch/ocra/languages","stargazers_url":"https://api.github.com/repos/larsch/ocra/stargazers","contributors_url":"https://api.github.com/repos/larsch/ocra/contributors","subscribers_url":"https://api.github.com/repos/larsch/ocra/subscribers","subscription_url":"https://api.github.com/repos/larsch/ocra/subscription","commits_url":"https://api.github.com/repos/larsch/ocra/commits{/sha}","git_commits_url":"https://api.github.com/repos/larsch/ocra/git/commits{/sha}","comments_url":"https://api.github.com/repos/larsch/ocra/comments{/number}","issue_comment_url":"https://api.github.com/repos/larsch/ocra/issues/comments{/number}","contents_url":"https://api.github.com/repos/larsch/ocra/contents/{+path}","compare_url":"https://api.github.com/repos/larsch/ocra/compare/{base}...{head}","merges_url":"https://api.github.com/repos/larsch/ocra/merges","archive_url":"https://api.github.com/repos/larsch/ocra/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/larsch/ocra/downloads","issues_url":"https://api.github.com/repos/larsch/ocra/issues{/number}","pulls_url":"https://api.github.com/repos/larsch/ocra/pulls{/number}","milestones_url":"https://api.github.com/repos/larsch/ocra/milestones{/number}","notifications_url":"https://api.github.com/repos/larsch/ocra/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/larsch/ocra/labels{/name}","releases_url":"https://api.github.com/repos/larsch/ocra/releases{/id}","deployments_url":"https://api.github.com/repos/larsch/ocra/deployments","created_at":"2009-04-17T07:47:33Z","updated_at":"2016-12-23T13:15:03Z","pushed_at":"2016-02-22T12:16:19Z","git_url":"git://github.com/larsch/ocra.git","ssh_url":"git@github.com:larsch/ocra.git","clone_url":"https://github.com/larsch/ocra.git","svn_url":"https://github.com/larsch/ocra","homepage":"http://ocra.rubyforge.org/","size":546,"stargazers_count":538,"watchers_count":538,"language":"Ruby","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":50,"mirror_url":null,"open_issues_count":40,"forks":50,"open_issues":40,"watchers":538,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/larsch/ocra/pulls/118"},"html":{"href":"https://github.com/larsch/ocra/pull/118"},"issue":{"href":"https://api.github.com/repos/larsch/ocra/issues/118"},"comments":{"href":"https://api.github.com/repos/larsch/ocra/issues/118/comments"},"review_comments":{"href":"https://api.github.com/repos/larsch/ocra/pulls/118/comments"},"review_comment":{"href":"https://api.github.com/repos/larsch/ocra/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/larsch/ocra/pulls/118/commits"},"statuses":{"href":"https://api.github.com/repos/larsch/ocra/statuses/36f5e68dae1a82467bf8e015d14ab7a62b78700f"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":20,"deletions":13,"changed_files":1}}
{"actor":{"display_login":"masamitsu-murase"}}