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

Check file is sector aligned #117

Merged
merged 7 commits into from
Sep 15, 2022
Merged

Conversation

reynir
Copy link
Member

@reynir reynir commented Sep 9, 2022

As it is now you can attach to files which are not aligned with the sector size (often 512 bytes), and you only get a warning about this if you connect with ~buffered:false (not the default). Then mirage-block-unix on read will conjure up zero bytes to make up for the non-existing bytes. My opinion is that it's bad behavior to return bytes that aren't there on the disk.

This change checks in connect that the file is sector-aligned, and simplifies the read code.

See also Solo5/solo5#527.

@dinosaure
Copy link
Member

I think @Julow is probably interesting by this PR when he already did some works about that.

@hannesm
Copy link
Member

hannesm commented Sep 13, 2022

I'm in favour of this. But could you fix the tests so that CI has a chance to pass?

@reynir
Copy link
Member Author

reynir commented Sep 13, 2022

It seems to pass now except for the AppVeyor build which fails for unrelated reasons.

While updating the test I thought about creating a new exception rather than using Failure. I'm not sure.

@dinosaure
Copy link
Member

It seems to pass now except for the AppVeyor build which fails for unrelated reasons.

Yes, we should definitely delete AppVeyor.

@hannesm
Copy link
Member

hannesm commented Sep 15, 2022

Maybe worth to replace AppVeyor by GitHub action (so we don't loose testing on windows)?

@reynir reynir force-pushed the file-sector-aligned branch from b29afc8 to a6d00c6 Compare September 15, 2022 09:26
The other tests don't do it so maybe it's fine!?
@reynir reynir force-pushed the file-sector-aligned branch from 41dfc56 to dbab1e4 Compare September 15, 2022 10:09
@hannesm hannesm merged commit c9abb7d into mirage:main Sep 15, 2022
@reynir reynir deleted the file-sector-aligned branch September 15, 2022 10:20
hannesm added a commit to hannesm/opam-repository that referenced this pull request Sep 15, 2022
CHANGES:

* Raise an exception on connect if the file is not aligned to the `sector_size` (mirage/mirage-block-unix#117, @reynir)
* Demote log to debug when an error is returned (mirage/mirage-block-unix#119 @reynir, fixes mirage/mirage-block-unix#109)
* Remove io-page dependency (mirage/mirage-block-unix#118 @hannesm)
* Add GitHub actions for testing on macos and windows (retire Appveyor)
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