fluent-rs icon indicating copy to clipboard operation
fluent-rs copied to clipboard

Potential panic on 32-bit systems

Open Plecra opened this issue 5 years ago • 2 comments

Anki uses a fork of the library to fix an apparent issue in fluent_bundle::types::FluentNumber::as_string

https://github.com/ankitects/fluent-rs/compare/2068c467a25b1da5d1a0d69540ca67c47bf14064..f61c5e10a53161ef5261f3c87b62047f12e4aa74

https://github.com/projectfluent/fluent-rs/blob/961450bbbfc2b20e9920b5aa1d5384a2dda3922e/fluent-bundle/src/types/number.rs#L133-L149

I don't think it's a good idea to just use the changes made for anki: they seem to defend against the panic on 32-bit systems, rather than properly solving it.

  • [ ] Reproduce that many_decimal_places test
  • [ ] (If it fails, ) introduce an architecture-agnostic fix

Plecra avatar Jul 17 '20 12:07 Plecra

Please contact me directly before bothering upstream crate authors in the future. Fluent have already implemented a fix for this panic - the reason Anki is using a forked version is because we also need maximum_fraction_digits, and have not had time to propose a separate patch for it. https://github.com/projectfluent/fluent-rs/pull/162#issuecomment-593247525

dae avatar Jul 18 '20 00:07 dae

My apologies! I'll be more careful when investigating what's been done from now on.

Would it be unreasonable to pull the float formatting out into a feature request for people watching the conversation?

Plecra avatar Jul 18 '20 20:07 Plecra

This seems to be resolved.

gregtatum avatar Nov 07 '22 15:11 gregtatum