printf escape sentences are insufficiently documented

Bug #1847152 reported by Christopher Yeleighton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
coreutils (Ubuntu)
New
Undecided
Unassigned

Bug Description

The info page for ‘printf’ is misleading because the C ‘printf’ function does not interpret any escape sequences. So, interpreting this specification literally, all escape sequences are differences but not all of them are listed below. In particular, the sequence ‘\e’ is not listed.

1) The release of Ubuntu you are using, via 'lsb_release -rd' or System -> About Ubuntu
19.04
2) The version of the package you are using, via 'apt-cache policy pkgname' or by checking in Software Center
8.30-1ubuntu1
3) What you expected to happen
   ‘printf’ prints the FORMAT string, interpreting ‘\’ escapes as specified below
and interpreting ‘%’ directives
 to format numeric and string arguments in a way that is
mostly similar to the C ‘printf’ function. *Note ‘printf’ format
directives: (libc)Output Conversion Syntax, for details. The
differences are listed below.

4) What happened instead

   ‘printf’ prints the FORMAT string, interpreting ‘%’ directives and
‘\’ escapes to format numeric and string arguments in a way that is
mostly similar to the C ‘printf’ function. *Note ‘printf’ format
directives: (libc)Output Conversion Syntax, for details. The
differences are listed below.

ProblemType: Bug
DistroRelease: Ubuntu 19.04
Package: coreutils 8.30-1ubuntu1
ProcVersionSignature: Ubuntu 5.0.0-31.33-generic 5.0.21
Uname: Linux 5.0.0-31-generic x86_64
ApportVersion: 2.20.10-0ubuntu27.1
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Mon Oct 7 23:24:39 2019
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=pl_PL.UTF-8
 SHELL=/bin/bash
SourcePackage: coreutils
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Christopher Yeleighton (giecrilj) wrote :
Revision history for this message
C de-Avillez (hggdh2) wrote :

Hello Christopher, thank you for opening this bug and helping make Ubuntu (and coreutils!) better.

I am somewhat confused here. Are you suggesting a change in wording?

Revision history for this message
Christopher Yeleighton (giecrilj) wrote :

No, I do not. I suggest a change in content because the current content is wrong.
One correction though: the ‘printf’ library interface does recognise two escape sequences, namely ‘\%’ and ‘\\’. These two are supported by the ‘printf’ command, of course, but all other escape sequences are command-specific and should be documented somehow. Not all of them are documented on the info page, e.g. ‘\n’ is not.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.