mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 20:40:05 +00:00
Fix handling of LC_CTYPE in locale name handling
This commit is contained in:
parent
aec84f5395
commit
cc9e536dac
@ -1,5 +1,9 @@
|
|||||||
2011-05-21 Ulrich Drepper <drepper@gmail.com>
|
2011-05-21 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
|
[BZ #12788]
|
||||||
|
* locale/setlocale.c (new_composite_name): Fix test to check for
|
||||||
|
identical name of all categories.
|
||||||
|
|
||||||
[BZ #12792]
|
[BZ #12792]
|
||||||
* libio/filedoalloc.c (local_isatty): New function.
|
* libio/filedoalloc.c (local_isatty): New function.
|
||||||
(_IO_file_doallocate): Use local_isatty.
|
(_IO_file_doallocate): Use local_isatty.
|
||||||
|
2
NEWS
2
NEWS
@ -16,7 +16,7 @@ Version 2.14
|
|||||||
12454, 12460, 12469, 12489, 12509, 12510, 12511, 12518, 12527, 12541,
|
12454, 12460, 12469, 12489, 12509, 12510, 12511, 12518, 12527, 12541,
|
||||||
12545, 12551, 12582, 12583, 12587, 12597, 12601, 12611, 12625, 12626,
|
12545, 12551, 12582, 12583, 12587, 12597, 12601, 12611, 12625, 12626,
|
||||||
12631, 12650, 12653, 12655, 12660, 12681, 12685, 12711, 12713, 12714,
|
12631, 12650, 12653, 12655, 12660, 12681, 12685, 12711, 12713, 12714,
|
||||||
12717, 12723, 12724, 12734, 12738, 12746, 12766, 12775, 12792
|
12717, 12723, 12724, 12734, 12738, 12746, 12766, 12775, 12788, 12792
|
||||||
|
|
||||||
* The RPC implementation in libc is obsoleted. Old programs keep working
|
* The RPC implementation in libc is obsoleted. Old programs keep working
|
||||||
but new programs cannot be linked with the routines in libc anymore.
|
but new programs cannot be linked with the routines in libc anymore.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1991, 1992, 1995-2000, 2002, 2003, 2004, 2006, 2008, 2010
|
/* Copyright (C) 1991, 1992, 1995-2000, 2002, 2003, 2004, 2006, 2008, 2010, 2011
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ new_composite_name (int category, const char *newnames[__LC_LAST])
|
|||||||
_nl_global_locale.__names[i]);
|
_nl_global_locale.__names[i]);
|
||||||
last_len = strlen (name);
|
last_len = strlen (name);
|
||||||
cumlen += _nl_category_name_sizes[i] + 1 + last_len + 1;
|
cumlen += _nl_category_name_sizes[i] + 1 + last_len + 1;
|
||||||
if (i > 0 && same && strcmp (name, newnames[0]) != 0)
|
if (same && name != newnames[0] && strcmp (name, newnames[0]) != 0)
|
||||||
same = 0;
|
same = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2011-05-21 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
|
[BZ #12788]
|
||||||
|
* bug-setlocale1.c: New file.
|
||||||
|
* Makefile: Add rules to build and run bug-setlocale1.
|
||||||
|
|
||||||
2011-05-17 Ulrich Drepper <drepper@gmail.com>
|
2011-05-17 Ulrich Drepper <drepper@gmail.com>
|
||||||
|
|
||||||
[BZ #11837]
|
[BZ #11837]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Copyright (C) 1996-2003,2005,2007,2008,2009 Free Software Foundation, Inc.
|
# Copyright (C) 1996-2003,2005,2007,2008,2009,2011 Free Software Foundation, Inc.
|
||||||
# This file is part of the GNU C Library.
|
# This file is part of the GNU C Library.
|
||||||
|
|
||||||
# The GNU C Library is free software; you can redistribute it and/or
|
# The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -94,7 +94,7 @@ locale_test_suite := tst_iswalnum tst_iswalpha tst_iswcntrl \
|
|||||||
|
|
||||||
tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
|
tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
|
||||||
tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
|
tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
|
||||||
tst-strfmon1 tst-sscanf tst-strptime
|
tst-strfmon1 tst-sscanf tst-strptime bug-setlocale1
|
||||||
ifeq (yes,$(build-shared))
|
ifeq (yes,$(build-shared))
|
||||||
ifneq (no,$(PERL))
|
ifneq (no,$(PERL))
|
||||||
tests: $(objpfx)mtrace-tst-leaks
|
tests: $(objpfx)mtrace-tst-leaks
|
||||||
@ -301,5 +301,8 @@ tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
|
|||||||
$(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out
|
$(objpfx)mtrace-tst-leaks: $(objpfx)tst-leaks.out
|
||||||
$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@
|
$(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@
|
||||||
|
|
||||||
|
bug-setlocale1-ENV = LOCPATH=$(common-objpfx)localedata
|
||||||
|
bug-setlocale1-ARGS = $(common-objpfx)
|
||||||
|
|
||||||
$(objdir)/iconvdata/gconv-modules:
|
$(objdir)/iconvdata/gconv-modules:
|
||||||
$(MAKE) -C ../iconvdata subdir=iconvdata $@
|
$(MAKE) -C ../iconvdata subdir=iconvdata $@
|
||||||
|
132
localedata/bug-setlocale1.c
Normal file
132
localedata/bug-setlocale1.c
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
// BZ 12788
|
||||||
|
#include <locale.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
do_test (int argc, char *argv[])
|
||||||
|
{
|
||||||
|
if (argc > 1)
|
||||||
|
{
|
||||||
|
char *newargv[5];
|
||||||
|
asprintf (&newargv[0], "%self/ld.so", argv[1]);
|
||||||
|
if (newargv[0] == NULL)
|
||||||
|
{
|
||||||
|
puts ("asprintf failed");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
newargv[1] = (char *) "--library-path";
|
||||||
|
newargv[2] = argv[1];
|
||||||
|
newargv[3] = argv[0];
|
||||||
|
newargv[4] = NULL;
|
||||||
|
|
||||||
|
char *env[3];
|
||||||
|
env[0] = (char *) "LC_CTYPE=de_DE.UTF-8";
|
||||||
|
char *loc = getenv ("LOCPATH");
|
||||||
|
if (loc == NULL || loc[0] == '\0')
|
||||||
|
{
|
||||||
|
puts ("LOCPATH not set");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
asprintf (&env[1], "LOCPATH=%s", loc);
|
||||||
|
if (newargv[0] == NULL)
|
||||||
|
{
|
||||||
|
puts ("second asprintf failed");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
env[2] = NULL;
|
||||||
|
|
||||||
|
execve (newargv[0], newargv, env);
|
||||||
|
|
||||||
|
puts ("execve returned");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
char *a = setlocale (LC_ALL, "");
|
||||||
|
printf ("setlocale(LC_ALL, \"\") = %s\n", a);
|
||||||
|
if (a == NULL)
|
||||||
|
return 1;
|
||||||
|
a = strdupa (a);
|
||||||
|
|
||||||
|
char *b = setlocale (LC_CTYPE, "");
|
||||||
|
printf ("setlocale(LC_CTYPE, \"\") = %s\n", b);
|
||||||
|
if (b == NULL)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
char *c = setlocale (LC_ALL, NULL);
|
||||||
|
printf ("setlocale(LC_ALL, NULL) = %s\n", c);
|
||||||
|
if (c == NULL)
|
||||||
|
return 1;
|
||||||
|
c = strdupa (c);
|
||||||
|
|
||||||
|
if (strcmp (a, c) != 0)
|
||||||
|
{
|
||||||
|
puts ("*** first and third result do not match");
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *d = setlocale (LC_NUMERIC, "");
|
||||||
|
printf ("setlocale(LC_NUMERIC, \"\") = %s\n", d);
|
||||||
|
if (d == NULL)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (strcmp (d, "C") != 0)
|
||||||
|
{
|
||||||
|
puts ("*** LC_NUMERIC not C");
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *e = setlocale (LC_ALL, NULL);
|
||||||
|
printf ("setlocale(LC_ALL, NULL) = %s\n", e);
|
||||||
|
if (e == NULL)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (strcmp (a, e) != 0)
|
||||||
|
{
|
||||||
|
puts ("*** first and fifth result do not match");
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *f = setlocale (LC_ALL, "C");
|
||||||
|
printf ("setlocale(LC_ALL, \"C\") = %s\n", f);
|
||||||
|
if (f == NULL)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (strcmp (f, "C") != 0)
|
||||||
|
{
|
||||||
|
puts ("*** LC_ALL not C");
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *g = setlocale (LC_ALL, NULL);
|
||||||
|
printf ("setlocale(LC_ALL, NULL) = %s\n", g);
|
||||||
|
if (g == NULL)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (strcmp (g, "C") != 0)
|
||||||
|
{
|
||||||
|
puts ("*** LC_ALL not C");
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *h = setlocale (LC_CTYPE, NULL);
|
||||||
|
printf ("setlocale(LC_CTYPE, NULL) = %s\n", h);
|
||||||
|
if (h == NULL)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (strcmp (h, "C") != 0)
|
||||||
|
{
|
||||||
|
puts ("*** LC_CTYPE not C");
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TEST_FUNCTION do_test (argc, argv)
|
||||||
|
#include "../test-skeleton.c"
|
Loading…
Reference in New Issue
Block a user