| 621bf918 | 28-Oct-2022 |
Jose Luis Duran <[email protected]> |
strfmon_l: Use specified locale for number formatting
strfmon_l does not take fully into consideration the explicitly passed locale to perform the formatting.
Parallel universe bug report: https://
strfmon_l: Use specified locale for number formatting
strfmon_l does not take fully into consideration the explicitly passed locale to perform the formatting.
Parallel universe bug report: https://sourceware.org/bugzilla/show_bug.cgi?id=19633
Obtained from: Darwin Reviewed by: kib PR: 267410 Github PR: #620 MFC after: 1 week
show more ...
|
| 29972f06 | 28-Oct-2022 |
Jose Luis Duran <[email protected]> |
strfmon_test: Add a test for strfmon_l
Attempt to test the correctness of strfmon_l(3).
Items marked with XXX represent an invalid output.
Obtained from: https://github.com/NetBSD/src/commit/e7eba
strfmon_test: Add a test for strfmon_l
Attempt to test the correctness of strfmon_l(3).
Items marked with XXX represent an invalid output.
Obtained from: https://github.com/NetBSD/src/commit/e7eba0044fe6128291cbb7e5923c7cf7d87318cc
Reviewed by: kib PR: 267410 Github PR: #620 MFC after: 1 week
show more ...
|
| 34f88528 | 21-Oct-2022 |
Jose Luis Duran <[email protected]> |
strfmon: Fix formatting of a second fixed-width value
There is a bug when formatting two consecutive values using fixed-widths and the values need padding. This was because the value of pad_size wa
strfmon: Fix formatting of a second fixed-width value
There is a bug when formatting two consecutive values using fixed-widths and the values need padding. This was because the value of pad_size was zeroed only every other time.
Format Before After [%8n] [%8n] [ $123.45] [ $123.45] [ $123.45] [ $123.45]
Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
show more ...
|
| 750fe3e6 | 18-Oct-2022 |
Jose Luis Duran <[email protected]> |
strfmon: Fix an edge case when sep_by_space is 2
Fix an edge case by printing the required space when, the currency symbol succeeds the value, a space separates the sign from the value and the sign
strfmon: Fix an edge case when sep_by_space is 2
Fix an edge case by printing the required space when, the currency symbol succeeds the value, a space separates the sign from the value and the sign position precedes the quantity and the currency symbol.
In other words:
n_cs_precedes = 0 n_sep_by_space = 2 n_sign_posn = 1
From The Open Group's localeconv[1]:
> When {p,n,int_p,int_n}_sep_by_space is 2: > If the currency symbol and sign string are adjacent, a space separates > them; otherwise, a space separates the sign string from the value.
Format Before After [%n] [-123.45¤] [- 123.45¤]
[1]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/localeconv.html
Obtained from: Darwin Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
show more ...
|
| 947efadc | 14-Oct-2022 |
Jose Luis Duran <[email protected]> |
strfmon: Fix alignment when enclosed by parentheses
Take into consideration the possibility of quantities enclosed by parentheses when aligning.
Matches the examples from The Open Group's:
Format
strfmon: Fix alignment when enclosed by parentheses
Take into consideration the possibility of quantities enclosed by parentheses when aligning.
Matches the examples from The Open Group's:
Format Before After %(#5n [$ 123.45] [ $ 123.45 ] Use an alternative pos/neg style [($ 123.45)] [($ 123.45)] [$ 3,456.78] [ $ 3,456.78 ]
%!(#5n [ 123.45] [ 123.45 ] Disable the currency symbol [( 123.45)] [( 123.45)] [ 3,456.78] [ 3,456.78 ]
https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon.html
SD5-XSH-ERN-29 is applied, updating the examples for %(#5n and %!(#5n.
Obtained from: Darwin Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
show more ...
|
| 6da51e19 | 21-Oct-2022 |
Jose Luis Duran <[email protected]> |
strfmon: Trim the SPACE from international currency symbol
The international currency symbol (int_curr_symbol) has a mandatory SPACE character as the last character.
Trim this space after reading i
strfmon: Trim the SPACE from international currency symbol
The international currency symbol (int_curr_symbol) has a mandatory SPACE character as the last character.
Trim this space after reading it, otherwise this extra space will always be printed when displaying the int_curr_symbol.
Fixes the output when the international currency format is selected (%i).
Locale Format Before After en_US.UTF-8 [%i] [USD 123.45] [USD123.45] fr_FR.UTF-8 [%i] [123,45 EUR ] [123,45 EUR]
Note that the en_US.UTF-8 locale states that no space should be printed between the currency symbol and the value (sep_by_space = 0).
Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
show more ...
|
| 9e03b903 | 13-Oct-2022 |
Jose Luis Duran <[email protected]> |
strfmon: Avoid an out-of-bounds access
Avoid an out-of-bounds access when trying to set the space_char using an international currency format (%i) and the C/POSIX locale.
The current code tries to
strfmon: Avoid an out-of-bounds access
Avoid an out-of-bounds access when trying to set the space_char using an international currency format (%i) and the C/POSIX locale.
The current code tries to read the SPACE from int_curr_symbol[3]:
currency_symbol = strdup(lc->int_curr_symbol); space_char = *(currency_symbol+3);
But on C/POSIX locales, int_curr_symbol is empty.
Three implementations have been examined: NetBSD[1], Darwin[2], and Illumos[3]. Only NetBSD has fixed it[4].
Darwin and NetBSD also trim the mandatory final SPACE character after reading it.
Locale Format Darwin/NetBSD FreeBSD/Illumos en_US.UTF-8 [%i] [USD123.45] [USD 123.45] fr_FR.UTF-8 [%i] [123,45 EUR] [123,45 EUR ]
This commit only fixes the out-of-bounds access.
[1]: https://github.com/NetBSD/src/blob/trunk/lib/libc/stdlib/strfmon.c [2]: https://opensource.apple.com/source/Libc/Libc-1439.141.1/stdlib/NetBSD/strfmon.c.auto.html [3]: https://github.com/illumos/illumos-gate/blob/master/usr/src/lib/libc/port/locale/strfmon.c [4]: https://github.com/NetBSD/src/commit/3d7b5d498aa9609f2bc9ece9c734c5f493a8e239
Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
show more ...
|
| 3f97d37a | 16-Oct-2022 |
Jose Luis Duran <[email protected]> |
strfmon_test: Add some tests
Attempt to test the correctness of strfmon(3).
Some of them were inspired from the examples section at: https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfm
strfmon_test: Add some tests
Attempt to test the correctness of strfmon(3).
Some of them were inspired from the examples section at: https://pubs.opengroup.org/onlinepubs/9699919799/functions/strfmon.html
Items marked with XXX represent an invalid output.
Reviewed by: kib PR: 267282 Github PR: #619 MFC after: 1 week
show more ...
|