bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

printf '\41' erroneously fails


From: Ben Harris
Subject: printf '\41' erroneously fails
Date: Sat, 19 Apr 2003 13:51:08 +0100 (BST)

IEEE Std 1003.1, 2003 Edition states that in printf(1) format strings:

# ... "\ddd" , where ddd is a one, two, or three-digit octal number,
# shall be written as a byte with the numeric value specified by the
# octal number.
<http://www.opengroup.org/onlinepubs/009696899/utilities/printf.html>

But the version of printf(1) in GNU coreutils 5.0 (tested on a build from
clean GNU sources under Debian GNU/Linux i386 sarge) fails to correctly
handle such sequences unless the first digit is '0':

$ POSIXLY_CORRECT=1 _POSIX2_VERSION=200112 ./src/printf '\41\n'
\41
$ POSIXLY_CORRECT=1 _POSIX2_VERSION=200112 ./src/printf '\041\n'
!

The documentation for printf docuements its current behaviour and will
also need updating.

The version of printf build into GNU Bash 2.05b seems to behave correctly,
as does that shipped with NetBSD 1.6.

-- 
Ben Harris                                                   <address@hidden>
Portmaster, NetBSD/acorn26           <URL:http://www.netbsd.org/Ports/acorn26/>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]