This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bugs in ld-collate.c?

Ulrich Drepper <> wrote:

> Isamu Hasegawa <> writes:
> > In locale/programs/ld-collate.c, line.2459...2502:
> Test case?

I'm sorry for insufficient report.
Attached program is a test case.

da_DK has at least 4 collating elements, AA, Aa, aA, and aa.
But the test program found no collating element.

And after applied my previous patch (and regenerating da_DK.* locales),
the test program found 4 collating elements.

In addition, da_DK.UTF-8 returns the same results.

Isamu Hasegawa
IBM Japan, Ltd.

#include <stdio.h>
#include <string.h>
#include <locale.h>
#include <locale/localeinfo.h>

int main()
  int32_t table_size, idx, i, found;
  const int32_t *symb_table;
  const unsigned char *extra;
  uint32_t nrules;
  char *ca;

  ca = setlocale(LC_ALL, "da_DK.ISO-8859-1");
  printf("current locale : %s\n", ca);

  if (nrules == 0)
      printf("No rule\n");
      return 1;

  symb_table = (const int32_t *)
  extra = (const unsigned char *)

  found = 0;
  for (i = 0; i < table_size; i++)
      if (symb_table[2 * i] != 0)
	  char elem[256];
	  idx = symb_table[2 * i + 1];
	  strncpy (elem, extra + idx + 1, extra[idx]);
	  elem[extra[idx]] = '\0';
	  printf ("Found a collating element: %s\n", elem);
  if (found == 0)
      printf ("No collating element!\n");
      return 1;
  return 0;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]