Bug 496398

Summary: printf changed between RELEASE=24.10 and RELEASE=24.04
Product: [I don't know] kde Reporter: Rafael S. <kde.bug>
Component: generalAssignee: Unassigned bugs <unassigned-bugs-null>
Status: RESOLVED DOWNSTREAM    
Severity: major    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Rafael S. 2024-11-17 21:06:43 UTC
core utility printf does not handle decimal parts of numeric values correctly. Instead of decimal part of a variable it just dumps this text
  "-nan"

Previous printf version works fine.
Example in bash environment on 2 systems:

===== system 1
$> cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.10
DISTRIB_CODENAME=oracular
DISTRIB_DESCRIPTION="Ubuntu 24.10"

$> ll /bin/printf
-rwxr-xr-x 1 root root 59992 Jul 31 08:24 /bin/printf

-----
$> price='123.4387'
$> count=1200
 
$> printf "%.2f %4d\n" $price $count
-nan 1200

$> printf "%.5d %.2f\n" $count $price
01200 -nan

===== system 2
$> cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.1 LTS"

$> ll /bin/printf
-rwxr-xr-x 1 root root 55744 Apr  5  2024 /bin/printf

-----
$> testVar=8753.2893
$> count=734
$> printf "%5d %.2f\n" $count $testVar
734 8753.29

$> ./printf "%5d %.2f\n" $count $testVar
734 8753.29

Note dot slash is printf from the "other system" in both cases.

Rounding numbers works fine.
What changed in printf program between April and October?

$> diff /bin/printf printf
Binary files /bin/printf and printf differ
$> ll /bin/printf printf
-rwxr-xr-x 1 root  root  55744 Apr  5  2024 /bin/printf
-rwxr-xr-x 1 raffi raffi 59992 Nov 17 12:41 printf
Comment 1 Antonio Rojas 2024-11-17 21:11:24 UTC
This has nothing to do with KDE, please report it to Kubuntu