Closed knokko closed 5 years ago
Hi @knokko, I believe this may have been fixed in positioned-io 0.3. Unfortunately I currently can't reach the original maintainer who can publish it on crates.io. So I temporarily published it as positioned-io-preview.
Usage: https://github.com/vasi/positioned-io/tree/positioned-io-preview#preview-release
Updated documentation (some breaking changes, no longer recommends try!
): https://docs.rs/positioned-io-preview
Hello @niklasf , this is indeed fixed in the preview. (Both the case with .write(true).read(true) and the case with only .write(true) . Thank you
The write_at method on std::fs::File objects doesn't work on my laptop (Windows 10). I can not quickly test this on other operating systems.
Whenever I use the write_at method (and related methods like write_all_at) on files with only write-access, it will result in an Access denied (os error 5). When the file also has read-access, the write_at method will not give an error, but the call will not have any effect (the file will stay the same). Using sync_all or sync_data doesn't help.
To test this in a small scenario, I copied the write_all_at example code and modified it a little. (The try! appears to be no longer valid syntax and my foo.data is smaller than 2^20 bytes.)
and cargo.toml
Running this code will panic with Access denied (os error 5). using r#try!(OpenOptions::new().write(true).read(true).open("foo.data")); instead will not panic, but will not change foo.data either.