Fix resb on big endian platforms#7658
Conversation
|
/cc @leftmostcat |
| // contents of the repr info, we explicitly depend on little endian data | ||
| // in order to ensure compatibility with `zerovec`. | ||
| let (endianness, value) = (Endianness::try_from(value[0])?, &value[1..]); | ||
| if endianness != Endianness::Little { |
There was a problem hiding this comment.
issue: don't remove this check, make it compare to the platform
There was a problem hiding this comment.
You can use cfg!(target_endian = "little") to get a boolean
There was a problem hiding this comment.
Thanks, I've created a platform specific check.
utils/resb/src/binary/header.rs
Outdated
| @@ -117,11 +117,6 @@ impl TryFrom<&[u8]> for BinReprInfo { | |||
There was a problem hiding this comment.
remove the comment, it doesn't make sense
| } | ||
| }; | ||
| let descriptor = u32::from_le_bytes(descriptor); | ||
| let descriptor = u32::from_ne_bytes(descriptor); |
There was a problem hiding this comment.
We should document from_words as requiring a native-endian file, noting that zoneinfo64.res comes in both formats, and then every time we do this we should say "See documentation on from_words".
There was a problem hiding this comment.
I've added a comment under utils/resb/src/binary/deserializer.rs.
Co-authored-by: Robert Bastian <4706271+robertbastian@users.noreply.github.com>
|
@miladfarca please sign the CLA |
|
@robertbastian I'll need to check if we (IBM) are allowed to sign this CLA as we are not in your current list: |
|
@robertbastian I have now signed the CLA, sorry for the delay. |
On big endian platforms ICU4C provides data in native BE order causing ZoneInfo64 parsing to fail with "Failed to load timezone info" and is causing test failures on Node.js after enabling temporal on BE: nodejs/node#61808 This CL uses `from_ne_bytes` to read data in native endian order instead. Patch is also applied to ICU4X upstream: unicode-org/icu4x#7658 Bug: 401065166 Change-Id: Ib6d38b0decc2365187663b4eac5e2dfd3a975aa4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7583895 Reviewed-by: Manish Goregaokar <manishearth@google.com> Commit-Queue: Manish Goregaokar <manishearth@google.com> Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org> Cr-Commit-Position: refs/heads/main@{#1588862} NOKEYCHECK=True GitOrigin-RevId: 19ec3dce45600fc7c825f921ac1cebe3bc63e1ba
Original commit message:
Fix resb on big endian platforms (nodejs#7658)
Refs: unicode-org/icu4x@d310df8
Refs: unicode-org/icu4x#7658
Original commit message:
Fix resb on big endian platforms
Refs: unicode-org/icu4x@d310df8
Refs: unicode-org/icu4x#7658
On big endian platforms ICU4C provides data in native BE order causing ZoneInfo64 parsing to fail with "Failed to load timezone info" and is causing test failures on Node.js after enabling temporal on BE: nodejs/node#61808 This CL uses `from_ne_bytes` to read data in native endian order instead. Patch is also applied to ICU4X upstream: unicode-org/icu4x#7658 Bug: 401065166 Change-Id: Ib6d38b0decc2365187663b4eac5e2dfd3a975aa4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7583895 Reviewed-by: Manish Goregaokar <manishearth@google.com> Commit-Queue: Manish Goregaokar <manishearth@google.com> Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org> Cr-Commit-Position: refs/heads/main@{#1588862}
Original commit message:
Fix resb on big endian platforms
Refs: unicode-org/icu4x@d310df8
Refs: unicode-org/icu4x#7658
PR-URL: #62138
Fixes: #61808
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Original commit message:
Fix resb on big endian platforms
Refs: unicode-org/icu4x@d310df8
Refs: unicode-org/icu4x#7658
PR-URL: #62138
Fixes: #61808
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Original commit message:
Fix resb on big endian platforms
Refs: unicode-org/icu4x@d310df8
Refs: unicode-org/icu4x#7658
PR-URL: #62138
Fixes: #61808
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Node.js/V8 are now using Temporal with a dependency on Rust. On big endian platforms ICU4C provides data in native BE order causing ZoneInfo64 parsing to fail with "Failed to load timezone info" and is causing test failures on Node.js after enabling Temporal:
nodejs/node#61808
Following the instruction in this page:
https://chromium.googlesource.com/chromium/src/+/28fe000/third_party/rust/chromium_crates_io/patches/
I have uploaded a patch to Chromium to fix this issue on that repository:
http://crrev.com/c/7583895
And I have also applied the same patch here to ICU4X upstream.
Changelog
resb: Support big-endian platforms