Subject: bug#45890: Printf bug GNU coreutils 8.30/8.32

From: Andrea Dari <[email-masked]>
Date: Fri, 15 Jan 2021 11:08:58 +0000

Hello,

I'm using GNU coreutils 8.30, I found that the printf tool is broken while coding a shell script.

andrea@Workstation:~$ printf --version
bash: printf: --: invalid option
printf: usage: printf [-v var] format [arguments]

I tried with coreutils 8.32 too with the same error.

PRINTF(1) man page reports the option valid:

NAME
printf - format and print data

SYNOPSIS
printf FORMAT [ARGUMENT]...
printf OPTION

DESCRIPTION
Print ARGUMENT(s) according to FORMAT, or execute according to OPTION:

--help display this help and exit

--version
output version information and exit
...

the option --help works.

I have another issue with printf, I wanted to print a string that starts with "-" and printf parse it like an option:

andrea@Workstation:~$ printf "->"
bash: printf: ->: invalid option
printf: usage: printf [-v var] format [arguments]

I'm doing something wrong?

Best Regards,

Andrea Dari