Skip to content

printf: Should allow leading spaces when parsing numbers #7505

Closed
@drinkcat

Description

@drinkcat

We should allow leading spaces when parsing numbers:

$ printf "%f\n" ' -0x1'
-1.000000
$ ./coreutils-main printf "%f\n" ' -0x1'
printf: '\ -0x1': expected a numeric value
0.000000

(seq parser currently does this right)

But not trailing spaces:

$ printf "%f\n" '-0x1 '
bash: printf: -0x1 : invalid number
-1.000000
$ ./coreutils-main printf "%f\n" '-0x1 '
printf: '-0x1\ ': value not completely converted
-1.000000

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions