This is the mail archive of the libc-alpha@sourceware.cygnus.com 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]

[miroslav.holcak@vitkovice.cz] libc/1588: Problem with locale



Hi,

I'm appending a patch for PR libc/1588.  The problem is that after a line
full of whitespace (\n is whitespace for isspace) has been parsed the
following line in locale.alias is thrown away.

In case of an empty line (or one full of whitespace) cp points at the
final \0 in line 382 - and then the while loop in line 421 ignores the
next line :-(.

I'm appending a patch which should fix this problem but asks other to
double check this.

The patch is against glibc 2.2 - but should apply also against 2.1.

Andreas

2000-02-08  Andreas Jaeger  <aj@suse.de>

	* locale/programs/locale.c (write_locales): Fix handling of
	whitespace lines.
        Fixes PR libc/1588, reported by Miroslav Holcak
        <miroslav.holcak@vitkovice.cz>.

============================================================
Index: locale/programs/locale.c
--- locale/programs/locale.c	1999/11/18 16:25:01	1.28
+++ locale/programs/locale.c	2000/02/08 14:07:27
@@ -1,5 +1,5 @@
 /* Implementation of the locale program according to POSIX 9945-2.
-   Copyright (C) 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1995.
 
@@ -376,11 +376,11 @@
 
 	  cp = buf;
 	  /* Ignore leading white space.  */
-	  while (isspace (cp[0]))
+	  while (isspace (cp[0]) && cp[0] != '\n')
 	    ++cp;
 
 	  /* A leading '#' signals a comment line.  */
-	  if (cp[0] != '\0' && cp[0] != '#')
+	  if (cp[0] != '\0' && cp[0] != '#' && cp[0] != '\n')
 	    {
 	      alias = cp++;
 	      while (cp[0] != '\0' && !isspace (cp[0]))




>Number:         1588
>Category:       libc
>Synopsis:       locale.alias
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    libc-gnats
>State:          open
>Class:          sw-bug
>Submitter-Id:   unknown
>Arrival-Date:   Tue Feb 08 06:20:02 EST 2000
>Last-Modified:
>Originator:     Miroslav Holcak
>Organization:
Vitkovice a.s.
>Release:        libc-2.0.7
>Environment:
Suse Linux 6.1,(RedHat 6.1, Debian 2.1)

Host type: i586-unknown-linux-gnu
System: Linux nsm082 2.2.5 #1 Tue Apr 13 16:33:46 MEST 1999 i586 unknown
Architecture: i586

Addons: crypt linuxthreads localedata
Build CFLAGS: -g -O2
Build CC: gcc
Build shared: yes
Build profile: no
Build omitfp: no
Stdio: libio

>Description:
	When I look for the possibilities of locale settings then first alias (in file
	locale.alias) doesn't display, it means :

File locale.alias :

# Locale name alias data base.
****===========*****
****===========*****
# Note: This file is far from being complete.  If you have a value for
# your own site which you think might be useful for others too, share
# it with the rest of us.  Send it using the `glibcbug' script to
# bugs@gnu.ai.mit.edu.
                                 <--------- one free line
czech           cs_CZ.ISO-8859-2 <--------- first alias
danish          da_DK.ISO-8859-1
dansk           da_DK.ISO-8859-1
deutsch         de_DE.ISO-8859-1
dutch           nl_NL.ISO-8859-1
.
.

nsm082:~ # locale -a | more
C
POSIX
cs
cs_CZ
cz
da
da_DK
danish
dansk
--More--


>How-To-Repeat:
	locale -a
>Fix:
	It has to be two free lines before first alias, it means :

My new locale.alias :

# Locale name alias data base.
****===========*****
****===========*****
# Note: This file is far from being complete.  If you have a value for
# your own site which you think might be useful for others too, share
# it with the rest of us.  Send it using the `glibcbug' script to
# bugs@gnu.ai.mit.edu.
                                 <--------- first free line
                                 <--------- second free line
czech           cs_CZ.ISO-8859-2 <--------- first alias
danish          da_DK.ISO-8859-1
dansk           da_DK.ISO-8859-1
deutsch         de_DE.ISO-8859-1
dutch           nl_NL.ISO-8859-1
.
.
.

nsm082:~ # locale -a | more
C
POSIX
cs
cs_CZ
cz
czech
da
da_DK
danish
dansk
--More--


Best regards, Miroslav Holcak














>Audit-Trail:
>Unformatted:




-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.rhein-neckar.de

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