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

Implement _contentsEqual on Windows #2411

Merged
merged 1 commit into from
Jul 22, 2019

Conversation

gmittert
Copy link
Contributor

Compared to the POSIX implementation, this:

  • Uses the same _compareFile and _compareDirectory utilities.
  • Implements Symlink comparison with _destinationOfSymbolicLink
  • Doesn't handle devices since there's no reasonable way to check for
    that equivalence on Windows (as far as I'm aware). If given a device, it
    will instead always return false. This is probably fine since devices
    tend to be less file like on Windows anyways.

@gmittert gmittert requested review from millenomi and compnerd July 12, 2019 22:00
@millenomi
Copy link
Contributor

@swift-ci please test linux

guard DWORD(FILE_ATTRIBUTE_REPARSE_POINT) & path1Attrs == DWORD(FILE_ATTRIBUTE_REPARSE_POINT)
&& DWORD(FILE_ATTRIBUTE_REPARSE_POINT) & path2Attrs == FILE_ATTRIBUTE_REPARSE_POINT else {
return false
}
Copy link
Member

Choose a reason for hiding this comment

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

Huh? What am I missing? Isn't this the condition that is in the if?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The inner one is &&, the outer is ||. If either is a reparse point, go into the if, but if one is not a reparse point, the immediately bail out. Sadly there's no logical XOR which might make that clearer.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, does ^ not work here?

Compared to the POSIX implementation, this:
- Uses the same _compareFile and _compareDirectory utilities.
- Implements Symlink comparison with `_destinationOfSymbolicLink`
- Doesn't handle devices since there's no reasonable way to check for
  that equivalence on Windows (as far as I'm aware). If given a device, it
  will instead always return false. This is probably fine since devices
  tend to be less file like on Windows anyways.
@gmittert gmittert force-pushed the WhichOneOfYouIsTheOriginal branch from bd2efc8 to 6bc00b2 Compare July 16, 2019 22:59
@compnerd
Copy link
Member

@millenomi - any additional comments from you?

@millenomi
Copy link
Contributor

@swift-ci please test Linux

@gmittert
Copy link
Contributor Author

@swift-ci please test linux

1 similar comment
@spevans
Copy link
Contributor

spevans commented Jul 17, 2019

@swift-ci please test linux

@compnerd
Copy link
Member

I think that all the review comments have been addressed, lets get this merged.

@compnerd compnerd merged commit ea46535 into swiftlang:master Jul 22, 2019
@gmittert gmittert deleted the WhichOneOfYouIsTheOriginal branch September 9, 2019 18:13
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.

4 participants