Bug 652870 - strtol man page lies about thousands separator.
Summary: strtol man page lies about thousands separator.
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: man-pages
Version: 14
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
Assignee: Ivana Varekova
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-11-13 04:53 UTC by JW
Modified: 2013-02-09 23:34 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-01-25 14:38:17 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

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


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