MLstate / opalang

The Opa Language for Web Application Development
http://opalang.org
Other
1.24k stars 125 forks source link

fix invalid printf format #160

Closed damiendoligez closed 9 years ago

damiendoligez commented 10 years ago

There are some format strings that are "invalid" in the opalang sources.

In general, invalid formats are nonsensical format strings that were accepted in OCaml 4.01.0 and earlier, but whose semantics is unspecified. They are still accepted by the new Printf implementation of OCaml 4.02.0 but in some cases with different semantics, and they will be statically rejected by OCaml 4.03.0.

You can check for them in OCaml 4.02.0 with the flag -strict-formats.

In the case of opalang, I think the behavior has not changed between 4.01.0 and 4.02.0. The only kind of invalid format is "%0.3f". This is considered invalid beause it specifies a padding character (with the flag 0), but no minimum field width (no number before the dot) so there will never be padding. Even though the behaviour has not changed, you should take the opportunity to review the code and fix the format. The patch changes it to "%.3f", which keeps the behaviour unchanged, but that might still be wrong.

hbbio commented 9 years ago

Thanks Damien Could you fill the CLA to accept the pull request?

damiendoligez commented 9 years ago

I don't think the deletion of a single character is or should be considered a copyrighted work, but I filled the CLA anyway.

hbbio commented 9 years ago

It's automated, so the CLA activates the merge 'button'. Consider this as an incentive for some more contribution :)