#992167 /usr/bin/printf: %.XXXXb broken/missing?

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
наб
Date:
2021-08-14 18:45:03 UTC
Severity:
normal
#992167#5
Date:
2021-08-14 18:40:33 UTC
From:
To:
Dear Maintainer,

Quoth POSIX.1-2017, printf, EXTENDED DESCRIPTION, 7.:
	An additional conversion specifier character, b, shall be supported
	as follows. The argument shall be taken to be a string that can
	contain <backslash>-escape sequences. The following <backslash>-escape
	sequences shall be supported:
[snip]
	Bytes from the converted string shall be written until the end
	of the string or the number of bytes indicated by the precision
	specification is reached. If the precision is omitted, it shall
	be taken to be infinite, so all bytes up to the end of the converted
	string shall be written.

And POSIX.1-2017, 5. File Format Notation:
	Each conversion specification is introduced by the <percent-sign>
	character ( '%' ). After the character '%', the following shall
	appear in sequence:
[snip]
	precision
	Gives the minimum number of digits to appear for the d, o, i, u, x,
	or X conversion specifiers (the field is padded with leading zeros),
	the number of digits to appear after the radix character for the
	e and f conversion specifiers, the maximum number of significant digits
	for the g conversion specifier; or the maximum number of bytes to be
	written from a string in the s conversion specifier. The precision
	shall take the form of a <period> ( '.' ) followed by a decimal digit
	string; a null digit string is treated as zero.

Therefore:
	/bin/printf X%.5bX abcdefghij
should write
	XabcdeX
but instead writes
	X
and exits 1, issuing a diagnostic:
	/bin/printf: %.5b: invalid conversion specification

This is a conformance bug.

Best,
наб