Project

General

Profile

Actions

Bug #4854

closed

printf(1) doesn't support %b and \\c properly

Added by Garrett D'Amore about 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Category:
cmd - userland programs
Start date:
2014-05-08
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

Description

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,

Actions #1

Updated by Electric Monk about 8 years ago

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

git commit 598f4ceed9327d2d6c2325dd67cae3aa06f7fea6

commit  598f4ceed9327d2d6c2325dd67cae3aa06f7fea6
Author: Garrett D'Amore <garrett@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@joyent.com>
    Approved by: Gordon Ross <gordon.ross@nexenta.com>

Actions

Also available in: Atom PDF