{"action":"created","comment":{"url":"https://api.github.com/repos/dato-code/SFrame/pulls/comments/51798700","id":51798700,"diff_hunk":"@@ -384,6 +385,26 @@ extern  \"C\" {\n     search_prefixes = {\"\"};\n     search_suffixes = {\"\"};\n     file_name = \"libjvm.dylib\";\n+\n+    // Run /usr/libexec/java_home to get the libjvm location\n+    std::string libjvm_location = \"\";\n+    std::string java_home_cmd = \"/usr/libexec/java_home\";\n+    try {\n+      graphlab::process p;\n+      p.popen(java_home_cmd,\n+              std::vector<std::string>(),\n+              STDOUT_FILENO);\n+      libjvm_location = p.read_from_child();\n+      logstream(LOG_INFO) << \"Obtain JAVA_HOME from \" << java_home_cmd << \": \" << libjvm_location << std::endl;\n+    } catch (...) {\n+      logstream(LOG_WARNING) << \"Error running \" << java_home_cmd << std::endl;\n+      libjvm_location = \"\";\n+    }\n+    if (!libjvm_location.empty()) {\n+      // Make this location to be searched first `/usr/libexec/java_home`/jre/lib/server/libjvm.dylib\n+      search_prefixes.insert(search_prefixes.begin(), libjvm_location);","path":"oss_src/fileio/libhdfs_shim.cpp","position":29,"original_position":29,"commit_id":"d7f4596d77fd824366d5ccf5ddf52f006112cd0d","original_commit_id":"d7f4596d77fd824366d5ccf5ddf52f006112cd0d","user":{"login":"haijieg","id":818855,"avatar_url":"https://avatars.githubusercontent.com/u/818855?v=3","gravatar_id":"","url":"https://api.github.com/users/haijieg","html_url":"https://github.com/haijieg","followers_url":"https://api.github.com/users/haijieg/followers","following_url":"https://api.github.com/users/haijieg/following{/other_user}","gists_url":"https://api.github.com/users/haijieg/gists{/gist_id}","starred_url":"https://api.github.com/users/haijieg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haijieg/subscriptions","organizations_url":"https://api.github.com/users/haijieg/orgs","repos_url":"https://api.github.com/users/haijieg/repos","events_url":"https://api.github.com/users/haijieg/events{/privacy}","received_events_url":"https://api.github.com/users/haijieg/received_events","type":"User","site_admin":false},"body":"I believe this does the right thing.\n\nThe output of /usr/libexec/java_home is used as `search_prefix`.\n'/jre/lib/server' is used as `search_suffix`.\n'libjvm.dylib' is the `filen_ame`.\n\nAt the end of the function, the potential search paths are generated by\ndoing combinations of search_prefix / search_suffix / file_name\n\n__\n\n<http://www.dato.com/>   Jay (Haijie) Gu\nCoFounder & Principal Data Scientist\njgu@dato.com <name@dato.com>   <https://twitter.com/datoinc>\n<http://www.linkedin.com/company/graphlab>\n<https://www.facebook.com/datoinc>\n<http://www.youtube.com/channel/UC9T07WMdwB6IPf_dKXhVsCQ>\n\n\nOn Wed, Feb 3, 2016 at 2:27 PM, Yucheng Low <notifications@github.com>\nwrote:\n\n> In oss_src/fileio/libhdfs_shim.cpp\n> <https://github.com/dato-code/SFrame/pull/160#discussion_r51798227>:\n>\n> > +    std::string libjvm_location = \"\";\n> > +    std::string java_home_cmd = \"/usr/libexec/java_home\";\n> > +    try {\n> > +      graphlab::process p;\n> > +      p.popen(java_home_cmd,\n> > +              std::vector<std::string>(),\n> > +              STDOUT_FILENO);\n> > +      libjvm_location = p.read_from_child();\n> > +      logstream(LOG_INFO) << \"Obtain JAVA_HOME from \" << java_home_cmd << \": \" << libjvm_location << std::endl;\n> > +    } catch (...) {\n> > +      logstream(LOG_WARNING) << \"Error running \" << java_home_cmd << std::endl;\n> > +      libjvm_location = \"\";\n> > +    }\n> > +    if (!libjvm_location.empty()) {\n> > +      // Make this location to be searched first `/usr/libexec/java_home`/jre/lib/server/libjvm.dylib\n> > +      search_prefixes.insert(search_prefixes.begin(), libjvm_location);\n>\n> ah. the bug report was ambiguous. it is not \" /usr/libexec/java_home\" or\n> \"jre/lib/server/libjvm.dylib\".\n> where x = /usr/libexec/java_home\n> the path is \"$x/jre/lib/server/libjvm.dylib\"\n>\n> See the shell script in the bug report\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/dato-code/SFrame/pull/160/files#r51798227>.\n>\n","created_at":"2016-02-03T22:30:52Z","updated_at":"2016-02-03T22:30:52Z","html_url":"https://github.com/dato-code/SFrame/pull/160#discussion_r51798700","pull_request_url":"https://api.github.com/repos/dato-code/SFrame/pulls/160","_links":{"self":{"href":"https://api.github.com/repos/dato-code/SFrame/pulls/comments/51798700"},"html":{"href":"https://github.com/dato-code/SFrame/pull/160#discussion_r51798700"},"pull_request":{"href":"https://api.github.com/repos/dato-code/SFrame/pulls/160"}}},"pull_request":{"url":"https://api.github.com/repos/dato-code/SFrame/pulls/160","id":58202206,"html_url":"https://github.com/dato-code/SFrame/pull/160","diff_url":"https://github.com/dato-code/SFrame/pull/160.diff","patch_url":"https://github.com/dato-code/SFrame/pull/160.patch","issue_url":"https://api.github.com/repos/dato-code/SFrame/issues/160","number":160,"state":"open","locked":false,"title":"Fix read/write hdfs","user":{"login":"haijieg","id":818855,"avatar_url":"https://avatars.githubusercontent.com/u/818855?v=3","gravatar_id":"","url":"https://api.github.com/users/haijieg","html_url":"https://github.com/haijieg","followers_url":"https://api.github.com/users/haijieg/followers","following_url":"https://api.github.com/users/haijieg/following{/other_user}","gists_url":"https://api.github.com/users/haijieg/gists{/gist_id}","starred_url":"https://api.github.com/users/haijieg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haijieg/subscriptions","organizations_url":"https://api.github.com/users/haijieg/orgs","repos_url":"https://api.github.com/users/haijieg/repos","events_url":"https://api.github.com/users/haijieg/events{/privacy}","received_events_url":"https://api.github.com/users/haijieg/received_events","type":"User","site_admin":false},"body":"Use more robust libjvm.dylib for libhdfs on OS X\r\n\r\nInject `/usr/libexec/java_home`/jre/lib/server/libjvm.dylib to\r\nbe the first search location for libjvm. This is the most robust\r\nway to get the latest system libjvm.\r\n\r\nAlso fix another bug in hdfs protocol validation\r\n\r\nThis should resolve issue #159","created_at":"2016-02-03T21:19:46Z","updated_at":"2016-02-03T22:30:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c5dd7ceffbfcda1b6cf93900d0032b6408cb6793","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/dato-code/SFrame/pulls/160/commits","review_comments_url":"https://api.github.com/repos/dato-code/SFrame/pulls/160/comments","review_comment_url":"https://api.github.com/repos/dato-code/SFrame/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dato-code/SFrame/issues/160/comments","statuses_url":"https://api.github.com/repos/dato-code/SFrame/statuses/d7f4596d77fd824366d5ccf5ddf52f006112cd0d","head":{"label":"haijieg:fix_libhdfs","ref":"fix_libhdfs","sha":"d7f4596d77fd824366d5ccf5ddf52f006112cd0d","user":{"login":"haijieg","id":818855,"avatar_url":"https://avatars.githubusercontent.com/u/818855?v=3","gravatar_id":"","url":"https://api.github.com/users/haijieg","html_url":"https://github.com/haijieg","followers_url":"https://api.github.com/users/haijieg/followers","following_url":"https://api.github.com/users/haijieg/following{/other_user}","gists_url":"https://api.github.com/users/haijieg/gists{/gist_id}","starred_url":"https://api.github.com/users/haijieg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haijieg/subscriptions","organizations_url":"https://api.github.com/users/haijieg/orgs","repos_url":"https://api.github.com/users/haijieg/repos","events_url":"https://api.github.com/users/haijieg/events{/privacy}","received_events_url":"https://api.github.com/users/haijieg/received_events","type":"User","site_admin":false},"repo":{"id":46594654,"name":"SFrame","full_name":"haijieg/SFrame","owner":{"login":"haijieg","id":818855,"avatar_url":"https://avatars.githubusercontent.com/u/818855?v=3","gravatar_id":"","url":"https://api.github.com/users/haijieg","html_url":"https://github.com/haijieg","followers_url":"https://api.github.com/users/haijieg/followers","following_url":"https://api.github.com/users/haijieg/following{/other_user}","gists_url":"https://api.github.com/users/haijieg/gists{/gist_id}","starred_url":"https://api.github.com/users/haijieg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haijieg/subscriptions","organizations_url":"https://api.github.com/users/haijieg/orgs","repos_url":"https://api.github.com/users/haijieg/repos","events_url":"https://api.github.com/users/haijieg/events{/privacy}","received_events_url":"https://api.github.com/users/haijieg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/haijieg/SFrame","description":"SFrame, SArray, SGraph","fork":true,"url":"https://api.github.com/repos/haijieg/SFrame","forks_url":"https://api.github.com/repos/haijieg/SFrame/forks","keys_url":"https://api.github.com/repos/haijieg/SFrame/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haijieg/SFrame/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haijieg/SFrame/teams","hooks_url":"https://api.github.com/repos/haijieg/SFrame/hooks","issue_events_url":"https://api.github.com/repos/haijieg/SFrame/issues/events{/number}","events_url":"https://api.github.com/repos/haijieg/SFrame/events","assignees_url":"https://api.github.com/repos/haijieg/SFrame/assignees{/user}","branches_url":"https://api.github.com/repos/haijieg/SFrame/branches{/branch}","tags_url":"https://api.github.com/repos/haijieg/SFrame/tags","blobs_url":"https://api.github.com/repos/haijieg/SFrame/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haijieg/SFrame/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haijieg/SFrame/git/refs{/sha}","trees_url":"https://api.github.com/repos/haijieg/SFrame/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haijieg/SFrame/statuses/{sha}","languages_url":"https://api.github.com/repos/haijieg/SFrame/languages","stargazers_url":"https://api.github.com/repos/haijieg/SFrame/stargazers","contributors_url":"https://api.github.com/repos/haijieg/SFrame/contributors","subscribers_url":"https://api.github.com/repos/haijieg/SFrame/subscribers","subscription_url":"https://api.github.com/repos/haijieg/SFrame/subscription","commits_url":"https://api.github.com/repos/haijieg/SFrame/commits{/sha}","git_commits_url":"https://api.github.com/repos/haijieg/SFrame/git/commits{/sha}","comments_url":"https://api.github.com/repos/haijieg/SFrame/comments{/number}","issue_comment_url":"https://api.github.com/repos/haijieg/SFrame/issues/comments{/number}","contents_url":"https://api.github.com/repos/haijieg/SFrame/contents/{+path}","compare_url":"https://api.github.com/repos/haijieg/SFrame/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haijieg/SFrame/merges","archive_url":"https://api.github.com/repos/haijieg/SFrame/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haijieg/SFrame/downloads","issues_url":"https://api.github.com/repos/haijieg/SFrame/issues{/number}","pulls_url":"https://api.github.com/repos/haijieg/SFrame/pulls{/number}","milestones_url":"https://api.github.com/repos/haijieg/SFrame/milestones{/number}","notifications_url":"https://api.github.com/repos/haijieg/SFrame/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haijieg/SFrame/labels{/name}","releases_url":"https://api.github.com/repos/haijieg/SFrame/releases{/id}","deployments_url":"https://api.github.com/repos/haijieg/SFrame/deployments","created_at":"2015-11-21T00:38:57Z","updated_at":"2016-01-22T01:39:53Z","pushed_at":"2016-02-03T21:17:59Z","git_url":"git://github.com/haijieg/SFrame.git","ssh_url":"git@github.com:haijieg/SFrame.git","clone_url":"https://github.com/haijieg/SFrame.git","svn_url":"https://github.com/haijieg/SFrame","homepage":null,"size":4048,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"dato-code:master","ref":"master","sha":"fbcab89ca2bf192e4ad28ef576ecd55f06550103","user":{"login":"dato-code","id":10378005,"avatar_url":"https://avatars.githubusercontent.com/u/10378005?v=3","gravatar_id":"","url":"https://api.github.com/users/dato-code","html_url":"https://github.com/dato-code","followers_url":"https://api.github.com/users/dato-code/followers","following_url":"https://api.github.com/users/dato-code/following{/other_user}","gists_url":"https://api.github.com/users/dato-code/gists{/gist_id}","starred_url":"https://api.github.com/users/dato-code/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dato-code/subscriptions","organizations_url":"https://api.github.com/users/dato-code/orgs","repos_url":"https://api.github.com/users/dato-code/repos","events_url":"https://api.github.com/users/dato-code/events{/privacy}","received_events_url":"https://api.github.com/users/dato-code/received_events","type":"Organization","site_admin":false},"repo":{"id":41886367,"name":"SFrame","full_name":"dato-code/SFrame","owner":{"login":"dato-code","id":10378005,"avatar_url":"https://avatars.githubusercontent.com/u/10378005?v=3","gravatar_id":"","url":"https://api.github.com/users/dato-code","html_url":"https://github.com/dato-code","followers_url":"https://api.github.com/users/dato-code/followers","following_url":"https://api.github.com/users/dato-code/following{/other_user}","gists_url":"https://api.github.com/users/dato-code/gists{/gist_id}","starred_url":"https://api.github.com/users/dato-code/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dato-code/subscriptions","organizations_url":"https://api.github.com/users/dato-code/orgs","repos_url":"https://api.github.com/users/dato-code/repos","events_url":"https://api.github.com/users/dato-code/events{/privacy}","received_events_url":"https://api.github.com/users/dato-code/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dato-code/SFrame","description":"SFrame, SArray, SGraph","fork":false,"url":"https://api.github.com/repos/dato-code/SFrame","forks_url":"https://api.github.com/repos/dato-code/SFrame/forks","keys_url":"https://api.github.com/repos/dato-code/SFrame/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dato-code/SFrame/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dato-code/SFrame/teams","hooks_url":"https://api.github.com/repos/dato-code/SFrame/hooks","issue_events_url":"https://api.github.com/repos/dato-code/SFrame/issues/events{/number}","events_url":"https://api.github.com/repos/dato-code/SFrame/events","assignees_url":"https://api.github.com/repos/dato-code/SFrame/assignees{/user}","branches_url":"https://api.github.com/repos/dato-code/SFrame/branches{/branch}","tags_url":"https://api.github.com/repos/dato-code/SFrame/tags","blobs_url":"https://api.github.com/repos/dato-code/SFrame/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dato-code/SFrame/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dato-code/SFrame/git/refs{/sha}","trees_url":"https://api.github.com/repos/dato-code/SFrame/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dato-code/SFrame/statuses/{sha}","languages_url":"https://api.github.com/repos/dato-code/SFrame/languages","stargazers_url":"https://api.github.com/repos/dato-code/SFrame/stargazers","contributors_url":"https://api.github.com/repos/dato-code/SFrame/contributors","subscribers_url":"https://api.github.com/repos/dato-code/SFrame/subscribers","subscription_url":"https://api.github.com/repos/dato-code/SFrame/subscription","commits_url":"https://api.github.com/repos/dato-code/SFrame/commits{/sha}","git_commits_url":"https://api.github.com/repos/dato-code/SFrame/git/commits{/sha}","comments_url":"https://api.github.com/repos/dato-code/SFrame/comments{/number}","issue_comment_url":"https://api.github.com/repos/dato-code/SFrame/issues/comments{/number}","contents_url":"https://api.github.com/repos/dato-code/SFrame/contents/{+path}","compare_url":"https://api.github.com/repos/dato-code/SFrame/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dato-code/SFrame/merges","archive_url":"https://api.github.com/repos/dato-code/SFrame/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dato-code/SFrame/downloads","issues_url":"https://api.github.com/repos/dato-code/SFrame/issues{/number}","pulls_url":"https://api.github.com/repos/dato-code/SFrame/pulls{/number}","milestones_url":"https://api.github.com/repos/dato-code/SFrame/milestones{/number}","notifications_url":"https://api.github.com/repos/dato-code/SFrame/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dato-code/SFrame/labels{/name}","releases_url":"https://api.github.com/repos/dato-code/SFrame/releases{/id}","deployments_url":"https://api.github.com/repos/dato-code/SFrame/deployments","created_at":"2015-09-03T22:14:14Z","updated_at":"2016-02-01T05:13:22Z","pushed_at":"2016-02-03T21:19:46Z","git_url":"git://github.com/dato-code/SFrame.git","ssh_url":"git@github.com:dato-code/SFrame.git","clone_url":"https://github.com/dato-code/SFrame.git","svn_url":"https://github.com/dato-code/SFrame","homepage":null,"size":4834,"stargazers_count":254,"watchers_count":254,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":103,"mirror_url":null,"open_issues_count":32,"forks":103,"open_issues":32,"watchers":254,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dato-code/SFrame/pulls/160"},"html":{"href":"https://github.com/dato-code/SFrame/pull/160"},"issue":{"href":"https://api.github.com/repos/dato-code/SFrame/issues/160"},"comments":{"href":"https://api.github.com/repos/dato-code/SFrame/issues/160/comments"},"review_comments":{"href":"https://api.github.com/repos/dato-code/SFrame/pulls/160/comments"},"review_comment":{"href":"https://api.github.com/repos/dato-code/SFrame/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dato-code/SFrame/pulls/160/commits"},"statuses":{"href":"https://api.github.com/repos/dato-code/SFrame/statuses/d7f4596d77fd824366d5ccf5ddf52f006112cd0d"}}}}