Bug 77152 - printf man page inconsistent with what glibc does
Summary: printf man page inconsistent with what glibc does
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: man-pages
Version: 8.0
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Eido Inoue
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-11-01 20:33 UTC by ldd
Modified: 2005-10-31 22:00 UTC (History)
0 users

Fixed In Version: 1.66-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-02-19 17:19:57 UTC


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

Description ldd 2002-11-01 20:33:03 UTC
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 20:34:14 UTC
Created attachment 83084 [details]
Test source code to reproduce problem.

Comment 2 Eido Inoue 2003-08-07 22:47:02 UTC
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 22:53:00 UTC
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 17:19:57 UTC
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.