Bug 77152 - printf man page inconsistent with what glibc does
printf man page inconsistent with what glibc does
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: man-pages (Show other bugs)
8.0
All Linux
low Severity low
: ---
: ---
Assigned To: Eido Inoue
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-11-01 15:33 EST by ldd
Modified: 2005-10-31 17:00 EST (History)
0 users

See Also:
Fixed In Version: 1.66-1
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-02-19 12:19:57 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Test source code to reproduce problem. (245 bytes, text/plain)
2002-11-01 15:34 EST, ldd
no flags Details

  None (edit)
Description ldd 2002-11-01 15:33:03 EST
From Bugzilla Helper: 
User-Agent: Mozilla/5.0 (compatible; Konqueror/3; Linux) 
 
Description of problem: 
The man page for printf says that a negative precision for floating point 
numbers is treated as 0.  Glibc acts as if a negative precision is treated as 
if no precision was given and glibc's own documentation confirms this. 
 
Version-Release number of selected component (if applicable): 
man-pages-1.53-1 
(glibc-2.2.93-5) 
 
How reproducible: 
Always 
 
Steps to Reproduce: 
1. Save test.c somewhere. 
2. Go there and run: make test 
3. ./test 
	 
 
Actual Results:   
%.0-10f 
100.1230000000 
100 
100.123000 
100.1230000000 
100 
 
 
Expected Results:   
(Expected results based on erroneous information from man printf.) 
%.0-10f 
100.1230000000 
100 
100 
100.1230000000 
100 
 
 
Additional info:
Comment 1 ldd 2002-11-01 15:34:14 EST
Created attachment 83084 [details]
Test source code to reproduce problem.
Comment 2 Eido Inoue 2003-08-07 18:47:02 EDT
fixed in man-pages-1.58-1:

> A negative field width is taken as a `-' flag followed by a positive field  width.
Comment 3 Eido Inoue 2003-08-07 18:53:00 EDT
oops, you were talking about the PRECISION.

You're right: according to C99 and C89 (and the glibc info pages), if you write
a negative number for the precision, the default precision should apply, not
zero nor the absolute value.
Comment 4 Eido Inoue 2004-02-19 12:19:57 EST
corrected in the POSIX version of the printf man-pages-1.66

to get the POSIX version, invoke man with

man 3p printf

Note You need to log in before you can comment on or make changes to this bug.