since sys-apps/gentoo-functions-1.7 the function _update_time() from /lib/gentoo/functions.sh chokes on some LC_NUMERIC locales (i.e those, where the meaning ».« and »,« are switched in numerical context): for example: > ~ # LC_NUMERIC=en_US.UTF-8 binutils-config 3 > * Switching to x86_64-pc-linux-gnu-2.43 ... > [ ok ] > > * Please remember to run: > > * # . /etc/profile vs: > ~ # LC_NUMERIC=de_DE.UTF-8 binutils-config 3 > * Switching to x86_64-pc-linux-gnu-2.43 ... > /lib/gentoo/functions.sh: line 768: printf: .1722858381,693807: invalid number > /lib/gentoo/functions.sh: line 774: ,00: syntax error: operand expected (error token is ",00")
I assume, just forcing this line 768 to a plain C locale should fix? > LC_NUMERIC=C printf -v cs '%.2f' ".${timeval#*.}"
… oops, obviously two lines above: > LC_NUMERIC=C timeval=${EPOCHREALTIME}
Thank you for the prompt report. I had quite forgotten that bash respects the radix point defined by the locale in synthesizing the value of EPOCHREALTIME. It might be simpler to use LC_ALL because it would otherwise have to be unset or set as the empty string for LC_NUMERIC to be guaranteed to have an effect. At any rate, I'll submit a fix shortly.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=7d8e163ca6b60c35f8d5baff18a2be781e9a97e5 commit 7d8e163ca6b60c35f8d5baff18a2be781e9a97e5 Author: Kerin Millar <kfm@plushkava.net> AuthorDate: 2024-08-05 14:49:51 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-08-05 20:38:56 +0000 Ensure a radix character of U+2E in _update_time() I overlooked that bash respects the radix character defined by the locale in the course of synthesizing the value of the EPOCHREALTIME value. Set LC_NUMERIC as C to guarantee that the radix character is considered as U+2E (FULL STOP) within the scope of the bash-specific function. Doing so also addresses a distinct issue whereby the invocation of printf was sensitive to the implied value of LC_NUMERIC. Another way to address this would have been to set LC_ALL as C. I decided not to because it would decrease the likelihood of the relevant diagnostic messages being rendered in the user's native language. Additionally, add a test case. Closes: https://bugs.gentoo.org/937376 Reported-by: Christian Bricart <christian@bricart.de> Signed-off-by: Kerin Millar <kfm@plushkava.net> Signed-off-by: Sam James <sam@gentoo.org> functions.sh | 6 ++++-- test-functions | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f54526b89cedd71a028647b408f7e4d2ec7d9080 commit f54526b89cedd71a028647b408f7e4d2ec7d9080 Author: Sam James <sam@gentoo.org> AuthorDate: 2024-08-05 20:40:29 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-08-05 20:40:55 +0000 sys-apps/gentoo-functions: add 1.7.1 Kerin Millar (1): Ensure a radix character of U+2E in _update_time() Sam James (1): meson.build: prepare for gentoo-functions-1.7.1 Bug: https://bugs.gentoo.org/937376 Signed-off-by: Sam James <sam@gentoo.org> sys-apps/gentoo-functions/Manifest | 1 + .../gentoo-functions/gentoo-functions-1.7.1.ebuild | 52 ++++++++++++++++++++++ 2 files changed, 53 insertions(+)