Skip to content
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

checkModuleName uses non-canonicalized path name #6547

Closed
wants to merge 1 commit into from

Conversation

jxy
Copy link
Contributor

@jxy jxy commented Oct 20, 2017

added the non-canonicalized path to TFileInfo.

Should fix #6543 without destroying other things.

added the non-canonicalized path to TFileInfo
@@ -476,6 +476,7 @@ type
TFileInfo* = object
fullPath: string # This is a canonical full filesystem path
projPath*: string # This is relative to the project's root
path*: string # The original path when it was first encountered
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh no, not yet another path thing in here, patch shortName instead perhaps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is getting more complicated now I have thought about it. If the nim compiler were to treat symlinks as normal files, for one unique fullPath (canonicalized as it is now) could correspond to different modules from different symlinks. The information inside TFileInfo does not seem to be enough. I'll try to make a more elaborate test case with symlinks to check.

Copy link
Member

@Araq Araq Oct 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't really support symlinks, they are a clusterfuck.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If only we could all run plan9.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely besides the point, Windows doesn't really support symlinks anyway so your codebase will never work with one of the most widespread OSes out there, whether you like it or not. On Unix we can error on symlink'ed files since they are ambiguous for nim's purpose as you noted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supporting symlinks wouldn't make nim break on any OS that lacks symlinks (only plan9 comes to mind).

We can already use nim to create symlinks on Windows, #6287.

@jxy
Copy link
Contributor Author

jxy commented Oct 24, 2017

In light of #6587, do you think if absolutePath can replace canonicalizePath in places where module's fullPath is used?

I would think it doesn't make any difference for cases where there is no symlink or hard links, and it would only introduce breakage where people have been using symlinks or hard links.

In addition, replacing canonicalizePath with absolutePath can make this pull request simpler, without even touching TFileInfo.

@Araq
Copy link
Member

Araq commented Oct 25, 2017

I would think it doesn't make any difference for cases where there is no symlink or hard links, and it would only introduce breakage where people have been using symlinks or hard links.

Code evolves, I don't want to have symlinks in the git repo (would that even work accross OSes?) and without having tests in the git repo I cannot ensure that they continue to work.

Supporting symlinks wouldn't make nim break on any OS that lacks symlinks (only plan9 comes to mind).

Supporting a feature has ongoing costs.

In light of #6587, do you think if absolutePath can replace canonicalizePath in places where module's fullPath is used?

I don't know.

@jxy
Copy link
Contributor Author

jxy commented Oct 25, 2017

I'll wait for #6587 to be merged and try it out.

This branch doesn't have to be associated with symlinks, and Nim can of course stay clear from symlinks.

@Araq
Copy link
Member

Araq commented Apr 15, 2018

My remarks were ignored. Closing.

@Araq Araq closed this Apr 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nim incorrectly import/include files relative to the destination of a symlinked file
2 participants