GNU bug report logs - #63134
[PATCH] gnu: isync: Add patch to improve openssl-3 compatibility.

Previous Next

Package: guix-patches;

Reported by: Morgan.J.Smith <at> outlook.com

Date: Thu, 27 Apr 2023 21:26:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 63134 in the body.
You can then email your comments to 63134 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#63134; Package guix-patches. (Thu, 27 Apr 2023 21:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Morgan.J.Smith <at> outlook.com:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 27 Apr 2023 21:26:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Morgan.J.Smith <at> outlook.com
To: guix-patches <at> gnu.org
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Subject: [PATCH] gnu: isync: Add patch to improve openssl-3 compatibility.
Date: Thu, 27 Apr 2023 17:14:47 -0400
From: Morgan Smith <Morgan.J.Smith <at> outlook.com>

* gnu/packages/patches/isync-openssl3-fix.patch: Add patch to fix behavior
when using openssl-3.
* gnu/local.mk (isync): Register patch.
* gnu/packages/mail.scm (isync): Use patch.
---

With the core-updates merge, isync now uses openssl-3.  This will cause
problems for some (but not all) users.  This patch from upstream fixes that.


The error that happens when running "mbsync -a":
Socket error: secure read from imap.gmail.com (172.253.63.108:993): error:0A000126:SSL routines::unexpected eof while reading

The thread that elucidated the fix:
https://sourceforge.net/p/isync/mailman/isync-devel/thread/Y2jnr8hESp1PUW+6 <at> bulldog/

 gnu/local.mk                                  |  1 +
 gnu/packages/mail.scm                         |  5 +-
 gnu/packages/patches/isync-openssl3-fix.patch | 81 +++++++++++++++++++
 3 files changed, 86 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/isync-openssl3-fix.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index c0a5c721fc..6afb84b25c 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1367,6 +1367,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/irrlicht-use-system-libs.patch		\
   %D%/packages/patches/irrlicht-link-against-needed-libs.patch	\
   %D%/packages/patches/isl-0.11.1-aarch64-support.patch	\
+  %D%/packages/patches/isync-openssl3-fix.patch	\
   %D%/packages/patches/itk-snap-alt-glibc-compat.patch		\
   %D%/packages/patches/jami-disable-integration-tests.patch	\
   %D%/packages/patches/jami-libjami-headers-search.patch	\
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 82fa8bc711..e7ae1c693f 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -2275,7 +2275,10 @@ (define-public isync
        (uri (string-append "mirror://sourceforge/isync/isync/"
                            version "/isync-" version ".tar.gz"))
        (sha256 (base32
-                "1zq0wwvmqsl9y71546dr0aygzn9gjjfiw19hlcq87s929y4p6ckw"))))
+                "1zq0wwvmqsl9y71546dr0aygzn9gjjfiw19hlcq87s929y4p6ckw"))
+       (patches
+        ;; Likely to be included in next version
+        (search-patches "isync-openssl3-fix.patch"))))
     (build-system gnu-build-system)
     (native-inputs
      (list perl))
diff --git a/gnu/packages/patches/isync-openssl3-fix.patch b/gnu/packages/patches/isync-openssl3-fix.patch
new file mode 100644
index 0000000000..6a2363e972
--- /dev/null
+++ b/gnu/packages/patches/isync-openssl3-fix.patch
@@ -0,0 +1,81 @@
+Upstream status: Taken from master branch.  Likely included in versions > 1.4.4
+
+Fixes issues with OpenSSL3.  See related thread:
+https://sourceforge.net/p/isync/mailman/isync-devel/thread/Y2jnr8hESp1PUW+6 <at> bulldog/
+
+From b6c36624f04cd388873785c0631df3f2f9ac4bf0 Mon Sep 17 00:00:00 2001
+From: Oswald Buddenhagen <ossi <at> users.sf.net>
+Date: Mon, 6 Jun 2022 11:55:37 +0200
+Subject: [PATCH] work around "unexpected EOF" error messages at end of SSL
+ connections
+
+gmail apparently doesn't send a close notification (SSL_shutdown())
+before closing the TCP socket.
+---
+ src/drv_imap.c | 7 +++++--
+ src/socket.c   | 9 +++++++++
+ src/socket.h   | 1 +
+ 3 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/src/drv_imap.c b/src/drv_imap.c
+index fb8d165..6286045 100644
+--- a/src/drv_imap.c
++++ b/src/drv_imap.c
+@@ -1620,6 +1620,7 @@ imap_socket_read( void *aux )
+ 					error( "IMAP error: unexpected BYE response: %s\n", cmd );
+ 					/* We just wait for the server to close the connection now. */
+ 					ctx->expectEOF = 1;
++					socket_expect_eof( &ctx->conn );
+ 				} else {
+ 					/* We still need to wait for the LOGOUT's tagged OK. */
+ 				}
+@@ -1882,10 +1883,12 @@ static void
+ imap_cleanup_p2( imap_store_t *ctx,
+                  imap_cmd_t *cmd ATTR_UNUSED, int response )
+ {
+-	if (response == RESP_NO)
++	if (response == RESP_NO) {
+ 		imap_cancel_store( &ctx->gen );
+-	else if (response == RESP_OK)
++	} else if (response == RESP_OK) {
+ 		ctx->expectEOF = 1;
++		socket_expect_eof( &ctx->conn );
++	}
+ }
+ 
+ /******************* imap_open_store *******************/
+diff --git a/src/socket.c b/src/socket.c
+index ac3c847..892cece 100644
+--- a/src/socket.c
++++ b/src/socket.c
+@@ -810,6 +810,15 @@ socket_expect_activity( conn_t *conn, int expect )
+ 		conf_wakeup( &conn->fd_timeout, expect ? conn->conf->timeout : -1 );
+ }
+ 
++void
++socket_expect_eof( conn_t *sock )
++{
++#ifdef SSL_OP_IGNORE_UNEXPECTED_EOF  // implies HAVE_LIBSSL
++	if (sock->ssl)
++		SSL_set_options( sock->ssl, SSL_OP_IGNORE_UNEXPECTED_EOF );
++#endif
++}
++
+ int
+ socket_read( conn_t *conn, char *buf, uint len )
+ {
+diff --git a/src/socket.h b/src/socket.h
+index 5b1edd0..af679aa 100644
+--- a/src/socket.h
++++ b/src/socket.h
+@@ -142,6 +142,7 @@ void socket_start_tls(conn_t *conn, void (*cb)( int ok, void *aux ) );
+ void socket_start_deflate( conn_t *conn );
+ void socket_close( conn_t *sock );
+ void socket_expect_activity( conn_t *sock, int expect );
++void socket_expect_eof( conn_t *sock );
+ int socket_read( conn_t *sock, char *buf, uint len ); /* never waits */
+ char *socket_read_line( conn_t *sock ); /* don't free return value; never waits */
+ typedef enum { KeepOwn = 0, GiveOwn } ownership_t;
+-- 
+2.39.2
+
-- 
2.39.2





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 24 May 2023 13:04:02 GMT) Full text and rfc822 format available.

Notification sent to Morgan.J.Smith <at> outlook.com:
bug acknowledged by developer. (Wed, 24 May 2023 13:04:02 GMT) Full text and rfc822 format available.

Message #10 received at 63134-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Morgan.J.Smith <at> outlook.com
Cc: 63134-done <at> debbugs.gnu.org
Subject: Re: bug#63134: [PATCH] gnu: isync: Add patch to improve openssl-3
 compatibility.
Date: Wed, 24 May 2023 15:03:38 +0200
Hi,

Morgan.J.Smith <at> outlook.com skribis:

> From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
>
> * gnu/packages/patches/isync-openssl3-fix.patch: Add patch to fix behavior
> when using openssl-3.
> * gnu/local.mk (isync): Register patch.
> * gnu/packages/mail.scm (isync): Use patch.

Applied, thanks!  (I tweaked the commit message.)

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 22 Jun 2023 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 280 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.