* [PATCH 0/3] IMAP fixes for older systems
@ 2020-06-14 0:25 Eric Wong
2020-06-14 0:25 ` [PATCH 1/3] testcommon: allow OR-ing module dependencies Eric Wong
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Wong @ 2020-06-14 0:25 UTC (permalink / raw)
To: meta
Eric Wong (3):
testcommon: allow OR-ing module dependencies
inboxidle: support Linux::Inotify2 1.x
t/imapd*.t: support older Mail::IMAPClient
lib/PublicInbox/InboxIdle.pm | 5 ++++-
lib/PublicInbox/TestCommon.pm | 11 ++++++++++-
t/imap.t | 6 +++---
t/imapd-tls.t | 7 +++++--
t/imapd.t | 9 +++++----
xt/imapd-mbsync-oimap.t | 1 +
xt/imapd-validate.t | 2 +-
xt/mem-imapd-tls.t | 2 +-
8 files changed, 30 insertions(+), 13 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] testcommon: allow OR-ing module dependencies
2020-06-14 0:25 [PATCH 0/3] IMAP fixes for older systems Eric Wong
@ 2020-06-14 0:25 ` Eric Wong
2020-06-14 0:25 ` [PATCH 2/3] inboxidle: support Linux::Inotify2 1.x Eric Wong
2020-06-14 0:25 ` [PATCH 3/3] t/imapd*.t: support older Mail::IMAPClient Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2020-06-14 0:25 UTC (permalink / raw)
To: meta
IMAP requires either the Email::Address::XS or Mail::Address
package (part of perl-MailTools RPM or libmailtools-perl deb);
and Email::Address::XS is not officially packaged for some older
distros, most notably CentOS 7.x.
---
lib/PublicInbox/TestCommon.pm | 11 ++++++++++-
t/imap.t | 6 +++---
t/imapd-tls.t | 3 ++-
t/imapd.t | 3 ++-
xt/imapd-mbsync-oimap.t | 1 +
xt/imapd-validate.t | 2 +-
xt/mem-imapd-tls.t | 2 +-
7 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index 5e7dc8b0..a97125e5 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -72,7 +72,7 @@ sub require_mods {
my @mods = @_;
my $maybe = pop @mods if $mods[-1] =~ /\A[0-9]+\z/;
my @need;
- for my $mod (@mods) {
+ while (my $mod = shift(@mods)) {
if ($mod eq 'Search::Xapian') {
if (eval { require PublicInbox::Search } &&
PublicInbox::Search::load_xapian()) {
@@ -83,6 +83,15 @@ sub require_mods {
PublicInbox::SearchIdx::load_xapian_writable()){
next;
}
+ } elsif (index($mod, '||') >= 0) { # "Foo||Bar"
+ my $ok;
+ for my $m (split(/\Q||\E/, $mod)) {
+ eval "require $m";
+ next if $@;
+ $ok = $m;
+ last;
+ }
+ next if $ok;
} else {
eval "require $mod";
}
diff --git a/t/imap.t b/t/imap.t
index 0700f578..83adf553 100644
--- a/t/imap.t
+++ b/t/imap.t
@@ -4,10 +4,10 @@
# unit tests (no network) for IMAP, see t/imapd.t for end-to-end tests
use strict;
use Test::More;
-use PublicInbox::IMAP;
-use PublicInbox::IMAPD;
use PublicInbox::TestCommon;
-require_mods(qw(DBD::SQLite));
+require_mods(qw(DBD::SQLite Email::Address::XS||Mail::Address));
+require_ok 'PublicInbox::IMAP';
+require_ok 'PublicInbox::IMAPD';
require_git 2.6;
use POSIX qw(strftime);
diff --git a/t/imapd-tls.t b/t/imapd-tls.t
index 5352d100..f81959a5 100644
--- a/t/imapd-tls.t
+++ b/t/imapd-tls.t
@@ -6,7 +6,8 @@ use Test::More;
use Socket qw(IPPROTO_TCP SOL_SOCKET);
use PublicInbox::TestCommon;
# IO::Poll is part of the standard library, but distros may split it off...
-require_mods(qw(DBD::SQLite IO::Socket::SSL Mail::IMAPClient IO::Poll));
+require_mods(qw(DBD::SQLite IO::Socket::SSL Mail::IMAPClient IO::Poll
+ Email::Address::XS||Mail::Address));
my $imap_client = 'Mail::IMAPClient';
$imap_client->can('starttls') or
plan skip_all => 'Mail::IMAPClient does not support TLS';
diff --git a/t/imapd.t b/t/imapd.t
index f5ca8b7e..0f48e905 100644
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -8,7 +8,8 @@ use Time::HiRes ();
use PublicInbox::TestCommon;
use PublicInbox::Config;
use PublicInbox::Spawn qw(which);
-require_mods(qw(DBD::SQLite Mail::IMAPClient Mail::IMAPClient::BodyStructure));
+require_mods(qw(DBD::SQLite Mail::IMAPClient Mail::IMAPClient::BodyStructure
+ Email::Address::XS||Mail::Address));
my $imap_client = 'Mail::IMAPClient';
my $can_compress = $imap_client->can('compress');
if ($can_compress) { # hope this gets fixed upstream, soon
diff --git a/xt/imapd-mbsync-oimap.t b/xt/imapd-mbsync-oimap.t
index c097a026..edf111fd 100644
--- a/xt/imapd-mbsync-oimap.t
+++ b/xt/imapd-mbsync-oimap.t
@@ -7,6 +7,7 @@ use Test::More;
use File::Path qw(mkpath);
use PublicInbox::TestCommon;
use PublicInbox::Spawn qw(which spawn);
+require_mods(qw(DBD::SQLite Email::Address::XS||Mail::Address));
my $inboxdir = $ENV{GIANT_INBOX_DIR};
(defined($inboxdir) && -d $inboxdir) or
plan skip_all => "GIANT_INBOX_DIR not defined for $0";
diff --git a/xt/imapd-validate.t b/xt/imapd-validate.t
index 9a56c2d0..3e445156 100644
--- a/xt/imapd-validate.t
+++ b/xt/imapd-validate.t
@@ -15,7 +15,7 @@ my $BATCH = $ENV{TEST_BATCH} // 100;
my $REPEAT = $ENV{TEST_REPEAT} // 1;
diag "TEST_BATCH=$BATCH TEST_REPEAT=$REPEAT";
-require_mods(qw(Mail::IMAPClient));
+require_mods(qw(Mail::IMAPClient Email::Address::XS||Mail::Address));
my $imap_client = 'Mail::IMAPClient';
my $can_compress = $imap_client->can('compress');
if ($can_compress) { # hope this gets fixed upstream, soon
diff --git a/xt/mem-imapd-tls.t b/xt/mem-imapd-tls.t
index accf7564..648a0ad3 100644
--- a/xt/mem-imapd-tls.t
+++ b/xt/mem-imapd-tls.t
@@ -9,7 +9,7 @@ use Socket qw(SOCK_STREAM IPPROTO_TCP SOL_SOCKET);
use PublicInbox::TestCommon;
use PublicInbox::Syscall qw(:epoll);
use PublicInbox::DS;
-require_mods(qw(DBD::SQLite));
+require_mods(qw(DBD::SQLite Email::Address::XS||Mail::Address));
my $inboxdir = $ENV{GIANT_INBOX_DIR};
my $TEST_TLS;
SKIP: {
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] inboxidle: support Linux::Inotify2 1.x
2020-06-14 0:25 [PATCH 0/3] IMAP fixes for older systems Eric Wong
2020-06-14 0:25 ` [PATCH 1/3] testcommon: allow OR-ing module dependencies Eric Wong
@ 2020-06-14 0:25 ` Eric Wong
2020-06-14 0:25 ` [PATCH 3/3] t/imapd*.t: support older Mail::IMAPClient Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2020-06-14 0:25 UTC (permalink / raw)
To: meta
Linux::Inotify2 1.x lacked ->on_overflow and ->broadcast
methods. Just don't use them for now. We may eventually
provide a pure Perl alternative which doesn't require closures,
XS, or the common::sense dependency.
Overflowing the inotify queue seems difficult to trigger at
the moment: /proc/sys/fs/inotify/max_queued_events defaults
to 16384 on a my CentOS 7.x VM with 2GB RAM.
---
lib/PublicInbox/InboxIdle.pm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/InboxIdle.pm b/lib/PublicInbox/InboxIdle.pm
index c19b8d18..d60d4f23 100644
--- a/lib/PublicInbox/InboxIdle.pm
+++ b/lib/PublicInbox/InboxIdle.pm
@@ -58,7 +58,10 @@ sub new {
my $sock = gensym;
tie *$sock, 'PublicInbox::In2Tie', $inot;
$inot->blocking(0);
- $inot->on_overflow(undef); # broadcasts everything on overflow
+ if ($inot->can('on_overflow')) {
+ # broadcasts everything on overflow
+ $inot->on_overflow(undef);
+ }
$self->SUPER::new($sock, EPOLLIN | EPOLLET);
} else {
require PublicInbox::FakeInotify;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] t/imapd*.t: support older Mail::IMAPClient
2020-06-14 0:25 [PATCH 0/3] IMAP fixes for older systems Eric Wong
2020-06-14 0:25 ` [PATCH 1/3] testcommon: allow OR-ing module dependencies Eric Wong
2020-06-14 0:25 ` [PATCH 2/3] inboxidle: support Linux::Inotify2 1.x Eric Wong
@ 2020-06-14 0:25 ` Eric Wong
2 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2020-06-14 0:25 UTC (permalink / raw)
To: meta
->has_capability on Mail::IMAPClient 3.37 (tested on CentOS 7.x)
only returned boolean values, and not the value of the capability.
---
t/imapd-tls.t | 4 +++-
t/imapd.t | 6 +++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/t/imapd-tls.t b/t/imapd-tls.t
index f81959a5..6b3e1797 100644
--- a/t/imapd-tls.t
+++ b/t/imapd-tls.t
@@ -114,7 +114,9 @@ for my $args (
ok(!(scalar $c->has_capability('STARTTLS')),
'starttls not advertised with IMAPS');
ok(!$c->starttls, "starttls fails");
- ok($c->has_capability('COMPRESS'), 'compress advertised');
+ ok($c->has_capability('COMPRESS') ||
+ $c->has_capability('COMPRESS=DEFLATE'),
+ 'compress advertised');
ok($c->compress, 'compression enabled with IMAPS');
ok(!$c->starttls, 'starttls still fails');
ok($c->noop, 'noop succeeds');
diff --git a/t/imapd.t b/t/imapd.t
index 0f48e905..aba3ed82 100644
--- a/t/imapd.t
+++ b/t/imapd.t
@@ -217,8 +217,8 @@ for my $r ('1:*', '1') {
is(lc($bs->bodytype), 'text', '->bodytype');
is(lc($bs->bodyenc), '8bit', '->bodyenc');
}
-
-is_deeply([$mic->has_capability('COMPRESS')], ['DEFLATE'], 'deflate cap');
+ok($mic->has_capability('COMPRESS') ||
+ $mic->has_capability('COMPRESS=DEFLATE'), 'deflate cap');
SKIP: {
skip 'Mail::IMAPClient too old for ->compress', 2 if !$can_compress;
my $c = $imap_client->new(%mic_opt);
@@ -243,7 +243,7 @@ $pi_config->each_inbox(sub {
my $mb = "$ng.$first_range";
my $uidnext = $mic->uidnext($mb); # we'll fetch BODYSTRUCTURE on this
ok($uidnext, 'got uidnext for later fetch');
- is_deeply([$mic->has_capability('IDLE')], ['IDLE'], "IDLE capa $name");
+ ok($mic->has_capability('IDLE'), "IDLE capa $name");
ok(!$mic->idle, "IDLE fails w/o SELECT/EXAMINE $name");
ok($mic->examine($mb), "EXAMINE $ng succeeds");
ok(my $idle_tag = $mic->idle, "IDLE succeeds on $ng");
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-06-14 0:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-14 0:25 [PATCH 0/3] IMAP fixes for older systems Eric Wong
2020-06-14 0:25 ` [PATCH 1/3] testcommon: allow OR-ing module dependencies Eric Wong
2020-06-14 0:25 ` [PATCH 2/3] inboxidle: support Linux::Inotify2 1.x Eric Wong
2020-06-14 0:25 ` [PATCH 3/3] t/imapd*.t: support older Mail::IMAPClient Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).