Download raw body.
mail/isync: improve an error message
On Tue, Jan 09, 2024 at 02:48:11PM +0000, Edd Barrett wrote:
> Hi,
>
> On a couple of occasions now I've wasted time deciphering this error message
> from `mbsync`:
>
> ```
> IMAP error: selected SASL mechanism(s) not available;
> selected: XOAUTH2
> available: SCRAM-SHA-512 SCRAM-SHA-384 SCRAM-SHA-256 SCRAM-SHA-224 SCRAM-SHA-1 DIGEST-MD5 EXTERNAL OTP CRAM-MD5 NTLM LOGIN PLAIN ANONYMOUS
> ```
>
> In my case it's because I don't have the cyrus-sasl-xoauth2 package installed,
> but that's not very obvious for a user.
Does XOAUTH2 appear in the list of available mechanisms once you install
that package?
Either way, you can also hint at that package in DESCR or README in case
OAuth2 configuration is non-trivial.
> This patch improves the error message with a hint that I hope will save others
> (and my future self) some time.
>
> If we like this, I can try an upstream it.
I haven't set this up, but if this works for others, sure.
>
> OK?
>
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/mail/isync/Makefile,v
> diff -u -p -r1.57 Makefile
> --- Makefile 7 Nov 2023 14:19:36 -0000 1.57
> +++ Makefile 9 Jan 2024 14:20:33 -0000
> @@ -1,7 +1,7 @@
> COMMENT= synchronize IMAP4 and maildir mailboxes
>
> DISTNAME= isync-1.4.4
> -REVISION= 2
> +REVISION= 3
>
> CATEGORIES= mail
> SITES= ${SITE_SOURCEFORGE:=isync/}
> Index: patches/patch-src_drv_imap_c
> ===================================================================
> RCS file: /cvs/ports/mail/isync/patches/patch-src_drv_imap_c,v
> diff -u -p -r1.12 patch-src_drv_imap_c
> --- patches/patch-src_drv_imap_c 11 Mar 2022 19:34:38 -0000 1.12
> +++ patches/patch-src_drv_imap_c 9 Jan 2024 14:39:36 -0000
> @@ -1,4 +1,4 @@
> -Use pledge.
> +Use pledge and improve an error message.
>
> Index: src/drv_imap.c
> --- src/drv_imap.c.orig
> @@ -12,6 +12,15 @@ Index: src/drv_imap.c
> #ifdef HAVE_LIBSSL
> enum { SSL_None, SSL_STARTTLS, SSL_IMAPS };
> #endif
> +@@ -2477,7 +2479,7 @@ imap_open_store_authenticate2( imap_store_t *ctx )
> + saslavail = "(none)";
> + if (!auth_login) {
> + error( "IMAP error: selected SASL mechanism(s) not available;\n"
> +- " selected:%s\n available: %s\n", saslmechs, saslavail );
> ++ " selected:'%s'\n available: %s\nYou may need to install a cyrus-sasl plugin\n", saslmechs, saslavail );
At first I thought you added one of those selected/available lines, but
since mbsync already has that, how about leaving that as-is and instead
providing enough guidance via our package metadata?
"You may need to install a cyrus-sasl plugin" still leaves me wondering,
a) whether this is now the case for be and b) which package I actually need.
> + goto skipnote;
> + }
> + info( "NOT using available SASL mechanism(s): %s\n", saslavail );
> @@ -3768,6 +3770,8 @@ imap_parse_store( conffile_t *cfg, store_conf_t **stor
> #endif
> 143;
>
> --
> Best Regards
> Edd Barrett
>
> https://www.theunixzoo.co.uk
>
mail/isync: improve an error message