{"action":"created","issue":{"url":"https://api.github.com/repos/dart-lang/path/issues/12","repository_url":"https://api.github.com/repos/dart-lang/path","labels_url":"https://api.github.com/repos/dart-lang/path/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/dart-lang/path/issues/12/comments","events_url":"https://api.github.com/repos/dart-lang/path/issues/12/events","html_url":"https://github.com/dart-lang/path/issues/12","id":138504521,"number":12,"title":"relative() returns incorrect result","user":{"login":"devoncarew","id":1269969,"avatar_url":"https://avatars.githubusercontent.com/u/1269969?v=3","gravatar_id":"","url":"https://api.github.com/users/devoncarew","html_url":"https://github.com/devoncarew","followers_url":"https://api.github.com/users/devoncarew/followers","following_url":"https://api.github.com/users/devoncarew/following{/other_user}","gists_url":"https://api.github.com/users/devoncarew/gists{/gist_id}","starred_url":"https://api.github.com/users/devoncarew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devoncarew/subscriptions","organizations_url":"https://api.github.com/users/devoncarew/orgs","repos_url":"https://api.github.com/users/devoncarew/repos","events_url":"https://api.github.com/users/devoncarew/events{/privacy}","received_events_url":"https://api.github.com/users/devoncarew/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-03-04T15:36:22Z","updated_at":"2016-03-04T20:18:11Z","closed_at":"2016-03-04T20:03:35Z","body":"We're seeing a failure in flutter's tests (https://github.com/flutter/flutter/issues/1709) which looks like a bug in path's `relative()` function:\r\n\r\n```\r\nfrom: /var/folders/00/0w978000h01000cxqpysvccm003j4x/T/flutter_toolsZUIVMq\r\nto:   /Users/devoncarew/projects/flutter/flutter/packages\r\n\r\nresult = path.relative(to, from: from);\r\n\r\nresult: ../../../../../../Users/devoncarew/projects/flutter/flutter/packages\r\n```\r\n\r\nThe relative result isn't correct. It's off by one in the number of times it should traverse up to the parent directory. From `flutter_toolsZUIVMq` it can only go up 5 times to `/`, but it has 6 `..`'s in the relative result.\r\n"},"comment":{"url":"https://api.github.com/repos/dart-lang/path/issues/comments/192448395","html_url":"https://github.com/dart-lang/path/issues/12#issuecomment-192448395","issue_url":"https://api.github.com/repos/dart-lang/path/issues/12","id":192448395,"user":{"login":"nex3","id":188,"avatar_url":"https://avatars.githubusercontent.com/u/188?v=3","gravatar_id":"","url":"https://api.github.com/users/nex3","html_url":"https://github.com/nex3","followers_url":"https://api.github.com/users/nex3/followers","following_url":"https://api.github.com/users/nex3/following{/other_user}","gists_url":"https://api.github.com/users/nex3/gists{/gist_id}","starred_url":"https://api.github.com/users/nex3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nex3/subscriptions","organizations_url":"https://api.github.com/users/nex3/orgs","repos_url":"https://api.github.com/users/nex3/repos","events_url":"https://api.github.com/users/nex3/events{/privacy}","received_events_url":"https://api.github.com/users/nex3/received_events","type":"User","site_admin":false},"created_at":"2016-03-04T20:18:10Z","updated_at":"2016-03-04T20:18:10Z","body":"> But from `flutter_toolsZUIVMq`, it's only 5 segments up.\r\n\r\nNot if it's a directory and you're resolving a path inside it. You still have to `..` up through `flutter_toolsZUIVMq`.\r\n\r\n> What's odd is that this test works on linux. And it does look like the relative path being created in the pubspec is bad.\r\n\r\nI suspect the real issue here is OS X's symlinking of the `/tmp` directory. Relative paths that move up out of symlinked directories are unreliable; they can be resolved differently depending on what the resolving entity thinks the current working directory's path is. "}}