[Bug 238313] printf(1) man page incorrect

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Jun 3 17:36:14 UTC 2019


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238313

            Bug ID: 238313
           Summary: printf(1) man page incorrect
           Product: Documentation
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Manual Pages
          Assignee: bugs at FreeBSD.org
          Reporter: deepbluemistake at gmail.com
                CC: doc at FreeBSD.org

Incorrectly, the man page for printf(1) states that the \c escape works all the
time.  In reality, on FreeBSD, (and according to POSIX too) the \c escape only
works for text meant for the %b format specifier, but not in the format itself.

Actual behavior on FreeBSD (which is also correct POSIX behavior):
$ /usr/bin/printf 'foo\cbar\n'
foocbar
$ /usr/bin/printf '%b' 'foo\cbar\n'
foo$ 
# The above '$ ' in 'foo$ ' is from the shell, not printf.
$ uname -a
FreeBSD nyann.tanasinn.mochi 12.0-RELEASE-p4 FreeBSD 12.0-RELEASE-p4 GENERIC 
amd64
$ freebsd-version
12.0-RELEASE-p5

The solution for this would be to move the info about \c to the section about
the %b format, where its own special \0 handling is also specified.

Useful references:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html
https://www.freebsd.org/cgi/man.cgi?query=printf&apropos=0&sektion=0&manpath=FreeBSD+12.0-RELEASE+and+Ports&arch=default&format=html

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the freebsd-doc mailing list