#1081424 Bash built-in printf produces garbage number output in current Debian Testing (2024-09-11)

Package:
bash
Source:
bash
Description:
GNU Bourne Again SHell
Submitter:
Thomas Dreibholz
Date:
2025-09-03 16:47:02 UTC
Severity:
normal
Tags:
#1081424#5
Date:
2024-09-11 15:08:23 UTC
From:
To:
The Bash shell's built-in printf produces garbage number output in
current Debian Testing (2024-09-11), while Debian 11 and Debian 12 are
fine. Also, the output of /usr/bin/printf is fine in all tested Debian
versions.


To reproduce:

nornetpp@localhost:~$ printf "%10.0f\n" 12345678
238457416090396767707304675252454986081367308813663531015880322667198112763750854757905580355132155329820461459617415765803116286001672404059687746657869371581681572204369872464900035
123107901805462780598369748070783632739333658461196048813147075036571037797440555190334064382508846428069876326636603292685315100854206616620409994781821060679026225576101108653622576
425593438948182131256844503389214838610110136064454083062773567165839736126249568981036096370921691338747837272117747233098212989058970423082701848870955043306299909838746516740437519
8033922525924516419625153460658418345963410496114727556613682030027644190210023703445504

nornetpp@localhost:~$ printf "%10.0f\n" 12345678
211317812454266097166268525879808504795437301598056361296540803346478239609500358078835830098123475509296113237720689450943682581289087651329166275045653749141993423604502211882874640
2875683955124032326122934941018972909219768528166906921863834105770585936512483290251264

nornetpp@localhost:~$ printf "%10.0f\n" 12345678
        -0
nornetpp@localhost:~$ printf "%10.0f\n" 12345678
120700108910575556980193533346504481687255291950395671316226888855078416352941113399293872810832463844421013506463238231915332493442453933801522067740551462231838572073633660316969777
000112821137772351248307264758606730468089279621031021035307192220710062156320925053197597837835047573923044942760254784499506182230962955657077033672453144652350972206883202280328507
796930621276761966162132158726226561038606948754757028054619169767118660905288057032429487965464379336345343118648563123130181607509985990163679557181465698121168144652578159744876975
191294924717267982598678243690511798082611608664758659690358529426425809590619000232717992694367819840868083922922085255089686375180670997989211819151724861378154003176580850033621882
226363579355786936555626218976297414434959359586076160134065311523372831069479812976950922349138826772851974735645861713861889694576761826103781741892021698767096036717951513143567333
522436946970890507707068683117986755786577343694471512401334857020544465558574385355349853610975848513609696439599143756165400917123734076101715377241438125861826796515995046071682722
259277631786845673963454894760923664755987889775513993832632245398169332706364536710859192920195638924573648663684948992372153722133458993942920621985257885771498221741555330701967338
987608142749299326414401100493548497542102651107382271874761968249074968449117821706618366073791758032537802119968797659352077486805284869146183875228258000910064941445757196030055083
808221239434247309787551507083642658625113230343121403027817968902252342039872929069945500170135050462234605142789288379778684103756921430779441646453124482991190969193948103955264708
272445841090300164346821121654255045573723482012787783121458325492073089826808715675076387235258137110274164571172269623109281920943752964409578994445773037502117332196076409870788489
705422570856187333479043419158979425189468667424108607392928135856530541474101565080534253491402015385238775733427718737182097306247366779718978639036577979030405029042791139049409744
261350849596616253200729811764256147407023954444570598089744911641932357655030241638498984173402563569522300522681068722726017254642709908591858315695415748550544692603838708441860385
53427068426586613396603995809057371295966941937664
...

The output seems to be random garbage, may be the input is taken from
uninitialised memory?


With /usr/bin/printf (provided by coreutils), the output is as expected:

nornetpp@localhost:~$ /usr/bin/printf "%10.0f\n" 12345678
  12345678
nornetpp@localhost:~$ /usr/bin/printf "%10.0f\n" 12345678
  12345678


Version information:

nornetpp@localhost:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
Codename:       trixie

nornetpp@localhost:~$ date
on. 11. sep. 16:58:57 +0200 2024

nornetpp@localhost:~$ apt-show-versions | grep bash
bash:amd64/trixie 5.2.32-1 uptodate
bash-completion:all/trixie 1:2.14.0-1 uptodate

nornetpp@localhost:~$ sudo apt dist-upgrade -y
Summary:
  Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 0

#1081424#18
Date:
2024-12-06 08:11:55 UTC
From:
To:
Fixed.
#1081424#19
Date:
2025-09-03 16:45:34 UTC
From:
To: