{"action":"closed","issue":{"url":"https://api.github.com/repos/Level/rocksdb/issues/30","repository_url":"https://api.github.com/repos/Level/rocksdb","labels_url":"https://api.github.com/repos/Level/rocksdb/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/Level/rocksdb/issues/30/comments","events_url":"https://api.github.com/repos/Level/rocksdb/issues/30/events","html_url":"https://github.com/Level/rocksdb/issues/30","id":292223668,"number":30,"title":"Destroy() creates directory on Windows","user":{"login":"vweevers","id":3055345,"avatar_url":"https://avatars2.githubusercontent.com/u/3055345?v=4","gravatar_id":"","url":"https://api.github.com/users/vweevers","html_url":"https://github.com/vweevers","followers_url":"https://api.github.com/users/vweevers/followers","following_url":"https://api.github.com/users/vweevers/following{/other_user}","gists_url":"https://api.github.com/users/vweevers/gists{/gist_id}","starred_url":"https://api.github.com/users/vweevers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vweevers/subscriptions","organizations_url":"https://api.github.com/users/vweevers/orgs","repos_url":"https://api.github.com/users/vweevers/repos","events_url":"https://api.github.com/users/vweevers/events{/privacy}","received_events_url":"https://api.github.com/users/vweevers/received_events","type":"User","site_admin":false},"labels":[{"id":613607699,"url":"https://api.github.com/repos/Level/rocksdb/labels/bug","name":"bug","color":"ee0701","default":true}],"state":"closed","locked":false,"assignee":{"login":"vweevers","id":3055345,"avatar_url":"https://avatars2.githubusercontent.com/u/3055345?v=4","gravatar_id":"","url":"https://api.github.com/users/vweevers","html_url":"https://github.com/vweevers","followers_url":"https://api.github.com/users/vweevers/followers","following_url":"https://api.github.com/users/vweevers/following{/other_user}","gists_url":"https://api.github.com/users/vweevers/gists{/gist_id}","starred_url":"https://api.github.com/users/vweevers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vweevers/subscriptions","organizations_url":"https://api.github.com/users/vweevers/orgs","repos_url":"https://api.github.com/users/vweevers/repos","events_url":"https://api.github.com/users/vweevers/events{/privacy}","received_events_url":"https://api.github.com/users/vweevers/received_events","type":"User","site_admin":false},"assignees":[{"login":"vweevers","id":3055345,"avatar_url":"https://avatars2.githubusercontent.com/u/3055345?v=4","gravatar_id":"","url":"https://api.github.com/users/vweevers","html_url":"https://github.com/vweevers","followers_url":"https://api.github.com/users/vweevers/followers","following_url":"https://api.github.com/users/vweevers/following{/other_user}","gists_url":"https://api.github.com/users/vweevers/gists{/gist_id}","starred_url":"https://api.github.com/users/vweevers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vweevers/subscriptions","organizations_url":"https://api.github.com/users/vweevers/orgs","repos_url":"https://api.github.com/users/vweevers/repos","events_url":"https://api.github.com/users/vweevers/events{/privacy}","received_events_url":"https://api.github.com/users/vweevers/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Level/rocksdb/milestones/1","html_url":"https://github.com/Level/rocksdb/milestone/1","labels_url":"https://api.github.com/repos/Level/rocksdb/milestones/1/labels","id":3089148,"number":1,"title":"v2","description":"","creator":{"login":"ralphtheninja","id":308049,"avatar_url":"https://avatars2.githubusercontent.com/u/308049?v=4","gravatar_id":"","url":"https://api.github.com/users/ralphtheninja","html_url":"https://github.com/ralphtheninja","followers_url":"https://api.github.com/users/ralphtheninja/followers","following_url":"https://api.github.com/users/ralphtheninja/following{/other_user}","gists_url":"https://api.github.com/users/ralphtheninja/gists{/gist_id}","starred_url":"https://api.github.com/users/ralphtheninja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralphtheninja/subscriptions","organizations_url":"https://api.github.com/users/ralphtheninja/orgs","repos_url":"https://api.github.com/users/ralphtheninja/repos","events_url":"https://api.github.com/users/ralphtheninja/events{/privacy}","received_events_url":"https://api.github.com/users/ralphtheninja/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":1,"state":"open","created_at":"2018-02-05T11:46:31Z","updated_at":"2018-02-09T22:24:03Z","due_on":null,"closed_at":null},"comments":32,"created_at":"2018-01-28T17:50:53Z","updated_at":"2018-02-09T22:24:03Z","closed_at":"2018-02-09T22:24:03Z","author_association":"OWNER","body":"Repro:\r\n\r\n```js\r\ntest('destroy does not create a directory', function (t) {\r\n  t.plan(3)\r\n\r\n  const location = path.resolve('destroy-test')\r\n\r\n  rimraf.sync(location)\r\n  t.is(fs.existsSync(location), false, 'exists before')\r\n\r\n  leveldown.destroy(location, function (err) {\r\n    t.ifError(err, 'no error')\r\n    t.is(fs.existsSync(location), false, 'exists after') // Fails\r\n  })\r\n})\r\n```\r\n\r\nHere's the relevant C++, comments mine:\r\n\r\n```c++\r\nStatus DestroyDB(const std::string& dbname /*, .. */) {\r\n  FileLock* lock;\r\n  const std::string lockname = LockFileName(dbname); // \"<location>/LOCK\"\r\n  Status result = env->LockFile(lockname, &lock); // Creates <location>/LOCK\r\n  \r\n  if (result.ok()) {\r\n    // Delete files..\r\n    // ..\r\n\r\n    env->UnlockFile(lock);\r\n    env->DeleteFile(lockname); // Succeeds, directory is empty\r\n    env->DeleteDir(dbname);    // Yet this fails\r\n  }\r\n\r\n  return result;\r\n}\r\n```\r\n\r\nThe `DeleteDir` fails (silently) with:\r\n\r\n```\r\nIO error: Failed to remove dir: D:\\xx\\Level\\rocksdb\\destroy-test: Directory not empty\r\n```"}}
{"actor":{"display_login":"vweevers"}}