-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 MSBuild command parser confused by Fully Qualified Path to proj files in Linux root #1894 #1954
Conversation
@dotnet-bot test OSX Build for CoreCLR please |
@Sarabeth-Jaffe-Microsoft any chance someone can look at the OSX build failure? I'm getting this from the console output of the build...
I re-triggered the build in case it was a once off. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution.
Please create a unit test to verify this fixes the issue.
@mmitche Our OS X build is failing because of a weird
|
Apparently I did, sorry I missed that. Since the action that is failing is downloading a |
@jeffkl Almost certainly. Speeds are extremely low. |
@jeffkl changed tack a bit to make it easier to unit test. Looks like the OSX build servers are working again too. |
src/Shared/FileUtilities.cs
Outdated
@@ -463,6 +463,10 @@ internal static bool LooksLikeUnixFilePath(string value) | |||
{ | |||
return true; | |||
} | |||
else if (Directory.Exists(value) || File.Exists(value)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, this code is on the hot path (might get called hundreds of thousands of times on large builds). Though I don't see a way of reducing IO even further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's pretty unfortunate, and I think it'd be worth taking a bit of extra care here.
Could the check just be even more explicit for the file-in-root situation?
if (value[0] == '/' && firstSlash == 0 && (Directory.Exists(value) || File.Exists(value)))
{
return true;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the patch! I would like to see consideration of the super-explicit check before we decide to go with this approach.
@rainersigwald @cdmihai it is a terrible check to have to do. I couldn't think of a good way around it though. I've made it more explicit as requested. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that this is unpleasant, but I like the impact reduction of this--the new check shouldn't be very expensive even when run a bajillion times in a build, since it'll usually short-circuit out on a nice simple int-zero check.
Thanks!
Yeah, that check is wayyyy better than my original one |
…oj files in Linux root (#1894) The FileUtilities.LooksLikeLinuxPath() only returns true if the first path segment is a directory. This can't be true for files in the root directory on *nix systems. This commit adds an additional check to determine if the parameter is a file.
@patros, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
@dotnet-bot test Windows_NT Build for Desktop please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Thanks for the fix, @patros! |
You're welcome! |
FileUtilities.LooksLikeUnixPath() only returned true if the first path segment is a directory. This can't be true for files in the root directory on *nix systems. This commit adds an additional check to determine if the parameter is a file or directory in the root. Fixes dotnet#1894.
The FileUtilities.LooksLikeLinuxPath() only returns true if the first path
segment is a directory. This can't be true for files in the root directory
on *nix systems. This commit adds an additional check to determine if the
parameter is a file.