[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#427625: marked as done (libc6: bindtextdomain not properly documented?)



Your message dated Tue, 5 Jun 2007 12:21:03 +0200
with message-id <20070605102103.GG10354@.intersec.eu>
and subject line Bug#427625: libc6: bindtextdomain not properly documented?
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: libc6
Version: 2.5-7
Severity: normal

This is probably a stupid question but take a look at this simple 
program:

----snip----
#include <libintl.h>
#include <locale.h>
#include <stdio.h>

int main()
{
  bindtextdomain("ppx", "/home/joshua/ppx/locale");
  printf("domain = %s\n", textdomain("ppx"));
  setlocale(LC_MESSAGES, "de_DE.UTF-8");
  printf("%s\n", gettext("America"));
}
----snip----

When I strace this, it never looks in /home/joshua/ppx/locale. I tested 
this on 3 Debian systems and 1 Gentoo system. Am I doing something 
stupid? I keep reading the docs for bindtextdomain but I don't 
understand what I'm doing wrong. For example:

$ cc test.c  -o test
$ strace ./test 2>&1  |grep ppx
write(1, "domain = ppx\nAmerica\n", 21domain = ppx

On my box, it looks in /usr/lib/locale/. I suspected that my compiler 
toolchain was broken but on my brother's gentoo box, it searches 
/usr/lib64/locale instead of the directory I specify in bindtextdomain. 

On the other hand, if I strace /usr/bin/hello then it searches 
/usr/share/locale which is correct. But if I dpkg-buildpackage hello 
using apt-src then that build of hello searches /usr/lib/locale/. So 
maybe my compiler toolchain really is broken?

Can you shed any light the behavior of bindtextdomain?

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.21.1-b3
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

-- no debconf information


--- End Message ---
--- Begin Message ---
On Tue, Jun 05, 2007 at 03:22:15PM +0530, joshua@nirmalvihar.info wrote:
> Package: libc6
> Version: 2.5-7
> Severity: normal
> 
> This is probably a stupid question but take a look at this simple 
> program:
> 
> ----snip----
> #include <libintl.h>
> #include <locale.h>
> #include <stdio.h>
> 
> int main()
> {
>   bindtextdomain("ppx", "/home/joshua/ppx/locale");
>   printf("domain = %s\n", textdomain("ppx"));
>   setlocale(LC_MESSAGES, "de_DE.UTF-8");
>   printf("%s\n", gettext("America"));
> }
> ----snip----
> 
> When I strace this, it never looks in /home/joshua/ppx/locale. I tested 
> this on 3 Debian systems and 1 Gentoo system. Am I doing something 
> stupid? I keep reading the docs for bindtextdomain but I don't 
> understand what I'm doing wrong. For example:

  You may want to read the whole strace.

  When I run your program on my box it does:

    [...]
    open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
    fstat(3, {st_mode=S_IFREG|0644, st_size=69697312, ...}) = 0
    mmap(NULL, 69697312, PROT_READ, MAP_PRIVATE, 3, 0) = 0x2b889a77a000
    close(3)                                = 0
    open("/usr/share/locale/locale.alias", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/joshua/ppx/locale/de_DE.UTF-8/LC_MESSAGES/ppx.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/joshua/ppx/locale/de_DE.utf8/LC_MESSAGES/ppx.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/joshua/ppx/locale/de_DE/LC_MESSAGES/ppx.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/joshua/ppx/locale/de.UTF-8/LC_MESSAGES/ppx.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/joshua/ppx/locale/de.utf8/LC_MESSAGES/ppx.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
    open("/home/joshua/ppx/locale/de/LC_MESSAGES/ppx.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
    [...]

  /usr/lib/locale/locale-archive is an index, and unrelated to your
textdomain. Then when you perform your setlocale, you can obviously see
the implementation look into the directory you previously set. It
obviously does not work on my machine since the path does not exists,
but it seems it looks for the correct files in order to find ppx.mo.

  Your bug report is wrong.
-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpyjzqtI3WCw.pgp
Description: PGP signature


--- End Message ---

Reply to: