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

Bug#427625: libc6: bindtextdomain not properly documented?

Package: libc6
Version: 2.5-7
Severity: normal

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

#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"));

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
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

-- no debconf information

Reply to: