From 60e3cac577c73056221a99bcaeded29a0bde2264 Mon Sep 17 00:00:00 2001 From: Yixun Lan Date: Fri, 26 Sep 2025 22:08:00 +0000 Subject: [PATCH] mail-mta/msmtp: Fix tests failure with USE=-nls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix header encoding when building with --disable-nls. Closes: https://bugs.gentoo.org/963426 Link: https://github.com/marlam/msmtp/issues/203 Thanks-to: Holger Hoffstätte Signed-off-by: Yixun Lan --- .../files/msmtp-1.8.31-fix-disable-nls.patch | 30 +++++++++++++++++++ ...p-1.8.31.ebuild => msmtp-1.8.31-r1.ebuild} | 2 ++ 2 files changed, 32 insertions(+) create mode 100644 mail-mta/msmtp/files/msmtp-1.8.31-fix-disable-nls.patch rename mail-mta/msmtp/{msmtp-1.8.31.ebuild => msmtp-1.8.31-r1.ebuild} (98%) diff --git a/mail-mta/msmtp/files/msmtp-1.8.31-fix-disable-nls.patch b/mail-mta/msmtp/files/msmtp-1.8.31-fix-disable-nls.patch new file mode 100644 index 0000000000000..c52c42af9d0d6 --- /dev/null +++ b/mail-mta/msmtp/files/msmtp-1.8.31-fix-disable-nls.patch @@ -0,0 +1,30 @@ +Subject: [PATCH] Fix header encoding when building with --disable-nls. + +With disabled NLS, msmtp now assumes that UTF-8 is the current codeset, +which is a better guess than ASCII, which is what nl_langinfo() returns. + +This fixes github issue #203. +--- +URL: https://github.com/marlam/msmtp/commit/c6baa5b39e811ea4459a35ae0de88163f65bf8a2 +--- + src/tools.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/tools.c b/src/tools.c +index b65b4c5..9d78fc8 100644 +--- a/src/tools.c ++++ b/src/tools.c +@@ -1012,7 +1012,13 @@ char *encode_for_header(const char *s) + size_t b64_s_len = BASE64_LENGTH(s_len); + char* encoding = + #ifdef HAVE_LANGINFO_H ++ /* With disabled NLS, nl_langinfo() always seems to return ++ * ANSI_X3.4-1968 (i.e. ASCII). We want to assume UTF-8 instead. */ ++# ifdef ENABLE_NLS + nl_langinfo(CODESET); ++# else ++ "UTF-8"; ++# endif + #else + # ifdef W32_NATIVE + w32_langinfo_codeset(); diff --git a/mail-mta/msmtp/msmtp-1.8.31.ebuild b/mail-mta/msmtp/msmtp-1.8.31-r1.ebuild similarity index 98% rename from mail-mta/msmtp/msmtp-1.8.31.ebuild rename to mail-mta/msmtp/msmtp-1.8.31-r1.ebuild index 6aac73aaba8e1..396e1785fbdf6 100644 --- a/mail-mta/msmtp/msmtp-1.8.31.ebuild +++ b/mail-mta/msmtp/msmtp-1.8.31-r1.ebuild @@ -58,6 +58,8 @@ BDEPEND=" DOCS="AUTHORS ChangeLog NEWS README THANKS doc/msmtprc*" +PATCHES=( "${FILESDIR}/${P}-fix-disable-nls.patch" ) + src_prepare() { # Use default Gentoo location for mail aliases sed 's:/etc/aliases:/etc/mail/aliases:' \