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

Make matching case insensitive regardless of OS Fixes #5749 #5888

Merged
merged 3 commits into from
Dec 4, 2020

Conversation

Forgind
Copy link
Member

@Forgind Forgind commented Nov 16, 2020

First commit: update a test such that it passes only if matching is case insensitive.
Second commit: modify FileUtilities.ComparePathsNoThrow such that it can be made to be always case sensitive or case insensitive. Note that this was changed about seven months ago in #4997 where it had previously been a todo to make case sensitivity depend on OS but that implemented it.
Third commit: fix a test that theoretically ensured case insensitivity but in practice did not, changed to care about case in the same PR.

The second commit fixes #5749.

@Forgind Forgind changed the title Change case Make update matching case insensitive regardless of OS Nov 16, 2020
@Forgind Forgind changed the title Make update matching case insensitive regardless of OS Make matching case insensitive regardless of OS Fixes #5749 Nov 16, 2020
@Forgind Forgind marked this pull request as ready for review November 16, 2020 22:55
Copy link
Member

@benvillalobos benvillalobos left a comment

Choose a reason for hiding this comment

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

What exactly regressed #5749?

Should we consider leaving relevant operating systems case sensitive under a change wave?

/// <returns></returns>
internal static bool ComparePathsNoThrow(string first, string second, string currentDirectory)
internal static bool ComparePathsNoThrow(string first, string second, string currentDirectory, bool alwaysIgnoreCase = false)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Not sure why it's 'always'IgnoreCase

Suggested change
internal static bool ComparePathsNoThrow(string first, string second, string currentDirectory, bool alwaysIgnoreCase = false)
internal static bool ComparePathsNoThrow(string first, string second, string currentDirectory, bool ignoreCase = false)

Copy link
Member Author

@Forgind Forgind Nov 20, 2020

Choose a reason for hiding this comment

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

I prefer alwaysIgnoreCase because putting false here doesn't mean that you're case sensitive but that it depends on the OS. OS-dependent and always case-insensitive are the two I think of as common cases, so this distinguishes between them.

@@ -42,7 +43,7 @@ public bool IsMatch(string fileToMatch)
return _regex.IsMatch(normalizedFileToMatch);
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 we account for ignoring case here as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Absolutely. The beautiful (terrible?) part is that it already ignored case:
https://github.com/dotnet/msbuild/blob/master/src/Shared/FileMatcher.cs#L51

I can add a test for that, though.

@Forgind
Copy link
Member Author

Forgind commented Nov 20, 2020

https://github.com/dotnet/msbuild/pull/4997/files#diff-b62db5f7e7f90841af8ef58195eb4318cabc0742747ba3f2e97f10cfa21d6658L56-R80 was the change that brought it in. Totally reasonable, but it changed behavior from "todo: choose case-sensitivity based on OS" to actually doing that.

@benvillalobos
Copy link
Member

@marcpopMSFT we'd like your thoughts on retroactively putting this behind a changewave.

@marcpopMSFT
Copy link
Member

Putting it in a change waves means that once 17 releases, this would no longer be controllable. Is the customer open to changing by then and is that the ultimate behavior we want to drive towards? We could put a flag in just for this customer to opt out but that'll complicate our testing. I don't think we'd want to go back to the way we were before since it's already been two releases this way and going back could break other customers (though is admittedly less likely to break customers than switching to be case-sensitive)

@Forgind
Copy link
Member Author

Forgind commented Nov 23, 2020

@marcpopMSFT, we haven't asked, and I don't think it's obvious that that's what we should drive towards. It's probably the best way, but it's hard to take advantage of that in our case, so I'd consider it only slightly beneficial and slightly more of a breaking change.

For clarity, for going back to break someone, they would have had to:

  1. Be developing on Linux,
  2. Have two files with the same path but different casings,
  3. Have item operations that apply to one but not the other of them, and
  4. Have added that very recently.

@marcpopMSFT
Copy link
Member

@Forgind , I wasn't that worried about the impact of reversing this as you pointed out, it's more likely for folks to have been impacted by the original change than the revert. The question comes back to what is the right long term behavior? Do customers want it to be case sensitive or insensitive or OS dependent? Reverting solves the current problem.

@rainersigwald
Copy link
Member

Let's just go with "updates are case insensitive, period".

  1. It's hard to know whether a system is case sensitive.
  2. It was always this way until very recently, which surprised and broke people.
  3. This is the most Windowsy thing, and we have a long Windows heritage (even if we now wish many aspects of our behavior are more UNIXy).

@Forgind
Copy link
Member Author

Forgind commented Nov 25, 2020

In that case, this and #5853 are good to go, as far as I know.

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.

CopyToOutputDirectory is suddenly case sensitive as of 3.1.401
4 participants