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

fix for error in the case of UNC syntax in PATH #75

Merged
merged 2 commits into from
May 25, 2013

Conversation

Lutger
Copy link

@Lutger Lutger commented May 24, 2013

Dub fails with the exception "Empty path entries not allowed" when there is an UNC path entry in the PATH environment variable. This is because the UNC syntax '\server\share\path' is treated as starting with an empty path entry.

if( path.startsWith("/") || path.startsWith("\\") ) path = path[1 .. $];
if( path.startsWith("/") || path.startsWith("\\") )
{
if( path.startsWith("\\") ) path = path[2 .. $];
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be if( path.startsWith("\\\\") )?

Copy link
Author

Choose a reason for hiding this comment

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

you're right, I'm sorry I was too hasty to commit this.

@s-ludwig
Copy link
Member

Does Path.toNativeString() produce anything useful for UNC paths with the fix? It looks like it would omit the leading backslashes and thus probably make dub fail at a later stage. But in any case, I'll also add a bunch of unit tests including UNC paths to make this more robust for the future.

@Lutger
Copy link
Author

Lutger commented May 25, 2013

Indeed, I should have posted this as an issue instead as I haven't looked at all the consequences.

Dub would fail in a later stage, but only if an UNC path is actually used. At the moment dub fails in my environment in all cases because I have an UNC path parsed by dub at startup.

I have added a further fix, but it's a bit hackish and most likely there are some syntaxes not supported by it.

@s-ludwig
Copy link
Member

Okay, thanks. I'll merge this for now and think about it some more later on (other possibilities: allow empty path entries or having an isUNC property).

s-ludwig added a commit that referenced this pull request May 25, 2013
fix for error in the case of UNC syntax in PATH
@s-ludwig s-ludwig merged commit c959b3b into dlang:master May 25, 2013
s-ludwig added a commit to vibe-d/vibe.d that referenced this pull request Jun 4, 2013
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.

2 participants