New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

canonicalizePath does not fully canonicalize paths that contain dangling links #64

Rufflewind opened this Issue Dec 3, 2016 · 0 comments


None yet
1 participant

Rufflewind commented Dec 3, 2016

If you create a link brokenlink that points to a nonexistent file and then run canonicalizePath on brokenlink, you still get brokenlink back because the link is dangling. I think it makes more sense to return nonexistent instead.

Fixing this however, is quite tricky. The reason is that we can't trust realpath will work correctly on a nonexistent path: on Macs realpath has strange behavior with nonexistent paths (#23), and on Windows the “realpath”-equivalent (GetFinalPathName) requires an existing file to even work.

So this means our only option is to implement it using a readlink (or equivalent). But it may take more than one readlink calls to make this work, if there are more symbolic link components in the new path, Worse potentially this might loop, so we'd need a cutoff too.

All in all, this is (IMO) a fairly minor thing, but requires a lot of effort and testing to get right.

@Rufflewind Rufflewind added the bug label Dec 3, 2016

@Rufflewind Rufflewind referenced this issue Dec 3, 2016


More work on canonicalizePath #65

10 of 10 tasks complete

@Rufflewind Rufflewind self-assigned this Dec 6, 2016

@Rufflewind Rufflewind added this to the milestone Dec 6, 2016

@Rufflewind Rufflewind closed this in 936d66c Mar 2, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment