Closed kirawi closed 10 months ago
Alright, I figured it out. It turns out that after any read or write you have to seek to the beginning of the file. It was definitely not easy to find out for how simple the solution actually was, so I hope it can help anyone else dealing with the same problem.
Here is a rough minimal example: https://github.com/kirawi/min-repro/blob/bb8195fd677465ecf5f1df1b047a310107e7c4f1/src/main.rs#L378-L397
On my PopOS machine, I am experiencing errors such as:
Error: "assertion
left == rightfailed\n left: [72, 101, 108, 105, 120, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 112, 26, 150, 101, 0, 0, 0, 0, 218, 57, 163, 238, 94, 107, 75, 13, 50, 85, 191, 239, 149, 96, 24, 144, 175, 216, 7, 9, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 26, 150, 101, 0, 0, 0, 0]\n right: []"
and I'm not sure what's going on. The vector indicates that stuff is being written correctly, but the file is empty even though the same content is written to it. I suspected that the write function is going through (since there are no panics from unwrapping results) but beyond that I'm lost.