{"action":"created","issue":{"url":"https://api.github.com/repos/jruby/jruby/issues/4350","repository_url":"https://api.github.com/repos/jruby/jruby","labels_url":"https://api.github.com/repos/jruby/jruby/issues/4350/labels{/name}","comments_url":"https://api.github.com/repos/jruby/jruby/issues/4350/comments","events_url":"https://api.github.com/repos/jruby/jruby/issues/4350/events","html_url":"https://github.com/jruby/jruby/issues/4350","id":192911756,"number":4350,"title":"File.directory? of a uri:classloader resources ending in \"/\" incorrectly returns false","user":{"login":"the-michael-toy","id":2223707,"avatar_url":"https://avatars.githubusercontent.com/u/2223707?v=3","gravatar_id":"","url":"https://api.github.com/users/the-michael-toy","html_url":"https://github.com/the-michael-toy","followers_url":"https://api.github.com/users/the-michael-toy/followers","following_url":"https://api.github.com/users/the-michael-toy/following{/other_user}","gists_url":"https://api.github.com/users/the-michael-toy/gists{/gist_id}","starred_url":"https://api.github.com/users/the-michael-toy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/the-michael-toy/subscriptions","organizations_url":"https://api.github.com/users/the-michael-toy/orgs","repos_url":"https://api.github.com/users/the-michael-toy/repos","events_url":"https://api.github.com/users/the-michael-toy/events{/privacy}","received_events_url":"https://api.github.com/users/the-michael-toy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/jruby/jruby/milestones/58","html_url":"https://github.com/jruby/jruby/milestone/58","labels_url":"https://api.github.com/repos/jruby/jruby/milestones/58/labels","id":1987640,"number":58,"title":"JRuby 9.1.7.0","description":"","creator":{"login":"enebo","id":19819,"avatar_url":"https://avatars.githubusercontent.com/u/19819?v=3","gravatar_id":"","url":"https://api.github.com/users/enebo","html_url":"https://github.com/enebo","followers_url":"https://api.github.com/users/enebo/followers","following_url":"https://api.github.com/users/enebo/following{/other_user}","gists_url":"https://api.github.com/users/enebo/gists{/gist_id}","starred_url":"https://api.github.com/users/enebo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/enebo/subscriptions","organizations_url":"https://api.github.com/users/enebo/orgs","repos_url":"https://api.github.com/users/enebo/repos","events_url":"https://api.github.com/users/enebo/events{/privacy}","received_events_url":"https://api.github.com/users/enebo/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":52,"state":"open","created_at":"2016-09-06T23:43:40Z","updated_at":"2016-12-20T17:40:57Z","due_on":null,"closed_at":null},"comments":21,"created_at":"2016-12-01T17:30:03Z","updated_at":"2016-12-20T20:36:46Z","closed_at":"2016-12-20T17:26:33Z","body":"### Environment\r\n\r\n* jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit Server VM 25.112-b16 on 1.8.0_112-b16 +jit [darwin-x86_64]\r\n* Darwin Quindici.local 16.1.0 Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64\r\n\r\n### Bug description\r\n\r\n```Ruby\r\n  here = File.dirname(__FILE__)\r\n  FileUtils.cp_r(File.join(here, \".\"), somewhere_else)\r\n```\r\n\r\nRun from the file system the `cp_r` works as expected. If you run from a jar, you get an exception. After much investigation (see below), this is because `File.join(here, \".\")` doesn't get recognized as a directory.\r\n\r\nThis used to work in 1.7 and was discovered when testing our app under 9000. It boils down, after all the mapping of paths, to fail because\r\n\r\n* `File.dirname(__FILE__) equals `uri:classloader:/dirname`\r\n* `File.join(dirname, \".\")` gets normalized from `uri:classloader:/dirname/.` to `uri:classloader:/dirname/`\r\n* Which gets mapped to `jar:file:PATH_TO_JAR!/dirname/`\r\n* Which is not recognized as a directory because `URLResource.createClassloaderURI`calls `getResources` ([here](https://github.com/jruby/jruby/blob/036ce39f0476d4bd718e23e64caff36bb50b8dbc/core/src/main/java/org/jruby/util/URLResource.java#L193)) to determine directory contents in the absence of a `.jrubydir` file, which returns no data if passed a name with a trailing slash\r\n\r\n### Update\r\n\r\nI have actively been trying to find a fix for this, which makes this issue kind of long, sorry.\r\n"},"comment":{"url":"https://api.github.com/repos/jruby/jruby/issues/comments/268352089","html_url":"https://github.com/jruby/jruby/issues/4350#issuecomment-268352089","issue_url":"https://api.github.com/repos/jruby/jruby/issues/4350","id":268352089,"user":{"login":"the-michael-toy","id":2223707,"avatar_url":"https://avatars.githubusercontent.com/u/2223707?v=3","gravatar_id":"","url":"https://api.github.com/users/the-michael-toy","html_url":"https://github.com/the-michael-toy","followers_url":"https://api.github.com/users/the-michael-toy/followers","following_url":"https://api.github.com/users/the-michael-toy/following{/other_user}","gists_url":"https://api.github.com/users/the-michael-toy/gists{/gist_id}","starred_url":"https://api.github.com/users/the-michael-toy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/the-michael-toy/subscriptions","organizations_url":"https://api.github.com/users/the-michael-toy/orgs","repos_url":"https://api.github.com/users/the-michael-toy/repos","events_url":"https://api.github.com/users/the-michael-toy/events{/privacy}","received_events_url":"https://api.github.com/users/the-michael-toy/received_events","type":"User","site_admin":false},"created_at":"2016-12-20T20:36:46Z","updated_at":"2016-12-20T20:36:46Z","body":"Hmmm ....\r\n\r\nYou have made `File.stat(PATH_TO_DIRECTORY)` and `File.stat(PATH_TO_DIRECTORY + \"/\")` be the same, which is correct, but have you also made `File.stat(PATH_TO_FILE)` and `File.stat(PATH_TO_FILE + \"/\")` the same.\r\n\r\nI suspect that UNIX throws an ENOENT on the second case and you probably would want to do that to, somewhere in the world there is a piece of code which will lose it's mind if you don't.\r\n\r\nEasy test to write .... (checking now)\r\n"}}
{"actor":{"display_login":"the-michael-toy"}}