Bug 77152

Summary: printf man page inconsistent with what glibc does
Product: [Retired] Red Hat Linux Reporter: ldd
Component: man-pagesAssignee: Eido Inoue <havill>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: low Docs Contact:
Priority: low    
Version: 8.0   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.66-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-02-19 17:19:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test source code to reproduce problem. none

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