Subject: Re: mutt-1.4.2 package broken (on alpha)?
To: None <current-users@NetBSD.org>
From: Dave Huang <khym@azeotrope.org>
List: current-users
Date: 02/18/2004 16:30:47
Manuel Bouyer wrote:

>>The system is running -current with userland from Jan 21 and kernel from 
>>Jan 24; perhaps I should try updating both (libc, in particular), but it 
>>doesn't look like wcrtomb() has had any changes in a while.
>>
>
>I'm running 1.6.x on this box, maybe that's the key.
>
Perhaps so... I think -current has many changes in the wide character 
support. I recompiled mutt with -g, and now get:

pid 2443 (mutt): unaligned access: va=0x1ffffeaa4 pc=0x160414670 
ra=0x120021d28 sp=0x1ffffe9f0 op=ldq
pid 2443 (mutt): unaligned access: va=0x1ffffeaa4 pc=0x1604146b0 
ra=0x120021d28 sp=0x1ffffe9f0 op=ldq
pid 2443 (mutt): unaligned access: va=0x200fba1800000c79 pc=0x1604146b8 
ra=0x120021d28 sp=0x1ffffe9f0 op=ldq

Program received signal SIGSEGV, Segmentation fault.
0x00000001604146bc in wcrtomb () from /usr/lib/libc.so.12
(gdb) where
#0  0x00000001604146bc in wcrtomb () from /usr/lib/libc.so.12
#1  0x0000000120021d28 in mutt_format_string (
    dest=0x1200f7798 "/var/mail/khym: No such file or directory (errno = 
2)",
    destlen=255, min_width=0, max_width=78, right_justify=0,
    m_pad_char=0 '\0',
    s=0x1200f7798 "/var/mail/khym: No such file or directory (errno = 2)",
    n=256, arboreal=0) at curs_lib.c:565
#2  0x0000000120020a70 in mutt_curses_error (
    fmt=0x1200cfa6c "%s: %s (errno = %d)") at curs_lib.c:255
#3  0x0000000120020fd8 in mutt_perror (s=0x1ffffec20 "/var/mail/khym")
    at curs_lib.c:326
#4  0x000000012005bce4 in mx_open_mailbox (path=0x1ffffec20 
"/var/mail/khym",
    flags=0, pctx=0x0) at mx.c:657
#5  0x000000012004d550 in main (argc=1, argv=0x1fffff498) at main.c:838
(gdb) up
#1  0x0000000120021d28 in mutt_format_string (
    dest=0x1200f7798 "/var/mail/khym: No such file or directory (errno = 
2)",
    destlen=255, min_width=0, max_width=78, right_justify=0,
    m_pad_char=0 '\0',
    s=0x1200f7798 "/var/mail/khym: No such file or directory (errno = 2)",
    n=256, arboreal=0) at curs_lib.c:565
565           if (w > max_width || (k2 = wcrtomb (scratch, wc, 
&mbstate2)) > destlen)

I set machdep.unaligned_sigbus=1, and the unaligned access happens 
within wcrtomb() also. However, a test program that calls 
setlocale(LC_ALL, ""), then wcrtomb() works fine. I guess I'll just try 
upgrading my system to the latest -current first :)

And my Subject line is misleading... I meant to say that mutt 1.4.2 from 
pkgsrc is broken for me, not that the package itself was broken.