Opened 17 years ago

Closed 17 years ago

#1970 closed defect (invalid)

bug in glibc-2.3.6?

Reported by: Arthur Demchenkov Owned by: lfs-book@…
Priority: high Milestone: 6.2
Component: Book Version: 6.3
Severity: major Keywords:
Cc:

Description

Hello, there.
I have LFS-6.2 box up and running.
I'm trying to correct wrong behaviour of the package called tripwire from BLFS.
The wrong behaviour is connected to my locale settings (my locale is ru_RU.UTF-8 ).
It seems (for me) there's a bug in glibc-2.3.6 or in current stable version of LFS.
Here's a little test program:

$ cat > test.c << "EOF"
> #include <stdlib.h>
> #include <stdio.h>
> #include <locale.h>
> main(){
>         printf("MB_CUR_MAX=%d\n", MB_CUR_MAX);
>         printf("Current locale: %s\n", setlocale( LC_ALL, "" ) );
>         printf("Current LC_CTYPE: %s\n", setlocale( LC_CTYPE, "" ) );
> }
> EOF
spinal:~/prog/test$ gcc -o test test.c && ./test
MB_CUR_MAX=1
Current locale: ru_RU.UTF-8
Current LC_CTYPE: ru_RU.UTF-8

Note MB_CUR_MAX=1 which is probably not the case for UTF-8 locale. What may be wrong?

Change History (2)

comment:1 by Arthur Demchenkov, 17 years ago

By the way, here's the link to tripwire ticket:

http://wiki.linuxfromscratch.org/blfs/ticket/2308

comment:2 by alexander@…, 17 years ago

Resolution: invalid
Status: newclosed

You simply did not read the manual page for setlocale.

The correct code is:

#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
main(){
        setlocale(LC_ALL, "");
        printf("MB_CUR_MAX=%d\n", MB_CUR_MAX);
        printf("Current locale: %s\n", setlocale( LC_ALL, NULL ) );
        printf("Current LC_CTYPE: %s\n", setlocale( LC_CTYPE, NULL ) );
}
Note: See TracTickets for help on using tickets.