Mantis - mutt
Viewing Issue Advanced Details
2973 regular use major always 2008-12-17 21:13 2009-09-23 19:54
bfr-murphy  
skayser  
normal  
closed  
fixed  
none    
none  
0002973: mutt compiled with libidn does not work with the defaul locale
When compiled with libidn mutt does not work with the "C" or "POSIX" locales. The error 'Bad IDN "{hostname of IMAP server}".' is printed in the message line at the bottom of the terminal window and no connection is made to the IMAP server.

This is a problem because the Sun default locale is "C".

Unsetting the mutt variable use_idn or changing the value of the mutt variables charset, assumed_charset, attach_charset, config_charset, and send_charset does not fix the problem.

Possible solutions:

1) Do not compile mutt with libidn.

2) Provide a wrapper script that checks the LANG shell environment variable and changes the LC_ALL shell environment variable to another value if LANG is "C" or "POSIX". There would need to be a way for the user to specify a locale other than "C" or "POSIX" for the wrapper to use.

txt file icon mutt-ldd.txt [^] (1,205 bytes) 2009-06-02 18:33
Issue History
2008-12-17 21:13 bfr-murphy New Issue
2009-02-27 02:42 philadmin Status new => assigned
2009-02-27 02:42 philadmin Assigned To => phil
2009-06-02 17:58 skayser Note Added: 0006244
2009-06-02 18:33 bfr-murphy File Added: mutt-ldd.txt
2009-06-02 18:34 bfr-murphy Note Added: 0006245
2009-06-02 18:36 bfr-murphy Note Edited: 0006245
2009-06-02 20:22 phil Note Added: 0006247
2009-06-02 20:58 skayser Note Added: 0006248
2009-06-02 21:16 phil Note Added: 0006249
2009-09-22 20:36 skayser Note Added: 0006742
2009-09-22 20:36 skayser Assigned To phil => skayser
2009-09-22 20:36 skayser Status assigned => feedback
2009-09-23 19:43 bfr-murphy Note Added: 0006747
2009-09-23 19:54 skayser Note Added: 0006749
2009-09-23 19:54 skayser Status feedback => closed
2009-09-23 19:54 skayser Resolution open => fixed

Notes
(0006244)
skayser   
2009-06-02 17:58   
I have just had the same problem with one of my co-workers, but with a locale != C/POSIX. Underlying issue was not with mutt, but that he had the "evil" LD_LIBRARY_PATH set and thus mutt runtime-linked against a non-csw libiconv.

$ echo $LD_LIBRARY_PATH
/usr/sfw/lib:/opt/sfw/lib:/usr/lib:/usr/openwin/lib:/usr/local/kde/qt/lib:/usr/dt/lib:/usr/local/kde/lib:/usr/local/lib

$ ldd /opt/csw/bin/mutt
...
        libiconv.so.2 => /usr/local/lib/libiconv.so.2

Getting rid of $LD_LIBRARY_PATH solved the issue. bfr-murphy, if this is still an issue for you, can you please check whether you have $LD_LIBRARY_PATH set? Providing the output of "set" and "ldd /opt/csw/bin/mutt" might also help.
(0006245)
bfr-murphy   
2009-06-02 18:34   
(edited on: 2009-06-02 18:36)
I do not have $LD_LIBRARY_PATH set.

I have uploaded the output of 'ldd /opt/csw/bin/mutt'. The /opt/csw/bin/mutt binary is using the copy of libiconv in the /opt/csw/lib directory.

(0006247)
phil   
2009-06-02 20:22   
Could this actually be considered a bug in our libidn package?


Hmm.. sun has SUNWidn.. but it does not appear to have a libidn.so.
arg.

Still seems like the real issue is that libidn does not degrade gracefully.
If it cant find whatever magical translation files it needs, methinks it should default to just returning whatever string it received as-is ?
(0006248)
skayser   
2009-06-02 20:58   
From looking at the mutt 1.5.19 sources the part where it bails out seems to be mutt_socket.c:470

~/tmp/mutt-1.5.19$ ack -B2 '"Bad IDN \\".*\.'
mutt_socket.c
468- if (idna_to_ascii_lz (conn->account.host, &host_idna, 1) != IDNA_SUCCESS)
469- {
470: mutt_error (_("Bad IDN \"%s\"."), conn->account.host);
...

And using the following snippet i can re-create the problem.

$ cat idna-test.c
#include <stdio.h>
#include <errno.h>
#include <locale.h>
#include <idna.h>

void main(void)
{
    char *output;
    int rc;

    setlocale(LC_ALL,"");

    rc = idna_to_ascii_lz("foo", &output, 1);
    if (rc == IDNA_SUCCESS) {
        printf("Converted: %s\n", output);
    } else {
        printf("Conversion failed: %s\n", idna_strerror(rc));
    };
}

$ /opt/studio/SOS11/SUNWspro/bin/cc -o idna-test -I/opt/csw/include -L/opt/csw/lib -R /opt/csw/lib idna-test.c -lidn

$ LC_CTYPE=en_US.UTF-8 ./idna-test
Converted: foo
$ LC_CTYPE=C ./idna-test
Conversion failed: System iconv failed

Note the "System iconv failed". I didn't go further yet (nor am i near understanding the exact libidn workings), but there is a more recent libiconv version available upstream (1.13 vs. our 1.12). Phil, would you mind packaging that up for testing purposes?
(0006249)
phil   
2009-06-02 21:16   
odd.. i thought someone else had already updated it.
if you'd like to take over iconv please feel free.
(0006742)
skayser   
2009-09-22 20:36   
This has been lingering for a while and should be fixed with the updated libiconv 1.13.1,REV=2009.07.31 which has been released today.

bfr-murphy, could you please verify that it solves the problem for you.
(0006747)
bfr-murphy   
2009-09-23 19:43   
The new version of libiconv appeared at the package mirror today.

It looks like this fixes the problem i had with mutt and libiconv.

Thanks.
(0006749)
skayser   
2009-09-23 19:54   
Resolved with libiconv 1.13.1,REV=2009.07.31.

Thanks for reporting and feedback, bfr-murphy.