Package: bash
Version: 5.2.21-2.1+b1
Severity: normal

Dear Maintainer,

Using bash 5.2.21-2.1, `printf '%.2f\n' .1` (or any other float value)
produces the expected result.

After upgrade to bash package 5.2.21-2.1+b1, that same statement outputs
either:
- 0.00
- -0.00
- a random float value, with a large number of digits to the left of the
  decimal separator.

I noticed this on my laptop and was able to reproduce the bug using a
Debian Sid-based podman container of mine:
--- 8< ------------------------------------------------------------------------
$ podman run --rm -i kindwolf/unstable-shell:2024080501 <<EOF
bash -c "printf '%.2f\n' 0.1"
bash -c "printf '%.2f\n' 0.1"
bash -c "printf '%.2f\n' 0.1"
bash -c "printf '%.2f\n' 0.1"
dpkg -l bash
apt update > /dev/null 2>&1 && apt install bash > /dev/null 2>&1
dpkg -l bash
bash -c "printf '%.2f\n' 0.1"
bash -c "printf '%.2f\n' 0.1"
bash -c "printf '%.2f\n' 0.1"
bash -c "printf '%.2f\n' 0.1"
EOF
0.10
0.10
0.10
0.10
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  bash           5.2.21-2.1   amd64        GNU Bourne Again SHell
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version       Architecture Description
+++-==============-=============-============-=================================
ii  bash           5.2.21-2.1+b1 amd64        GNU Bourne Again SHell
6109438027055380006607751[abridged]65066323432594610641285551911364642996224.00
-584981660093124326370703[abridged]70191893948199565939443678471705365315584.00
5363123171977038804941351[abridged]23734249005160240020871689125814289301504.00
5601186210462057897385212[abridged]67104256981197088027398783407112107065344.00
--- 8< ------------------------------------------------------------------------

I got these results on:
- a 2016 Intel CPU
- a 2024 AMD CPU
and thus assume this regression is not hardware-specific.

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.10.3-amd64 (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_OOT_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages bash depends on:
ii  base-files   13.5
ii  debianutils  5.20
ii  libc6        2.39-6
ii  libtinfo6    6.5-2

Versions of packages bash recommends:
ii  bash-completion  1:2.14.0-1

Versions of packages bash suggests:
pn  bash-doc  <none>

-- Configuration Files:
/etc/bash.bashrc changed [not included]

-- no debconf information

Reply via email to