Le 17/06/2026 à 13:49, anonymous écrivait :
URL:
   <https://savannah.gnu.org/bugs/?68453>

                  Summary: bash 5.3 on macOS (Homebrew): inconsistent locale
handling e.g. in printf builtin
                    Group: The GNU Bourne-Again SHell
                Submitter: None
                Submitted: Wed 17 Jun 2026 11:49:24 AM UTC
                 Category: None
                 Severity: 3 - Normal
                 Priority: 5 - Normal
               Item Group: None
                   Status: None
                  Privacy: Public
              Assigned to: None
              Open/Closed: Open
          Discussion Lock: Unlocked


     _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Wed 17 Jun 2026 11:49:24 AM UTC By: Anonymous
On macOS, bash 5.3 installed via Homebrew shows inconsistent behaviour e.g.in
the printf builtin when handling floating-point formatting under
LC_NUMERIC=C.

In an interactive shell, numeric input using dot decimal separator is rejected
as invalid, and output uses a comma decimal separator, despite locale
variables being unset or set to "C".

The issue is reproducible only in Homebrew bash 5.3 and does not occur in the
system default very old bash (3.2), nor was present in bash 5.2.

Steps to reproduce:

1. Start Homebrew bash 5.3: /opt/homebrew/bin/bash
2. Ensure no locale variables are set: env | grep '^LC_\|^LANG'
3. Run: printf "%f\n" 1.234

Actual result:


bash: printf: 1.234: invalid number
1,000000


Expected result:


1.234000


=== Additional observations: ===

* System bash works correctly:


$ /bin/bash --norc --noprofile -c 'printf "%f\n" 1.23'
1.230000


* Fix observed with explicit locale:


$ LC_NUMERIC=C bash -c 'printf "%f\n" 0.123'
0.123000


* Python confirms correct libc locale state: decimal_point == "."

* locale command reports LC_NUMERIC="C" even when issue is present.

* The most surprising behaviour is that running bash locally setting
LC_NUMERIC fixes the behaviour of the present session:

   $ printf "%f\n" 1.23
   -bash: printf: 1.23: invalid number
   1,000000
   $ LC_NUMERIC=C bash -c 'printf "%f\n" 0.123'
   0.123000
   $ printf "%f\n" 1.23
   1.230000

Bash and now other shells decided to blindly follow POSIX C string to float conversion based on what current locale LC_NUMERIC says.

The consequence is that shell execution can now fail because of a different locale setting.

The workaround is to padd LC_NUMERIC=C printf ... if the intent is to format dot decimal floating-point representations.

--
Léa Gris

Reply via email to