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

Fixes issue #34: set tmpfile length in async writer #35

Merged
merged 3 commits into from
Jan 24, 2023

Conversation

ceejbot
Copy link
Contributor

@ceejbot ceejbot commented Jan 24, 2023

The async poll_write() implementation was creating a tempfile as a backing for its inner mmap, but it was failing to set the length on the file to match the incoming data. Compare with the sync implementation!

This bug was exposed when the memmap2 crate was swapped in for memmap. The older crate was likely more lax about this.

Wrote a pair of new tests for cacache::write_hash_sync and cacache::write_hash. The async test fails without this change, as does any benchmarks run. Everything passes with it.

The async `poll_write()` implementation was creating a tempfile as
a backing for its inner mmap, but it was failing to set the length
on the file to match the incoming data. Compare with the sync
implementation!

This bug was exposed when the `memmap2` crate was swapped in
for `memmap`. The older crate was likely more lax about this.

Wrote a pair of new tests for `cacache::write_hash_sync` and
`cacache::write_hash`. The async test fails without this change, as
does any benchmarks run. Everything passes with it.
Copy link
Owner

@zkat zkat left a comment

Choose a reason for hiding this comment

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

Ah! Good catch! Thanks so much for looking into this.

src/content/write.rs Outdated Show resolved Hide resolved
- Removed extraneous commented-out dep from testing.
- Updated Rust edition to 2021, as CI demanded.
- Ran `cargo clippy --fix` to remove all the new lints.
@zkat
Copy link
Owner

zkat commented Jan 24, 2023

https://github.com/zkat/cacache-rs/actions/runs/3991969995/jobs/6847382624#step:4:16 and it seems like it might be time to bump the MSRV

@zkat
Copy link
Owner

zkat commented Jan 24, 2023

I think the issue is more that edition2021 was still nightly-only in 1.54?

@ceejbot
Copy link
Contributor Author

ceejbot commented Jan 24, 2023

Grump, did I misread that? I didn't touch the edition field at all until after that. Looking more closely...
ETA: Yup, I see. Bumping that min version.

The first 2021 edition was version 1.56. I am guessing that
the intent was to test on the version that was stable at the time
of latest version release.
@zkat zkat merged commit 6d84ff0 into zkat:main Jan 24, 2023
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.

2 participants