Bug 652870

Summary: strtol man page lies about thousands separator.
Product: [Fedora] Fedora Reporter: JW <ohtmvyyn>
Component: man-pagesAssignee: Ivana Varekova <varekova>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: jan.kratochvil, mtk.manpages, varekova
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-25 14:38:17 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:

Description JW 2010-11-13 04:53:24 UTC
Description of problem:
The strtol manual page states that "For example, the thousands separator of the current  locale may be supported".  That is simply untrue. That will NEVER be supported.

Version-Release number of selected component (if applicable):
man-pages-3.25-1

How reproducible:
Always

Steps to Reproduce:
1. man strtol
2. /separator/

  
Actual results:
2. "For example, the thousands separator of the current  locale may be supported"

Expected results:
That statement should be removed or changed.

Additional info:
A thousands separator is not and NEVER will be accepted by strtol because strtol's behavior is to terminate unambiguously at a non-digit.  If it were to accept either a comma or dot as a thousands separator then zillions of existing applications would break because:
- often strtol will parse a decimal quantity
- often a comma will be used as a separator between distinct integers
- the behavior of strtol should not change so dramatically just because of a simple locale change ... a number should always be interpreted as the same number regardless of locale
- programmer can easily strip out comma/dot before invoking strtol if known to be safe to do

The misleading statement should be removed from the manual entry because it is a total nonsense which might lead people to waste their time trying to get it to work.

Comment 1 Ivana Varekova 2011-01-25 14:38:17 UTC
Thanks. Fixed in man-pages-3.32-3.fc15.

Comment 2 Michael Kerrisk 2013-02-09 23:34:46 UTC
I have applied the following patch in upstream:

diff --git a/man3/strtol.3 b/man3/strtol.3
index 32ce1e1..f45a753 100644
--- a/man3/strtol.3
+++ b/man3/strtol.3
@@ -158,7 +158,12 @@ and then determine if an error occurred by checking whether
 .I errno
 has a nonzero value after the call.
 
-In locales other than the "C" locale, other strings may also be accepted.
+According to POSIX.1-2001,
+in locales other than the "C" and "POSIX", 
+these functions may accept other,
+implementation-defined numeric strings.
+
+other implementation-defined strings may be accepted.
 (For example, the thousands separator of the current locale may be
 supported.)
 .LP