Discussion:
[ast-developers] printf(1) doesn't support %b and \\c properly
Irek Szczesniak
2014-05-20 17:17:23 UTC
Permalink
Bug report from https://www.illumos.org/issues/4854

printf(1) fails posix compliant handling of %b and \\c

/usr/bin/printf "%b\\n" abc\\c123
abcc123

Should have been just "abc"

/usr/bin/printf "abc\\c123"
abc>

Should have been "abcc123" or possibly "abc\\c123" (technically this
behavior is a bit unspecified by POSIX).

ksh93's printf actually does something much stranger:

$ printf "abc\\c123"
abcq23

While the handling of \\c in the format string is possibly open to
interpretation,

History

#1
Updated by Electric Monk 7 days ago

% Done changed from 90 to 100
Status changed from New to Closed

git commit 598f4ceed9327d2d6c2325dd67cae3aa06f7fea6

commit 598f4ceed9327d2d6c2325dd67cae3aa06f7fea6
Author: Garrett D'Amore <garrett at damore.org>
Date: 2014-05-13T22:44:40.000Z

4818 printf(1) should support n$ width and precision specifiers
4854 printf(1) doesn't support %b and \\\\c properly
Reviewed by: Keith Wesolowski <keith.wesolowski at joyent.com>
Approved by: Gordon Ross <gordon.ross at nexenta.com>

Irek

Loading...