On Tue, Apr 05, 2016 at 07:44:25AM -0700, Kevin J. McCarthy wrote:
> On Tue, Apr 05, 2016 at 06:58:38AM -0700, Claus Assmann wrote:
> > So I get that "Error" for each alias at startup... and I haven't
> > found a way to turn it off (yet; e.g., idn_{de,en}code options
> > aren't available).
> 
> It looks like I blew it.  I'll put this at the top of my list to patch.
> Will probably have to get a fix out for this very soon.

I'm attaching a patch I believe fixes the problem.  I've tried to test
this in all three combinations of iconv and idna enabled/disabled (first
duplicating your problem without the patch).

Unfortunately, the patch require autotools: the Makefile.in needs to be
regenerated from Makefile.am.  If you feel comfortable with this, and
would like to test the patch, I would appreciate it.

I will commit this fix to stable in a couple days, and we will release a
stable release in a few weeks, to give time for more major issues to
shake out.

Thank you for reporting the problem.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
http://www.8t8.us/configs/gpg-key-transition-statement.txt
# HG changeset patch
# User Kevin McCarthy <[email protected]>
# Date 1459891896 25200
#      Tue Apr 05 14:31:36 2016 -0700
# Branch stable
# Node ID f7db9cefd3b0e10f0136ec8c07190a8a2f6ce697
# Parent  b983eb6c1a044c8cda5cbdc02a8e84acb946fb99
Fix IDNA functions for systems without iconv.

The IDNA changes for SMTPUTF8 support introduced a bug for systems
without iconv.  For those systems, the local<->intl functions would
return an error due to the charset conversion failing.

Change mutt_idna.c back to being conditionally compiled, but this time
based on HAVE_ICONV.  If there is no iconv, stub out the functions in
mutt_idna.h.

diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,17 +28,17 @@
        edit.c enter.c flags.c init.c filter.c from.c \
        getdomain.c group.c \
        handler.c hash.c hdrline.c headers.c help.c hook.c keymap.c \
        main.c mbox.c menu.c mh.c mx.c pager.c parse.c pattern.c \
        postpone.c query.c recvattach.c recvcmd.c \
        rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
        score.c send.c sendlib.c signal.c sort.c \
        status.c system.c thread.c charset.c history.c lib.c \
-       muttlib.c editmsg.c mbyte.c mutt_idna.c \
+       muttlib.c editmsg.c mbyte.c \
        url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
 
 nodist_mutt_SOURCES = $(BUILT_SOURCES)
 
 mutt_LDADD = $(MUTT_LIB_OBJECTS) $(LIBOBJS) $(LIBIMAP) $(MUTTLIBS) \
        $(INTLLIBS) $(LIBICONV)  $(GPGME_LIBS)
 
 mutt_DEPENDENCIES = $(MUTT_LIB_OBJECTS) $(LIBOBJS) $(LIBIMAPDEPS) \
@@ -48,17 +48,17 @@
        -DBINDIR=\"$(bindir)\" -DMUTTLOCALEDIR=\"$(datadir)/locale\" \
        -DHAVE_CONFIG_H=1
 
 AM_CPPFLAGS=-I. -I$(top_srcdir) $(IMAP_INCLUDES) $(GPGME_CFLAGS) -Iintl
 
 EXTRA_mutt_SOURCES = account.c bcache.c crypt-gpgme.c crypt-mod-pgp-classic.c \
        crypt-mod-pgp-gpgme.c crypt-mod-smime-classic.c \
        crypt-mod-smime-gpgme.c dotlock.c gnupgparse.c hcache.c md5.c \
-       mutt_sasl.c mutt_socket.c mutt_ssl.c mutt_ssl_gnutls.c \
+       mutt_idna.c mutt_sasl.c mutt_socket.c mutt_ssl.c mutt_ssl_gnutls.c \
        mutt_tunnel.c pgp.c pgpinvoke.c pgpkey.c pgplib.c pgpmicalg.c \
        pgppacket.c pop.c pop_auth.c pop_lib.c remailer.c resize.c sha1.c \
        smime.c smtp.c utf8.c wcwidth.c \
        bcache.h browser.h hcache.h mbyte.h mutt_idna.h remailer.h url.h
 
 EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO UPDATING \
        configure account.h \
        attach.h buffy.h charset.h copy.h crypthash.h dotlock.h functions.h 
gen_defs \
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1159,16 +1159,23 @@
   AC_CHECK_FUNCS(bind_textdomain_codeset)
   LIBS="$mutt_save_LIBS"
 fi
 
 fi # libiconv
 
 dnl -- IDN depends on iconv
 
+dnl mutt_idna.c will perform charset transformations (for smtputf8
+dnl support) as long as at least iconv is installed.  If there is no
+dnl iconv, then it doesn't need to be included in the build.
+if test "$am_cv_func_iconv" = yes; then
+  MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS mutt_idna.o"
+fi
+
 AC_ARG_WITH(idn, AS_HELP_STRING([--with-idn=@<:@PFX@:>@],[Use GNU libidn for 
internationalized domain names]),
                 [
                  if test "$with_idn" != "no" ; then
                        if test "$with_idn" != "yes" ; then
                           CPPFLAGS="$CPPFLAGS -I$with_idn/include"
                           LDFLAGS="$LDFLAGS -L$with_idn/lib"
                        fi
                  fi
diff --git a/mutt_idna.h b/mutt_idna.h
--- a/mutt_idna.h
+++ b/mutt_idna.h
@@ -40,18 +40,45 @@
 #  define idna_to_ascii_lz(a,b,c) 
idna_to_ascii_from_locale(a,b,(c)&1,((c)&2)?1:0)
 # endif
 # if (!defined(HAVE_IDNA_TO_UNICODE_8Z8Z) && 
defined(HAVE_IDNA_TO_UNICODE_UTF8_FROM_UTF8))
 #  define idna_to_unicode_8z8z(a,b,c) 
idna_to_unicode_utf8_from_utf8(a,b,(c)&1,((c)&2)?1:0)
 # endif
 #endif /* HAVE_LIBIDN */
 
 
+#ifdef HAVE_ICONV
 int mutt_addrlist_to_intl (ADDRESS *, char **);
 int mutt_addrlist_to_local (ADDRESS *);
 
 void mutt_env_to_local (ENVELOPE *);
 int mutt_env_to_intl (ENVELOPE *, char **, char **);
 
 const char *mutt_addr_for_display (ADDRESS *a);
+#else
+static inline int mutt_addrlist_to_intl (ADDRESS *addr, char **err)
+{
+  return 0;
+}
+
+static inline int mutt_addrlist_to_local (ADDRESS *addr)
+{
+  return 0;
+}
+
+static inline void mutt_env_to_local (ENVELOPE *env)
+{
+  return;
+}
+
+static inline int mutt_env_to_intl (ENVELOPE *env, char **tag, char **err)
+{
+  return 0;
+}
+
+static inline const char *mutt_addr_for_display (ADDRESS *a)
+{
+  return a->mailbox;
+}
+#endif /* HAVE_LIBICONV */
 
 
 #endif

Attachment: signature.asc
Description: PGP signature

Reply via email to