bugGNU gettext - Bugs: bug #44645, libintl_setlocale() still caches...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #44645: libintl_setlocale() still caches settings under Mac OS X

Submitted by:  Guido Flohr <gflohr>
Submitted on:  Fri 27 Mar 2015 10:14:44 AM UTC  
 
Category: End-user / runtimeSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

(Jump to the original submission Jump to the original submission)

Tue 31 Mar 2015 07:24:48 AM UTC, comment #8:

Yes, that's what I meant. Wait for the call to libintl_setlocale() in order to be sure that it is reachable from the application code.

It would help in the vast majority of cases but not when different languages are mixed. Still I think it would be a good idea because using the C preprocessor for function call wrappers imho isn't a robust solution.

Guido Flohr <gflohr>
Project Member
Tue 31 Mar 2015 12:56:56 AM UTC, comment #7:

> You could enable the caching from inside libintl_setlocale(). That still wouldn't be perfect but catches at least the simple cases.


I might not get what you mean correctly, but are you suggesting that we could disable the current caching mechanism until libintl_setlocale() is called? That sounds like an interesting idea, though:

> Probably I have to provide a wrapper around setlocale() in the Perl binding that calls libintl_setlocale() if it is present.


yes, I suppose this is the preferred way.

Daiki Ueno <ueno>
Project Administrator
Mon 30 Mar 2015 07:56:09 AM UTC, comment #6:

You could enable the caching from inside libintl_setlocale(). That still wouldn't be perfect but catches at least the simple cases.

Probably I have to provide a wrapper around setlocale() in the Perl binding that calls libintl_setlocale() if it is present.

Guido Flohr <gflohr>
Project Member
Mon 30 Mar 2015 07:42:17 AM UTC, comment #5:

I see your use-case and the current fix[1] is not suitable for it. However, I can't think of any other practical solution. Any suggestions? One idea is to invalidate the cache in dcigettext.c, though it might suffer performance and maintainability as I wrote in the ML post.

[1] https://lists.gnu.org/archive/html/bug-gettext/2013-03/msg00045.html

Daiki Ueno <ueno>
Project Administrator
Mon 30 Mar 2015 07:22:14 AM UTC, comment #4:

Yes, see my original bug report where I mentioned that I undefined setlocale().

I did this because the original problem is a test failure in the Perl binding libintl-perl. That Perl binding does not define setlocale(), it uses the system setlocale(3) instead.

From what I understand, other language bindings must suffer from the same problem, unless they somehow overload setlocale().

Guido Flohr <gflohr>
Project Member
Mon 30 Mar 2015 06:48:06 AM UTC, comment #3:

Well, the behavior is not surprising because you added #undef setlocale to the new test case. If I comment out the line to use libintl_setlocale(), it produces the expected result.

Daiki Ueno <ueno>
Project Administrator
Mon 30 Mar 2015 06:29:39 AM UTC, comment #2:

I can reproduce it both with a vanilla gettext-0.19.4 and the one installed with Mac Ports:

guido@macbook:/tmp/gettext-0.19.4 $ gettext-runtime/libtool --mode=link gcc -o setlocale-cache-bug -I gettext-runtime/intl setlocale-cache-bug.c gettext-runtime/intl/libintl.la
libtool: link: gcc -o .libs/setlocale-cache-bug -I gettext-runtime/intl setlocale-cache-bug.c gettext-runtime/intl/.libs/libintl.dylib -liconv -lc
guido@macbook:/tmp/gettext-0.19.4 $ ./setlocale-cache-bug
ja_JP.UTF-8
German: 未知のシステムエラー
C/en_US.UTF-8/C/C/C/C
POSIX/C: 未知のシステムエラー
guido@macbook:/tmp/gettext-0.19.4 $ cd /tmp/bug-44645
guido@macbook:/tmp/bug-44645 $ make
cc -I /opt/local/include -c -o setlocale-cache-bug.o setlocale-cache-bug.c
cc -L /opt/local/lib -lintl -o setlocale-cache-bug setlocale-cache-bug.o
guido@macbook:/tmp/bug-44645 $ ./setlocale-cache-bug
ja_JP.UTF-8
German: 未知のシステムエラー
C/en_US.UTF-8/C/C/C/C
POSIX/C: 未知のシステムエラー
guido@macbook:/tmp/bug-44645 $ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
guido@macbook:/tmp/bug-44645 $ port installed | grep gettext
Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
gettext @0.19.3_1
gettext @0.19.4_0 (active)

I have attached the exact setlocale-cache-bug.c that I used on my mac here.

The only sigifnicant difference I see to your setup is the return value of setlocale(). And I am using Mac OS X 10.10.2.

(file #33488)

Guido Flohr <gflohr>
Project Member
Mon 30 Mar 2015 03:57:29 AM UTC, comment #1:

I can't reproduce it (on OS X 10.8, though the version number is unlikely to be related). Is it really the same problem?

Daiki Ueno <ueno>
Project Administrator
Fri 27 Mar 2015 10:14:44 AM UTC, original submission:

Tried on Mac OS X Yosemite with gettext-runtime 0.19.4 from Mac Ports.

I still have the same problem as decribed in bug #38162.

Guido Flohr <gflohr>
Project Member

 

Attached Files
file #33488:  bug-44645.tar.gz added by gflohr (711B - application/x-gzip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by haible (Updated the item)
  • -unavailable- added by ueno (Posted a comment)
  • -unavailable- added by gflohr (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 27 Nov 2016 12:01:08 PM UTChaibleCategoryNone=>End-user / runtime
    Mon 30 Mar 2015 06:29:39 AM UTCgflohrAttached File-=>Added bug-44645.tar.gz, #33488

    Back to the top


    Powered by Savane 3.1-cleanup1