On 2026-06-23 09:57:19 +0530, Anuradha Weeraman wrote:
> Agreed with you in principle. To be clear though, this isn't new
> or a regression and it has been parsed through the locale-aware
> strtold() historically unfortunately, and so changing it would have
> backward compatibility concerns.

The bug reporter Andrey ``Bass'' Shcheglov said that there was
a change between Debian 8 and Debian 9. But perhaps he changed
his locale?

> However, a case could be made whether such behavior could make it
> into a portable opt-in without changing the legacy default (POSIX
> itself is silent, since shell floating point arithmetic is a ksh
> extension), but that would be a discussion that would need to be
> had upstream.

Note that this also affects the comma operator when the decimal-point
chracter is the comma (as noted at the end of the ksh93(1) man page,
but a bit incorrectly). However, the comma operator is not specified
by POSIX and is an extension in shells except the basic ones.

> If you're willing to advocate a case for that, would
> you mind opening an enhancement request on
> https://github.com/ksh93/ksh/issues?

https://github.com/ksh93/ksh/issues/999

See also:
  https://www.mail-archive.com/[email protected]/msg14429.html

> Also, let me know if you have any concerns with the documentation
> fix before I forward it upstream.

At https://github.com/ksh93/ksh/issues/999 I've mentioned 2 issues
with the ksh93(1) man page:

* "Floating point constants follow the ANSI C programming language
  floating point conventions." This is not correct since C
  floating-point constants do not depend on the current locale.

* "It is a good idea to leave a space after the comma operator in
  arithmetic expressions to prevent the comma from being interpreted
  as the decimal-point character in certain locales." But a space
  *before* the comma operator may also be needed:

$ for s in "1,2" "1, 2" " 1 ,2" "1 , 2" ; do LC_ALL=fr_FR.utf8 ksh93 -c "echo 
\$(( $s ))" ; done
1,2
ksh93:  1, 2 : arithmetic syntax error
ksh93:   1 ,2 : arithmetic syntax error
2

-- 
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)

Reply via email to