[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#458611: strtoul("i", &endptr, 36) under tr_TR locale.



Package: libc6
Version: 2.3.6.ds1-13etch2

I found that strtoul doesn't accept "i" as a digit of a
base 36 number under tr_TR locale.

% cat tst.c
#include <stdio.h>
#include <locale.h>
#include <stdlib.h>
#include <errno.h>

int main(int argc, char **argv)
{
  unsigned long ret;
  char *e = NULL;
  setlocale(LC_ALL, "");

  errno = 0;
  ret = strtoul("i", &e, 36);
  if (errno != 0) { perror("strtoul"); }
  printf("%lu [%s]\n", ret, e);
  return 0;
}
% gcc -Wall tst.c
% LANG=tr_TR ./a.out
0 [i]

It returns 0.  "i" is not converted.

It returns 18 under C locale.

% LANG=C ./a.out    
18 []

It is caused by Turkish case conversion rule.

strtoul(3) describes about locale as follows:

|       In  locales  other  than the "C" locale, other strings may be accepted.
|       (For example, the thousands separator of the current locale may be sup-
|       ported.)

I think it is not intentional to reject "i" under tr_TR
locale.

% dpkg -l|grep libc6
ii  libc6                            2.3.6.ds1-13etch2                        GNU C Library: Shared libraries
ii  libc6-dev                        2.3.6.ds1-13etch2                        GNU C Library: Development Libraries and Hea
ii  libc6-i686                       2.3.6.ds1-13etch2                        GNU C Library: Shared libraries [i686 optimi
-- 
Tanaka Akira



Reply to: