* [PATCH 0/5] Dragonfly BSD support
@ 2023-10-06 9:45 Eric Wong
2023-10-06 9:46 ` [PATCH 1/5] kqnotify: drop EV_CLEAR (edge triggering) Eric Wong
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Eric Wong @ 2023-10-06 9:45 UTC (permalink / raw)
To: meta
Got one tmpfs + EVFILT_VNODE bug fixed in Dragonfly in the
process. Dealing with hdestroy implementation differences
is really making me consider khash...
Also considering using sysdefs-list output via $Config{cc}
to support sendmsg/recvmsg without needing Inline::C. `cc'
seems pretty standard across all *BSDs.
Eric Wong (5):
kqnotify: drop EV_CLEAR (edge triggering)
xap_helper.h: strdup keys for DragonFlyBSD hdestroy(3)
devel/sysdefs-list: show more info regardless of OS
t/dir_idle: dump event list on failure
finalize DragonFlyBSD support
devel/sysdefs-list | 45 +++++++++++++++++------------------
install/os.perl | 7 +++---
lib/PublicInbox/Daemon.pm | 4 ++--
lib/PublicInbox/IPC.pm | 1 +
lib/PublicInbox/KQNotify.pm | 2 +-
lib/PublicInbox/MboxLock.pm | 10 +++++---
lib/PublicInbox/POP3D.pm | 4 ++--
lib/PublicInbox/TestCommon.pm | 19 +++++++++++++--
lib/PublicInbox/xap_helper.h | 13 ++++++++--
t/dir_idle.t | 8 ++++---
t/ds-kqxs.t | 5 ++--
t/kqnotify.t | 28 +++++++++++++++++++++-
t/pop3d-limit.t | 4 +---
t/pop3d.t | 6 ++---
t/search.t | 2 +-
xt/pop3d-mpop.t | 5 ++--
16 files changed, 108 insertions(+), 55 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/5] kqnotify: drop EV_CLEAR (edge triggering)
2023-10-06 9:45 [PATCH 0/5] Dragonfly BSD support Eric Wong
@ 2023-10-06 9:46 ` Eric Wong
2023-10-06 9:46 ` [PATCH 2/5] xap_helper.h: strdup keys for DragonFlyBSD hdestroy(3) Eric Wong
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2023-10-06 9:46 UTC (permalink / raw)
To: meta
I'm not entirely certain how it works with the way we use
kevent. I do know IO::KQueue has hard-coded kevent retrievals
to 1000 events so it's conceivable we'd end up missing wakeups
as we don't loop or requeue in callers. So just rely on the
*BSD kernel to provided requeue behavior for us by using
level-triggering.
In any case, this seems to workaround t/dir_idle.t failures
on Dragonfly due to a tmpfs bug in all versions up to v6.4.
---
lib/PublicInbox/KQNotify.pm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/PublicInbox/KQNotify.pm b/lib/PublicInbox/KQNotify.pm
index 2efa887d..1689f4cc 100644
--- a/lib/PublicInbox/KQNotify.pm
+++ b/lib/PublicInbox/KQNotify.pm
@@ -26,7 +26,7 @@ sub watch {
my $ident = fileno($w->[2]) // die "BUG: bad fileno $w->[2]: $!";
$self->{dskq}->{kq}->EV_SET($ident, # ident (fd)
EVFILT_VNODE, # filter
- EV_ADD | EV_CLEAR, # flags
+ EV_ADD, # flags
$mask, # fflags
0, $dir_delete); # data, udata
$self->{watch}->{$ident} = $w;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] xap_helper.h: strdup keys for DragonFlyBSD hdestroy(3)
2023-10-06 9:45 [PATCH 0/5] Dragonfly BSD support Eric Wong
2023-10-06 9:46 ` [PATCH 1/5] kqnotify: drop EV_CLEAR (edge triggering) Eric Wong
@ 2023-10-06 9:46 ` Eric Wong
2023-10-06 9:46 ` [PATCH 3/5] devel/sysdefs-list: show more info regardless of OS Eric Wong
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2023-10-06 9:46 UTC (permalink / raw)
To: meta
DragonFlyBSD matches OpenBSD behavior in freeing every single key on
hdestroy(3). I suppose hdestroy(3) is neglected enough these days that
nobody cares and we'll likely introduce a small C hash table such as
khash (also used within git).
---
lib/PublicInbox/xap_helper.h | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h
index a78a3f76..3fa615a5 100644
--- a/lib/PublicInbox/xap_helper.h
+++ b/lib/PublicInbox/xap_helper.h
@@ -491,11 +491,20 @@ static enum exc_iter dump_roots_iter(struct req *req,
static char *hsearch_enter_key(char *s)
{
-#if defined(__OpenBSD__) /* hdestroy frees each key */
+#if defined(__OpenBSD__) || defined(__DragonFly__)
+ // hdestroy frees each key on some platforms,
+ // so give it something to free:
char *ret = strdup(s);
if (!ret) perror("strdup");
return ret;
-#endif // glibc, musl, FreeBSD, NetBSD do not free keys
+// AFAIK there's no way to detect musl, assume non-glibc Linux is musl:
+#elif defined(__GLIBC__) || defined(__linux__) || \
+ defined(__FreeBSD__) || defined(__NetBSD__)
+ // do nothing on these platforms
+#else
+#warning untested platform detected, unsure if hdestroy(3) frees keys
+#warning contact us at meta@public-inbox.org if you get segfaults
+#endif
return s;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] devel/sysdefs-list: show more info regardless of OS
2023-10-06 9:45 [PATCH 0/5] Dragonfly BSD support Eric Wong
2023-10-06 9:46 ` [PATCH 1/5] kqnotify: drop EV_CLEAR (edge triggering) Eric Wong
2023-10-06 9:46 ` [PATCH 2/5] xap_helper.h: strdup keys for DragonFlyBSD hdestroy(3) Eric Wong
@ 2023-10-06 9:46 ` Eric Wong
2023-10-06 9:46 ` [PATCH 4/5] t/dir_idle: dump event list on failure Eric Wong
2023-10-06 9:46 ` [PATCH 5/5] finalize DragonFlyBSD support Eric Wong
4 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2023-10-06 9:46 UTC (permalink / raw)
To: meta
We'll show SO_ACCEPTFILTER since it's supported on three
of the BSDs we support.
---
devel/sysdefs-list | 45 ++++++++++++++++++++++-----------------------
1 file changed, 22 insertions(+), 23 deletions(-)
diff --git a/devel/sysdefs-list b/devel/sysdefs-list
index edac253b..d0166461 100755
--- a/devel/sysdefs-list
+++ b/devel/sysdefs-list
@@ -37,13 +37,13 @@ __DATA__
#include <assert.h>
#include <signal.h>
#include <stddef.h>
+#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/ioctl.h>
#ifdef __linux__
# include <linux/fs.h>
# include <sys/epoll.h>
# include <sys/inotify.h>
-# include <sys/socket.h> // we don't care about this on *BSD
# include <sys/vfs.h>
#endif
#include <sys/types.h>
@@ -93,8 +93,6 @@ int main(void)
D(SYS_inotify_rm_watch);
D(SYS_prctl);
D(SYS_fstatfs);
- D(SYS_sendmsg);
- D(SYS_recvmsg);
MAYBE X(FS_IOC_GETFLAGS);
MAYBE X(FS_IOC_SETFLAGS);
@@ -114,36 +112,21 @@ int main(void)
PR_OFF(name);
STRUCT_END;
- /*
- * msghdr and cmsghdr are portable, but we only care about its layout
- * on OSes like Linux with stable syscall numbers
- */
- STRUCT_BEGIN(struct msghdr);
- PR_PTR(msg_name);
- PR_NUM(msg_namelen);
- PR_PTR(msg_iov);
- PR_NUM(msg_iovlen);
- PR_PTR(msg_control);
- PR_NUM(msg_controllen);
- PR_NUM(msg_flags);
- STRUCT_END;
-
- STRUCT_BEGIN(struct cmsghdr);
- PR_NUM(cmsg_len);
- PR_NUM(cmsg_level);
- PR_NUM(cmsg_type);
- STRUCT_END;
-
STRUCT_BEGIN(struct statfs);
PR_NUM(f_type);
STRUCT_END;
#endif /* Linux, any other OSes with stable syscalls? */
+
D(SIGWINCH);
+ MAYBE D(SO_ACCEPTFILTER);
MAYBE D(_SC_NPROCESSORS_ONLN);
MAYBE D(_SC_AVPHYS_PAGES);
MAYBE D(_SC_PAGE_SIZE);
MAYBE D(_SC_PAGESIZE);
+ D(SYS_sendmsg);
+ D(SYS_recvmsg);
+
STRUCT_BEGIN(struct flock);
PR_NUM(l_start);
PR_NUM(l_len);
@@ -152,5 +135,21 @@ int main(void)
PR_NUM(l_whence);
STRUCT_END;
+ STRUCT_BEGIN(struct msghdr);
+ PR_PTR(msg_name);
+ PR_NUM(msg_namelen);
+ PR_PTR(msg_iov);
+ PR_NUM(msg_iovlen);
+ PR_PTR(msg_control);
+ PR_NUM(msg_controllen);
+ PR_NUM(msg_flags);
+ STRUCT_END;
+
+ STRUCT_BEGIN(struct cmsghdr);
+ PR_NUM(cmsg_len);
+ PR_NUM(cmsg_level);
+ PR_NUM(cmsg_type);
+ STRUCT_END;
+
return 0;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] t/dir_idle: dump event list on failure
2023-10-06 9:45 [PATCH 0/5] Dragonfly BSD support Eric Wong
` (2 preceding siblings ...)
2023-10-06 9:46 ` [PATCH 3/5] devel/sysdefs-list: show more info regardless of OS Eric Wong
@ 2023-10-06 9:46 ` Eric Wong
2023-10-06 9:46 ` [PATCH 5/5] finalize DragonFlyBSD support Eric Wong
4 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2023-10-06 9:46 UTC (permalink / raw)
To: meta
Hopefully this makes it easier to diagnose portability
problems on new OSes we use.
---
t/dir_idle.t | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/t/dir_idle.t b/t/dir_idle.t
index bb6f47eb..02759b54 100644
--- a/t/dir_idle.t
+++ b/t/dir_idle.t
@@ -1,7 +1,7 @@
#!perl -w
# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
-use v5.12; use strict; use PublicInbox::TestCommon;
+use v5.12; use PublicInbox::TestCommon;
use PublicInbox::DS qw(now);
use File::Path qw(make_path);
use_ok 'PublicInbox::DirIdle';
@@ -26,10 +26,12 @@ rmdir("$tmpdir/a") or xbail "rmdir $!";
@x = ();
$end = 3 + now;
PublicInbox::DS::event_loop();
-is(scalar(@x), 1, 'got an event') and
+if (is(scalar(@x), 1, 'got an event after rmdir')) {
is($x[0]->[0]->fullname, "$tmpdir/a", 'got expected fullname') and
ok($x[0]->[0]->IN_DELETE_SELF, 'IN_DELETE_SELF set');
-
+} else {
+ diag explain(\@x);
+}
rename("$tmpdir/c", "$tmpdir/j") or xbail "rmdir $!";
@x = ();
$end = 3 + now;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] finalize DragonFlyBSD support
2023-10-06 9:45 [PATCH 0/5] Dragonfly BSD support Eric Wong
` (3 preceding siblings ...)
2023-10-06 9:46 ` [PATCH 4/5] t/dir_idle: dump event list on failure Eric Wong
@ 2023-10-06 9:46 ` Eric Wong
4 siblings, 0 replies; 6+ messages in thread
From: Eric Wong @ 2023-10-06 9:46 UTC (permalink / raw)
To: meta
require_bsd and require_mods(':fcntl_lock') are now
supported in TestCommon to make it easier to maintain
than a big list of regexps.
getsockopt for SO_ACCEPTFILTER seems to always succeed,
even if the retrieved struct is all zeroes.
---
install/os.perl | 7 ++++---
lib/PublicInbox/Daemon.pm | 4 ++--
lib/PublicInbox/IPC.pm | 1 +
lib/PublicInbox/MboxLock.pm | 10 +++++++---
lib/PublicInbox/POP3D.pm | 4 ++--
lib/PublicInbox/TestCommon.pm | 19 +++++++++++++++++--
t/ds-kqxs.t | 5 +++--
t/kqnotify.t | 28 +++++++++++++++++++++++++++-
t/pop3d-limit.t | 4 +---
t/pop3d.t | 6 ++----
t/search.t | 2 +-
xt/pop3d-mpop.t | 5 ++---
12 files changed, 69 insertions(+), 26 deletions(-)
diff --git a/install/os.perl b/install/os.perl
index 4fcbcbe4..bf5c55c2 100644
--- a/install/os.perl
+++ b/install/os.perl
@@ -40,7 +40,7 @@ EOM
last if $ID ne '' && $VERSION_ID ne '';
}
$ID = 'linux' if $ID eq ''; # cf. os-release(5)
-} elsif ($^O =~ m!\A(?:free|net|open)bsd\z!) { # TODO: net? dragonfly?
+} elsif ($^O =~ m!\A(?:free|net|open)bsd\z! || $^O eq 'dragonfly') {
$ID = $^O;
require POSIX;
(undef, undef, $release, $version) = POSIX::uname();
@@ -50,7 +50,8 @@ EOM
die "$^O unsupported";
}
$VERSION_ID //= 0; # numeric? could be 'sid', actually...
-my %MIN_VER = (freebsd => v11, openbsd => v7.3, netbsd => v9.3);
+my %MIN_VER = (freebsd => v11, openbsd => v7.3, netbsd => v9.3,
+ dragonfly => v6.4);
if (defined(my $min_ver = $MIN_VER{$^O})) {
my $vid = $VERSION_ID;
@@ -63,7 +64,7 @@ EOM
}
sub pkg_fmt () {
- if ($ID eq 'freebsd') { 'pkg' }
+ if ($ID =~ /\A(?:freebsd|dragonfly)\z/) { 'pkg' }
# *shrug*, as long as the (Net|Open)BSD names don't conflict w/ FreeBSD
elsif ($ID eq 'netbsd') { 'pkgin' }
elsif ($ID eq 'openbsd') { 'pkg_add' }
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index a4c99cca..520cef72 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -634,9 +634,9 @@ sub defer_accept ($$) {
my $sec = unpack('i', $x);
return if $sec > 0; # systemd users may set a higher value
setsockopt($s, IPPROTO_TCP, $TCP_DEFER_ACCEPT, 1);
- } elsif ($^O =~ /\A(?:freebsd|netbsd)\z/) {
+ } elsif ($^O =~ /\A(?:freebsd|netbsd|dragonfly)\z/) {
my $x = getsockopt($s, SOL_SOCKET, $SO_ACCEPTFILTER);
- return if defined $x; # don't change if set
+ return if ($x // "\0") =~ /[^\0]/s; # don't change if set
my $accf_arg = pack('a16a240', $af_name, '');
setsockopt($s, SOL_SOCKET, $SO_ACCEPTFILTER, $accf_arg);
}
diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm
index 839281b2..068c5623 100644
--- a/lib/PublicInbox/IPC.pm
+++ b/lib/PublicInbox/IPC.pm
@@ -437,6 +437,7 @@ sub DESTROY {
my %NPROCESSORS_ONLN = (
linux => 84,
freebsd => 58,
+ dragonfly => 58,
openbsd => 503,
netbsd => 1002
);
diff --git a/lib/PublicInbox/MboxLock.pm b/lib/PublicInbox/MboxLock.pm
index 95aa9862..9d7d4a32 100644
--- a/lib/PublicInbox/MboxLock.pm
+++ b/lib/PublicInbox/MboxLock.pm
@@ -12,9 +12,13 @@ use PublicInbox::DS qw(now); # ugh...
use autodie qw(chdir opendir unlink);
our $TMPL = do {
- if ($^O eq 'linux') { \'s @32' }
- elsif ($^O =~ /bsd/) { \'@20 s @256' } # n.b. @32 may be enough...
- else { eval { require File::FcntlLock; 1 } }
+ if ($^O eq 'linux') {
+ \'s @32'
+ } elsif ($^O =~ /bsd/ || $^O eq 'dragonfly') {
+ \'@20 s @256' # n.b. @32 may be enough...
+ } else {
+ eval { require File::FcntlLock; 1 }
+ }
};
# This order matches Debian policy on Linux systems.
diff --git a/lib/PublicInbox/POP3D.pm b/lib/PublicInbox/POP3D.pm
index 2a9ccfdd..38e982ee 100644
--- a/lib/PublicInbox/POP3D.pm
+++ b/lib/PublicInbox/POP3D.pm
@@ -15,7 +15,7 @@ use File::Temp 0.19 (); # 0.19 for ->newdir
use Fcntl qw(F_SETLK F_UNLCK F_WRLCK SEEK_SET);
my ($FLOCK_TMPL, @FLOCK_ORDER);
# are all BSDs the same "struct flock"? tested Free+Net+Open...
-if ($^O eq 'linux' || $^O =~ /bsd/) {
+if ($^O =~ /\A(?:linux|dragonfly)\z/ || $^O =~ /bsd/) {
require Config;
my $off_t;
my $sz = $Config::Config{lseeksize};
@@ -28,7 +28,7 @@ if ($^O eq 'linux' || $^O =~ /bsd/) {
if ($^O eq 'linux') {
$FLOCK_TMPL = "ss\@8$off_t$off_t\@32";
@FLOCK_ORDER = qw(l_type l_whence l_start l_len);
- } elsif ($^O =~ /bsd/) { # @32 may be enough
+ } else { # *bsd including dragonfly
$FLOCK_TMPL = "${off_t}${off_t}lss\@256";
@FLOCK_ORDER = qw(l_start l_len l_pid l_type l_whence);
}
diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index 32213fde..323152b4 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -23,7 +23,7 @@ BEGIN {
@EXPORT = qw(tmpdir tcp_server tcp_connect require_git require_mods
run_script start_script key2sub xsys xsys_e xqx eml_load tick
have_xapian_compact json_utf8 setup_public_inboxes create_inbox
- create_coderepo no_scm_rights
+ create_coderepo require_bsd
quit_waiter_pipe wait_for_eof
tcp_host_port test_lei lei lei_ok $lei_out $lei_err $lei_opt
test_httpd xbail require_cmd is_xdeeply tail_f
@@ -35,6 +35,15 @@ BEGIN {
push @EXPORT, @methods;
}
+sub require_bsd (;$) {
+ state $ok = ($^O =~ m!\A(?:free|net|open)bsd\z! ||
+ $^O eq 'dragonfly');
+ return 1 if $ok;
+ return if defined(wantarray);
+ my $m = "$0 is BSD-only (\$^O=$^O)";
+ @_ ? skip($m) : plan(skip_all => $m);
+}
+
sub xbail (@) { BAIL_OUT join(' ', map { ref() ? (explain($_)) : ($_) } @_) }
sub eml_load ($) {
@@ -136,7 +145,8 @@ my %IPv6_VERSION = (
sub need_accept_filter ($) {
my ($af) = @_;
return if $^O eq 'netbsd'; # since NetBSD 5.0
- skip 'SO_ACCEPTFILTER is FreeBSD/NetBSD-only' if $^O ne 'freebsd';
+ $^O =~ /\A(?:freebsd|dragonfly)\z/ or
+ skip 'SO_ACCEPTFILTER is FreeBSD/NetBSD/Dragonfly-only so far';
state $tried = {};
($tried->{$af} //= system("kldstat -m $af >/dev/null")) and
skip "$af not loaded: kldload $af";
@@ -175,6 +185,11 @@ sub require_mods {
push @need, $msg;
next;
}
+ } elsif ($mod eq ':fcntl_lock') {
+ next if $^O eq 'linux' || require_bsd;
+ diag "untested platform: $^O, ".
+ "requiring File::FcntlLock...";
+ push @mods, 'File::FcntlLock';
} elsif ($mod =~ /\A\+(accf_.*)\z/) {
need_accept_filter($1);
next
diff --git a/t/ds-kqxs.t b/t/ds-kqxs.t
index 57acb53f..87f7199d 100644
--- a/t/ds-kqxs.t
+++ b/t/ds-kqxs.t
@@ -6,8 +6,9 @@
use v5.12;
use Test::More;
unless (eval { require IO::KQueue }) {
- my $m = $^O !~ /bsd/ ? 'DSKQXS is only for *BSD systems'
- : "no IO::KQueue, skipping $0: $@";
+ my $m = ($^O =~ /bsd/ || $^O eq 'dragonfly') ?
+ "no IO::KQueue, skipping $0: $@" :
+ 'DSKQXS is only for *BSD systems';
plan skip_all => $m;
}
diff --git a/t/kqnotify.t b/t/kqnotify.t
index edecf2e1..cf32b633 100644
--- a/t/kqnotify.t
+++ b/t/kqnotify.t
@@ -7,7 +7,7 @@
use v5.12;
use PublicInbox::TestCommon;
use autodie;
-plan skip_all => 'KQNotify is only for *BSD systems' if $^O !~ /bsd/;
+require_bsd;
require_mods('IO::KQueue');
use_ok 'PublicInbox::KQNotify';
my ($tmpdir, $for_destroy) = tmpdir();
@@ -33,9 +33,35 @@ $hit = [ grep(m!/link$!, @read) ];
is_deeply($hit, ["$tmpdir/new/link"], 'link(2) detected (via NOTE_WRITE)')
or diag explain(\@read);
+{
+ my $d = "$tmpdir/new/ANOTHER";
+ mkdir $d;
+ $hit = [ map { $_->fullname } $kqn->read ];
+ is_xdeeply($hit, [ $d ], 'mkdir detected');
+ rmdir $d;
+ # TODO: should we always watch for directory removals?
+}
+
$w->cancel;
link("$tmpdir/new/tst", "$tmpdir/new/link2");
$hit = [ map { $_->fullname } $kqn->read ];
is_deeply($hit, [], 'link(2) not detected after cancel');
+# rearm:
+my $GONE = PublicInbox::KQNotify::NOTE_DELETE() |
+ PublicInbox::KQNotify::NOTE_REVOKE() |
+ PublicInbox::KQNotify::NOTE_ATTRIB() |
+ PublicInbox::KQNotify::NOTE_WRITE() |
+ PublicInbox::KQNotify::NOTE_RENAME();
+$w = $kqn->watch("$tmpdir/new", $mask|$GONE);
+my @unlink = sort glob("$tmpdir/new/*");
+unlink(@unlink);
+$hit = [ sort(map { $_->fullname } $kqn->read) ];
+is_xdeeply($hit, \@unlink, 'unlinked files match');
+
+# this is unreliable on Dragonfly tmpfs (fixed post-6.4)
+rmdir "$tmpdir/new";
+$hit = [ sort(map { $_->fullname } $kqn->read) ];
+is(scalar(@$hit), 1, 'detected self removal');
+
done_testing;
diff --git a/t/pop3d-limit.t b/t/pop3d-limit.t
index 00da477d..79e320af 100644
--- a/t/pop3d-limit.t
+++ b/t/pop3d-limit.t
@@ -3,9 +3,7 @@
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use v5.12;
use PublicInbox::TestCommon;
-require_mods(qw(DBD::SQLite Net::POP3));
-$^O =~ /\A(?:linux|(?:free|net|open)bsd)\z/ or
- require_mods(qw(File::FcntlLock));
+require_mods(qw(DBD::SQLite Net::POP3 :fcntl_lock));
use autodie;
my ($tmpdir, $for_destroy) = tmpdir();
mkdir("$tmpdir/p3state");
diff --git a/t/pop3d.t b/t/pop3d.t
index fce4a788..ee19f2d7 100644
--- a/t/pop3d.t
+++ b/t/pop3d.t
@@ -12,10 +12,8 @@ unless (-r $key && -r $cert) {
}
# Net::POP3 is part of the standard library, but distros may split it off...
-require_mods(qw(DBD::SQLite Net::POP3 IO::Socket::SSL));
-require_git('2.6'); # for v2
-$^O =~ /\A(?:linux|(?:free|net|open)bsd)\z/ or
- require_mods(qw(File::FcntlLock));
+require_mods(qw(DBD::SQLite Net::POP3 IO::Socket::SSL :fcntl_lock));
+require_git(v2.6); # for v2
use_ok 'IO::Socket::SSL';
use_ok 'PublicInbox::TLS';
my ($tmpdir, $for_destroy) = tmpdir();
diff --git a/t/search.t b/t/search.t
index 636dc5cf..282ae586 100644
--- a/t/search.t
+++ b/t/search.t
@@ -440,7 +440,7 @@ my $dir_mask = 02770;
# FreeBSD, OpenBSD and NetBSD do not allow non-root users to set S_ISGID,
# so git doesn't set it, either (see DIR_HAS_BSD_GROUP_SEMANTICS in git.git)
# Presumably all *BSDs behave the same way.
-if ($^O =~ /\A.+bsd\z/i) {
+if (require_bsd) {
$all_mask = 0777;
$dir_mask = 0770;
}
diff --git a/xt/pop3d-mpop.t b/xt/pop3d-mpop.t
index 9da1050c..ff8bb5dc 100644
--- a/xt/pop3d-mpop.t
+++ b/xt/pop3d-mpop.t
@@ -12,9 +12,8 @@ my $inboxdir = $ENV{GIANT_INBOX_DIR};
plan skip_all => "bad characters in $inboxdir" if $inboxdir =~ m![^\w\.\-/]!;
my $uuidgen = require_cmd('uuidgen');
my $mpop = require_cmd('mpop');
-require_mods(qw(DBD::SQLite));
-require_git('2.6'); # for v2
-require_mods(qw(File::FcntlLock)) if $^O !~ /\A(?:linux|freebsd)\z/;
+require_mods(qw(DBD::SQLite :fcntl_lock));
+require_git(v2.6); # for v2
my ($tmpdir, $for_destroy) = tmpdir();
my $cfg = "$tmpdir/cfg";
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-10-06 9:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-06 9:45 [PATCH 0/5] Dragonfly BSD support Eric Wong
2023-10-06 9:46 ` [PATCH 1/5] kqnotify: drop EV_CLEAR (edge triggering) Eric Wong
2023-10-06 9:46 ` [PATCH 2/5] xap_helper.h: strdup keys for DragonFlyBSD hdestroy(3) Eric Wong
2023-10-06 9:46 ` [PATCH 3/5] devel/sysdefs-list: show more info regardless of OS Eric Wong
2023-10-06 9:46 ` [PATCH 4/5] t/dir_idle: dump event list on failure Eric Wong
2023-10-06 9:46 ` [PATCH 5/5] finalize DragonFlyBSD support Eric Wong
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).