Uh oh!
There was an error while loading. Please reload this page.
Don't byteswap Fingerprints when encoding - #42335
Conversation
rust-highfive
commented
May 31, 2017
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @eddyb (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
There was a problem hiding this comment.
Can you move it to use #[derive]? Looks like it's what deriving would produce, now.
eddyb
commented
May 31, 2017
michaelwoerister
commented
May 31, 2017
Thanks for the PR! I'll review it as soon as I find the time. |
nagisa
commented
May 31, 2017
This explanation doesn’t exactly make any sense to me. It seems to me like going from machine specific to low endian in encoded form to machine specific after decoding is in fact the correct way to do this. Maybe instead it is a problem with the comment just below that says:
or something like that? |
Not if So if you are doing a superfluous conversion host <-> little endian, it won't mean any problems if you serialize and deserialize on the same host, but if you serialize on a host with one byte order, and deserialize on a host with another, you will get the order mixed up.
Nope, thats a different thing. The comment is correct, we actually encode to little endian. Admittedly, the code smells bad, it shouldn't have to use unsafe, but rather something safe with (hopefully) equivalent performance. That's a different issue though. |
michaelwoerister
commented
Jun 1, 2017
Thanks again, @jcowgill! Some comments:
Little- to big-endian host is analogous. So this gets an r+ from me once @eddyb's suggestion is implemented. |
Byteswapping Fingerprints when encoding is unnessesary and breaks if the Fingerprint is later decoded on a machine with different endianness to the one it was encoded on. Fix by removing the Encodable and Decodable implementations and use the ones derived from RustcEncodable and RustcDecodable. Fixesrust-lang#42239
jcowgill
commented
Jun 1, 2017
Hi, I've now changed the fix to use |
eddyb
commented
Jun 1, 2017
@bors r=michaelwoerister |
bors
commented
Jun 1, 2017
📌 Commit edefcb2 has been approved by |
michaelwoerister
commented
Jun 1, 2017
🎉 |
bors
commented
Jun 1, 2017
⌛ Testing commit edefcb2 with merge e776af7... |
bors
commented
Jun 1, 2017
💔 Test failed - status-travis |
Mark-Simulacrum
commented
Jun 1, 2017
@bors retry |
Mark-Simulacrum
commented
Jun 1, 2017
@bors rollup |
…oerister Don't byteswap Fingerprints when encoding Byteswapping Fingerprints when encoding is unnessesary and breaks if the Fingerprint is later decoded on a machine with different endianness to the one it was encoded on. Fixesrust-lang#42239 This PR fixes a regression caused by rust-lang#42082. @michaelwoerister
…oerister Don't byteswap Fingerprints when encoding Byteswapping Fingerprints when encoding is unnessesary and breaks if the Fingerprint is later decoded on a machine with different endianness to the one it was encoded on. Fixesrust-lang#42239 This PR fixes a regression caused by rust-lang#42082. @michaelwoerister
…oerister Don't byteswap Fingerprints when encoding Byteswapping Fingerprints when encoding is unnessesary and breaks if the Fingerprint is later decoded on a machine with different endianness to the one it was encoded on. Fixesrust-lang#42239 This PR fixes a regression caused by rust-lang#42082. @michaelwoerister
…oerister Don't byteswap Fingerprints when encoding Byteswapping Fingerprints when encoding is unnessesary and breaks if the Fingerprint is later decoded on a machine with different endianness to the one it was encoded on. Fixesrust-lang#42239 This PR fixes a regression caused by rust-lang#42082. @michaelwoerister
Byteswapping Fingerprints when encoding is unnessesary and breaks if the Fingerprint is later decoded on a machine with different endianness to the one it was encoded on.
Fixes#42239
This PR fixes a regression caused by #42082. @michaelwoerister