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

Fallback to manually consume space if posix_fallocate isn't supported at runtime #7251

Merged
merged 2 commits into from
Jan 12, 2024

Conversation

ironage
Copy link
Contributor

@ironage ironage commented Jan 11, 2024

Fixes realm/realm-js#6349 and realm/realm-dotnet#3482.

I think this has emerged as an issue since the change in #7067 where the compile time detection of POSIX_FALLOCATE changed.

According to the man pages, posix_fallocate can return not supported:

EOPNOTSUPP
              The filesystem containing the file referred to by fd does
              not support this operation.  This error code can be
              returned by C libraries that don't perform the emulation
              shown in NOTES, such as musl libc.

Fortunately for us, we do not rely on this and already have a fallback path so it is simply a matter of handling this error code in the same way. Testing this requires combination of a system that passes our compile time check but fails at runtime which we do not have yet.

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)
  • C-API, if public C++ API changed
  • bindgen/spec.yml, if public C++ API changed

@ironage ironage self-assigned this Jan 11, 2024
Copy link

coveralls-official bot commented Jan 11, 2024

Pull Request Test Coverage Report for Build james.stone_470

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 91.815%

Totals Coverage Status
Change from base Build 1965: 0.03%
Covered Lines: 232979
Relevant Lines: 253749

💛 - Coveralls

Copy link
Contributor

@kneth kneth left a comment

Choose a reason for hiding this comment

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

Should we also check for ENOTSUPP?

@ironage
Copy link
Contributor Author

ironage commented Jan 11, 2024

I think it is fine to only handle EOPNOTSUPP as that is what the man pages describes. From what I can find online, these codes are supposed to be different values, but due to historic reasons they are actually the same. Furthermore, the android sources define them as the same. So unless we encounter a device that breaks that rule, we should be fine.

@ironage ironage merged commit 865cf5e into master Jan 12, 2024
33 of 34 checks passed
@ironage ironage deleted the js/fallocate-fallback branch January 12, 2024 17:48
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

posix_fallocate() failed: Operation not supported on transport endpoint
3 participants