<div dir="ltr">In RHEL 5 system, libc-6, I'm seeing the following strange phenomena<div><br></div><div>$ cat iconv_test.c</div><div><div>#include <stdio.h></div><div>#include <errno.h></div><div>#include <fcntl.h></div>
<div>#include <iconv.h></div><div><br></div><div>void iconv_test() {</div><div> static int nr = 0;</div><div> iconv_t iconv = iconv_open("MSCP949","UTF-8");</div><div> //iconv_t iconv = iconv_open("UTF-16","UTF-8");</div>
<div> if (iconv == (iconv_t)-1) {</div><div> puts( "can't initialize iconv");</div><div> } else {</div><div> puts( "iconv open success!" );</div><div> }</div><div> nr++;</div><div>}</div>
<div><br></div><div>int main(int argc,char **argv) {</div><div> iconv_test();</div></div><div> return 0;</div><div>}</div><div><br></div><div>$ gcc iconv_test.c</div><div>$ ./a.out</div><div>iconv open success!
</div><div>$ sudo su -</div><div># chown root:foo a.out</div><div># chmod 4555 a.out</div><div># su foo -</div><div>$ ./a.out</div><div>can't initialize iconv
</div><div>$ strace ./a.out 2>/dev/null</div><div>iconv open success!
</div><div><br></div><div><br></div><div>iconv_open on UTF-16 to UTF-8 succeeds!</div><div>This phenomena doesn't happen in recent Ubuntu.</div><div><br></div><div>I'm not familiar with the inner workings of iconv, but stracing a good iconv run reveals it dlopen so files according to the chosen encodings, maybe it's related.</div>
<div><br></div><div>1) I'll be glad for any thoughts or ideas how to debug this issue, other than downloading the libc source rpm, compiling it, LD_PRELOAD, and hope the problem will be recreated.</div><div><br></div>
<div>2) If someone can test this on a RHEL-5 machine, and report if it happens to him too, it could be helpful.</div><div><br></div><div>Thanks,</div></div>