1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
From: Simon Chopin <simon.chopin@canonical.com>
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: $!";
|