Date: Tue, 24 Sep 1996 02:44:17 +0200 (MET DST) From: Robert Eckardt <roberte@mep.ruhr-uni-bochum.de> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/1673: sh's printf is broken Message-ID: <199609240044.CAA01605@ghost.mep.ruhr-uni-bochum.de> Resent-Message-ID: <199609240050.RAA01273@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 1673
>Category: bin
>Synopsis: sh's printf is broken
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Sep 23 17:50:02 PDT 1996
>Last-Modified:
>Originator: Robert Eckardt
>Organization:
Home sweet home
>Release: FreeBSD 2.1.5-RELEASE i386
>Environment:
FreeBSD 2.1.5-RELEASE as from CD
>Description:
Number conversion of sh's printf is broken.
sh's printf is meant as a replacement for the external program
/usr/bin/printf for efficiency.
For "%04d" leading spaces are printed instead of leading zeros.
For "%4.2g" the letter 'g' is printed instead of the FP number.
>How-To-Repeat:
> sh
$ printf "%04d\n" 1
1
$ /usr/bin/printf "%04d\n" 1
0001
$ printf "%4.2g\n" 1.23
g
$ /usr/bin/printf "%4.2g\n" 1.23
1.2
$
>Fix:
"To know the error means to know the solution."
As a temporary fix use /usr/bin/printf via alias:
alias printf=/usr/bin/printf
$ printf "%4.2f\n" 1.2
f
$ alias printf=/usr/bin/printf
$ printf "%4.2f\n" 1.2
1.20
$
>Audit-Trail:
>Unformatted:
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609240044.CAA01605>
