You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Travis Vitek (JIRA)" <ji...@apache.org> on 2007/11/13 00:20:51 UTC

[jira] Created: (STDCXX-665) [IBM XLC++ 9.0/AIX 5.3] 22.locale.messages fails with assertions

[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
             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.


[jira] Commented: (STDCXX-665) [IBM XLC++ 9.0/AIX 5.3] 22.locale.messages fails with assertions

Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559237#action_12559237 ] 

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

Yeah, if I would have looked I would have seen __rw_setlocale. While does make me feel better about option (4). This change would allow us to successfully open a message catalog when the locale provided to std::messages<T>::open() was not the C/POSIX locale. Any proposal for what we would do for this case? Maybe just fail?

  const std::locale classic (std::locale::classic ());
  const std::locale en_US ("en_US");

  const std::messages<char>& m = std::use_facet<std::messages<char> >(classic);

  // this would work because we would call setlocale (LC_MESSAGES, "en_US")
  // internally
  std::messages_base::catalog c1 = m.open ("catalog", en_US);
  assert (0 < c1);
  m.close (c1);

  // this would not work because we would call setlocale (LC_MESSAGES, "C")
  // internally, and the NLSPATH lookup is disabled
  std::messages_base::catalog c2 = m.open ("catalog", classic);
  assert (0 < c2);
  m.close (c2);

In that case, I feel like I should use all of 1, 2 and 4.

> [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
>
>         Attachments: stdcxx-665.patch
>
>
> 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.


[jira] Commented: (STDCXX-665) [IBM XLC++ 9.0/AIX 5.3] 22.locale.messages fails with assertions

Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559330#action_12559330 ] 

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

Question posted to IBM forums
  http://www-128.ibm.com/developerworks/forums/thread.jspa?messageID=14035619&


> [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
>
>         Attachments: stdcxx-665.patch
>
>
> 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.


[jira] Issue Comment Edited: (STDCXX-665) [IBM XLC++ 9.0/AIX 5.3] 22.locale.messages fails with assertions

Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559237#action_12559237 ] 

vitek edited comment on STDCXX-665 at 1/15/08 3:34 PM:
--------------------------------------------------------------

Yeah, if I would have looked I would have seen __rw_setlocale. This does make me feel a little better about option (4). This change would allow us to successfully open a message catalog when the locale provided to std::messages<T>::open() was not the C/POSIX locale. Any proposal for what we would do if this is not the case? Maybe just fail?

Here is a test that I believe would fail the second assert because AIX requires LC_MESSAGES to be set to something other than "C".

  const std::locale classic (std::locale::classic ());
  const std::locale en_US ("en_US");

  const std::messages<char>& m = std::use_facet<std::messages<char> >(classic);

  // this would work because we would call setlocale (LC_MESSAGES, "en_US")
  // internally
  std::messages_base::catalog c1 = m.open ("catalog", en_US);
  assert (! (c1 < 0));
  m.close (c1);

  // this would not work because we would call setlocale (LC_MESSAGES, "C")
  // internally, and the NLSPATH lookup is disabled
  std::messages_base::catalog c2 = m.open ("catalog", classic);
  assert (! (c2 < 0));
  m.close (c2);

In that case, I feel like I should use all of 1, 2 and 4.

      was (Author: vitek):
    Yeah, if I would have looked I would have seen __rw_setlocale. While does make me feel better about option (4). This change would allow us to successfully open a message catalog when the locale provided to std::messages<T>::open() was not the C/POSIX locale. Any proposal for what we would do for this case? Maybe just fail?

  const std::locale classic (std::locale::classic ());
  const std::locale en_US ("en_US");

  const std::messages<char>& m = std::use_facet<std::messages<char> >(classic);

  // this would work because we would call setlocale (LC_MESSAGES, "en_US")
  // internally
  std::messages_base::catalog c1 = m.open ("catalog", en_US);
  assert (0 < c1);
  m.close (c1);

  // this would not work because we would call setlocale (LC_MESSAGES, "C")
  // internally, and the NLSPATH lookup is disabled
  std::messages_base::catalog c2 = m.open ("catalog", classic);
  assert (0 < c2);
  m.close (c2);

In that case, I feel like I should use all of 1, 2 and 4.
  
> [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
>
>         Attachments: stdcxx-665.patch
>
>
> 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.


[jira] Updated: (STDCXX-665) [IBM XLC++ 9.0/AIX 5.3] 22.locale.messages fails with assertions

Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Travis Vitek updated STDCXX-665:
--------------------------------

    Attachment: stdcxx-665.patch

Simplified patch a little. I now use the locale returned by find_named_locale() instead of trying to find one on my own.

> [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
>
>         Attachments: stdcxx-665.patch
>
>
> 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.


[jira] Updated: (STDCXX-665) [IBM XLC++ 9.0/AIX 5.3] 22.locale.messages fails with assertions

Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Travis Vitek updated STDCXX-665:
--------------------------------

    Attachment: stdcxx-665.patch

A slightly modified version of the above testcase exposed the answer, but the behavior is still inconsistent with the AIX documentation for catopen(). The documentation says "The NLSPATH environment variable defines the directory search path. When this variable is used, the setlocale subroutine must be called before the catopen subroutine." I found that adding a call to setlocale(LC_ALL, "C") in there isn't enough, and it won't work. You have to set the locale to some non-classic locale. It doesn't really matter which one you use, but it is required that he locale be set to something other than "C".

So now the question is what do I do about this? The options I see are...

1. add a note to the documentation mentioning the limitation.
2. work around the issue and call setlocale() in the test with some known locale on AIX.
3. add an expected failure for this test.
4. modify the messages<T>::open() function to temporarily set the locale so that the call will have a chance of succeeding?

I think option 4 is totally out. It would not be thread safe, and selecting an appropriate locale could be problematic. I don't really like option 3 all that much either, because there is no way to indicate that we expect two assertion failures, and we have no way to tag those specific failures. This could potentially hide regressions.

So that leaves me with options 1 and 2, or some combination of them. I'm attaching a patch for review. It doesn't include any documentation changes. If it is determined that a documentation change is necessary, I'll update the patch for that.

> [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
>
>         Attachments: stdcxx-665.patch
>
>
> 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.


[jira] Commented: (STDCXX-665) [IBM XLC++ 9.0/AIX 5.3] 22.locale.messages fails with assertions

Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Commented: (STDCXX-665) [IBM XLC++ 9.0/AIX 5.3] 22.locale.messages fails with assertions

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559271#action_12559271 ] 

Martin Sebor commented on STDCXX-665:
-------------------------------------

I'm inclined to view the C/POSIX case as an AIX bug. It would be good to have a confirmation from IBM that they agree. If they do, we'll have the option of documenting it as a limitation until IBM fixes (with the workaround being for programs to call setlocale(LC_ALL, "some-name-other-than-C-or-POSIX") first). Otherwise, if it's by design and IBM won't fix it I'll feel more compelled to spend time trying to come up with a workaround.

> [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
>
>         Attachments: stdcxx-665.patch
>
>
> 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.


[jira] Assigned: (STDCXX-665) [IBM XLC++ 9.0/AIX 5.3] 22.locale.messages fails with assertions

Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Travis Vitek reassigned STDCXX-665:
-----------------------------------

    Assignee: Travis Vitek

> [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.


[jira] Updated: (STDCXX-665) [IBM XLC++ 9.0/AIX 5.3] 22.locale.messages fails with assertions

Posted by "Travis Vitek (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Travis Vitek updated STDCXX-665:
--------------------------------

    Attachment:     (was: stdcxx-665.patch)

> [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.


[jira] Commented: (STDCXX-665) [IBM XLC++ 9.0/AIX 5.3] 22.locale.messages fails with assertions

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559209#action_12559209 ] 

Martin Sebor commented on STDCXX-665:
-------------------------------------

I suggest bringing up the example on an AIX development newsgroup or forum:
  http://www-128.ibm.com/developerworks/forums/forum.jspa?forumID=905

As for the options, since we call setlocale() to initialize other facets I don't think calling the function from std::messages would make things any worse than they already are. Unless AIX requires that setlocale() be called before each call to catopen()? Does that change how you feel about (4)?

> [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
>
>         Attachments: stdcxx-665.patch
>
>
> 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.