Bug 496398 - printf changed between RELEASE=24.10 and RELEASE=24.04
Summary: printf changed between RELEASE=24.10 and RELEASE=24.04
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kde
Classification: I don't know
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Kubuntu Linux
: NOR major
Target Milestone: ---
Assignee: Unassigned bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-17 21:06 UTC by Rafael S.
Modified: 2024-11-17 21:11 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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