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

[android] Fix symlink comparison in Android. #2433

Merged

Conversation

drodriguez
Copy link
Contributor

The size reported by stat.st_size might not be the size of the contents
of the symlink, since it might include metadata. In Android at least the
size of a symlink seems to start at 18 bytes, even if the contents are
smaller.

The commit disables the st_size comparison against the contents
comparison for Android, and rewrites a little the function to use Swift
constructs like defer and guards.

This fixes TestFileManager.test_contentsEqual in Android.

PD: I don't know if the check is correct in many other file systems, but I don't think the test should be done at all. I only disabled it for Android because it is the only system where the symlinks doesn't seem to follow the pattern.

The size reported by stat.st_size might not be the size of the contents
of the symlink, since it might include metadata. In Android at least the
size of a symlink seems to start at 18 bytes, even if the contents are
smaller.

The commit disables the st_size comparison against the contents
comparison for Android, and rewrites a little the function to use Swift
constructs like defer and guards.
@spevans
Copy link
Contributor

spevans commented Jul 26, 2019

@swift-ci test

@spevans
Copy link
Contributor

spevans commented Jul 26, 2019

@swift-ci test linux

@millenomi millenomi merged commit 17a0575 into swiftlang:master Jul 26, 2019
@drodriguez drodriguez deleted the android-fix-symlink-comparison branch July 27, 2019 10:08
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.

3 participants