[ 
https://issues.apache.org/jira/browse/STDCXX-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557521#action_12557521
 ] 

Travis Vitek commented on STDCXX-665:
-------------------------------------

It appears that there is some issue with catopen() on AIX. I believe the 
following testcase can be used to demonstrate.

#include <nl_types.h>
#include <locale.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

#define _RWSTD_BAD_CATD nl_catd (-1)

int main (int argc, char* argv [])
{
    if (argc < 2) {
        printf ("usage %s <catalog> [locale]\n", argv [0]);
        return 0;
    }

    if (argc > 1) {
        const char* loc = setlocale (LC_ALL, argv [2]);
        if (!loc) printf ("failed to set locale to %s\n", argv [2]);
    }

    const char* const nls = getenv ("NLSPATH");
    printf ("NLSPATH is %s\n", nls ? nls : "not set");

    const char* const lang = getenv ("LANG");
    printf ("LANG    is %s\n", lang ? lang : "not set");
    
    const nl_catd cat = catopen (argv[1], NL_CAT_LOCALE);
    if (_RWSTD_BAD_CATD == cat) {
        printf ("failed\n");
        return 1;
    }
    else {
        printf ("success\n");
        catclose (cat);
    }

    return 0;
}

Here are the results on AIX and Linux...

$ ./t.aix /nfs/homes/vitek/nls/msgs-aix.cat
NLSPATH is /nfs/homes/vitek/nls/%N
LANG    is not set
success
$ ./t.aix nls/msgs-aix.cat
NLSPATH is /nfs/homes/vitek/nls/%N
LANG    is not set
success
$ ./t.aix msgs-aix.cat
NLSPATH is /nfs/homes/vitek/nls/%N
LANG    is not set
failed


$ ./t.lin /nfs/homes/vitek/nls/msgs-lin.cat
NLSPATH is /nfs/homes/vitek/nls/%N
LANG    is not set
success
$ ./t.lin nls/msgs-lin.cat
NLSPATH is /nfs/homes/vitek/nls/%N
LANG    is not set
success
$ ./t.lin msgs-lin.cat
NLSPATH is /nfs/homes/vitek/nls/%N
LANG    is not set
success

The first run of each series uses an absolute path, the second a relative path, 
and the last should be using the NLSPATH after replacing %N with the provided 
filename. Unfortunately that last case doesn't work on AIX.

The documentation for catopen() on AIX claims that setlocale() must be called 
first if you require that the NLSPATH environment variable be used for catalog 
lookup. I've tried this using the above testcase, but it doesn't seem to have 
any effect. 

> [IBM XLC++ 9.0/AIX 5.3] 22.locale.messages fails with assertions
> ----------------------------------------------------------------
>
>                 Key: STDCXX-665
>                 URL: https://issues.apache.org/jira/browse/STDCXX-665
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Tests
>    Affects Versions: 4.2.0
>            Reporter: Travis Vitek
>            Assignee: Travis Vitek
>             Fix For: 4.2.1
>
>
> Currently only single threaded builds show this problem
> NAME                           STATUS WARN ASSERTS FAILED PERCNT    USER     
> SYS    REAL
> 22.locale.messages                  0    0     268    106    60%   0.090   
> 0.640   3.960

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to