From eebcaf28c6472eb91f18945ce780cba16c2a091e Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sat, 4 May 2024 14:35:02 +0200 Subject: Apply patch from Simon Chopin to fix struct flock & timeval packing on armhf. Closes: #1067763 Closes: LP: #2059120 --- ...struct-flock-and-timeval-packing-on-armhf.patch | 61 ++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 62 insertions(+) create mode 100644 debian/patches/Fix-struct-flock-and-timeval-packing-on-armhf.patch (limited to 'debian') diff --git a/debian/patches/Fix-struct-flock-and-timeval-packing-on-armhf.patch b/debian/patches/Fix-struct-flock-and-timeval-packing-on-armhf.patch new file mode 100644 index 0000000..460672f --- /dev/null +++ b/debian/patches/Fix-struct-flock-and-timeval-packing-on-armhf.patch @@ -0,0 +1,61 @@ +From: Simon Chopin +Date: Tue, 26 Mar 2024 13:19:53 +0100 +Subject: Fix struct flock and timeval packing on armhf + +armhf uses a 64-bit off_t, and t64-enabled armhf 64-bit time_t. + +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/interimap/+bug/2059120 +Bug-Debian: https://bugs.debian.org/1067763 +--- + lib/Net/IMAP/InterIMAP.pm | 6 +++++- + pullimap | 6 +++++- + 2 files changed, 10 insertions(+), 2 deletions(-) + +diff --git a/lib/Net/IMAP/InterIMAP.pm b/lib/Net/IMAP/InterIMAP.pm +index 55a18a0..7824988 100644 +--- a/lib/Net/IMAP/InterIMAP.pm ++++ b/lib/Net/IMAP/InterIMAP.pm +@@ -23,6 +23,7 @@ use strict; + + use Compress::Raw::Zlib qw/Z_OK Z_STREAM_END Z_FULL_FLUSH Z_SYNC_FLUSH MAX_WBITS/; + use Config::Tiny (); ++use Config; + use Errno qw/EEXIST EINTR/; + use Net::SSLeay 1.86_06 (); + use List::Util qw/all first/; +@@ -1492,7 +1493,10 @@ sub _tcp_connect($$$) { + # timeout connect/read/write/... after 30s + # XXX we need to pack the struct timeval manually: not portable! + # https://stackoverflow.com/questions/8284243/how-do-i-set-so-rcvtimeo-on-a-socket-in-perl +- my $timeout = pack('l!l!', 30, 0); ++ # On Ubuntu, armhf is the only arch where time_t != long ++ my $is_arm = $Config{archname} =~ /^arm-/; ++ my $tpl = $is_arm ? 'qq' : 'l!l!'; ++ my $timeout = pack($tpl, 30, 0); + setsockopt($s, Socket::SOL_SOCKET, Socket::SO_RCVTIMEO, $timeout) + or $self->fail("setsockopt SO_RCVTIMEO: $!"); + setsockopt($s, Socket::SOL_SOCKET, Socket::SO_SNDTIMEO, $timeout) +diff --git a/pullimap b/pullimap +index 8be78da..1964c63 100755 +--- a/pullimap ++++ b/pullimap +@@ -31,6 +31,8 @@ use Getopt::Long qw/:config posix_default no_ignore_case gnu_getopt auto_version + use List::Util 'first'; + use Socket qw/PF_INET PF_INET6 SOCK_STREAM IPPROTO_TCP/; + ++use Config; ++ + use lib "./lib"; + use Net::IMAP::InterIMAP 0.5.7 qw/xdg_basedir read_config compact_set/; + +@@ -88,7 +90,9 @@ do { + + sysopen($STATE, $statefile, $mode, 0600) or die "Can't open $statefile: $!"; + # XXX we need to pack the struct flock manually: not portable! +- my $struct_flock = pack('s!s!l!l!i!', F_WRLCK, SEEK_SET, 0, 0, 0); ++ my $is_arm = $Config{archname} =~ /^arm-/; ++ my $tpl = $is_arm ? 's!s!qqi!' : 's!s!l!l!i!'; ++ my $struct_flock = pack($tpl, F_WRLCK, SEEK_SET, 0, 0, 0); + fcntl($STATE, F_SETLK, $struct_flock) or die "Can't lock $statefile: $!"; + my $flags = fcntl($STATE, F_GETFD, 0) or die "fcntl F_GETFD: $!"; + fcntl($STATE, F_SETFD, $flags | FD_CLOEXEC) or die "fcntl F_SETFD: $!"; diff --git a/debian/patches/series b/debian/patches/series index 35ce054..0df587c 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ Mention-the-Debian-BTS-in-the-manpages.patch Skip-randomized-tests.patch Generate-X.509-version-3-CA-in-testsuite.patch +Fix-struct-flock-and-timeval-packing-on-armhf.patch -- cgit v1.2.3