From owner-freebsd-bugs Wed Nov 1 19:00:04 1995 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id TAA08436 for bugs-outgoing; Wed, 1 Nov 1995 19:00:04 -0800 Received: (from gnats@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id TAA08421 ; Wed, 1 Nov 1995 19:00:02 -0800 Resent-Date: Wed, 1 Nov 1995 19:00:02 -0800 Resent-Message-Id: <199511020300.TAA08421@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, kato@eclogite.eps.nagoya-u.ac.jp Received: from marble.eps.nagoya-u.ac.jp (marble.eps.nagoya-u.ac.jp [133.6.57.68]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id SAA08327 for ; Wed, 1 Nov 1995 18:57:08 -0800 Received: (from kato@localhost) by marble.eps.nagoya-u.ac.jp (8.6.12+2.4W/3.3W9) id LAA00678; Thu, 2 Nov 1995 11:57:06 +0900 Message-Id: <199511020257.LAA00678@marble.eps.nagoya-u.ac.jp> Date: Thu, 2 Nov 1995 11:57:06 +0900 From: kato@eclogite.eps.nagoya-u.ac.jp Reply-To: kato@eclogite.eps.nagoya-u.ac.jp To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/809: printf goroup bug [`.' optional precision] Sender: owner-bugs@freebsd.org Precedence: bulk >Number: 809 >Category: bin >Synopsis: `.' gives the minimum number of (DIGITS+SIGN) >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Class: change-request >Submitter-Id: current-users >Arrival-Date: Wed Nov 1 19:00:01 PST 1995 >Last-Modified: >Originator: KATO Takenori >Organization: Dept. Earth Planet. Sci. Nagoya Univ. Nagoya 464-01, JAPAN >Release: FreeBSD 2.2-CURRENT i386 >Environment: All FreeBSD 2.X box >Description: The C library functions, printf group may violate ANSI standard. The optional precision `.' gives the minimun number of not digits but DIGITS+SIGN. That is, vfprintf routine assumes digit = [0-9] & [+-]. I think `digit' should not include sign flag. This may be a 4.4BSD-derived bug, because other *BSD box shows same synopsis (not including NetBSD 1.1). This affect many of programs, which assume digit consists of [0-9]. One of the examples is libI77. >How-To-Repeat: The C code, #include void main(void) { printf("%.2d\n", 1); printf("%+.2d\n", 1); printf("%+.3d\n", 1); } gives following result: 01 +1 +01 On the contrary, NEWS, Sun, OSF/1 and Borland C++ 3.1 give following: 01 +01 +001 >Fix: not known. (maybe bug stays in /usr/src/lib/libc/stdio/vfprintf.c?) >Audit-Trail: >Unformatted: