* [PATCH 0/4] another round of portability fixes
@ 2023-09-07 0:54 Eric Wong
2023-09-07 0:54 ` [PATCH 1/4] tail_notify: reinstate watch on reopen Eric Wong
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Eric Wong @ 2023-09-07 0:54 UTC (permalink / raw)
To: meta
Most notably, some of these problems fixed on NetBSD and
OpenBSD are problems on Linux and FreeBSD, too.
1/4 likely affects other platforms, but was only noticed on NetBSD.
4/4 is an important fix which applies to all platforms,
but I only noticed it on OpenBSD.
Eric Wong (4):
tail_notify: reinstate watch on reopen
t/cmd_ipc.t: allow EMSGSIZE send error for NetBSD
t/search.t: tweak dir group semantics for all *BSDs
xap_helper: fix fcntl() argument order
lib/PublicInbox/TailNotify.pm | 1 +
lib/PublicInbox/xap_helper.h | 4 ++--
t/cmd_ipc.t | 9 +++++----
t/search.t | 5 +++--
4 files changed, 11 insertions(+), 8 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] tail_notify: reinstate watch on reopen
2023-09-07 0:54 [PATCH 0/4] another round of portability fixes Eric Wong
@ 2023-09-07 0:54 ` Eric Wong
2023-09-07 0:54 ` [PATCH 2/4] t/cmd_ipc.t: allow EMSGSIZE send error for NetBSD Eric Wong
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2023-09-07 0:54 UTC (permalink / raw)
To: meta
This fixes t/tail_notify.t on NetBSD 9.3 where the log file
is deleted and later recreated.
---
lib/PublicInbox/TailNotify.pm | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/PublicInbox/TailNotify.pm b/lib/PublicInbox/TailNotify.pm
index cbbc1041..f4ffb296 100644
--- a/lib/PublicInbox/TailNotify.pm
+++ b/lib/PublicInbox/TailNotify.pm
@@ -29,6 +29,7 @@ sub reopen_file ($) {
open my $fh, '<', $self->{fn} or return undef;
my @st = stat $fh or die "fstat($self->{fn}): $!";
$self->{ino_dev} = "@st[0, 1]";
+ $self->{inot}->watch($self->{fn}, $TAIL_MOD);
$self->{watch_fh} = $fh; # return value
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] t/cmd_ipc.t: allow EMSGSIZE send error for NetBSD
2023-09-07 0:54 [PATCH 0/4] another round of portability fixes Eric Wong
2023-09-07 0:54 ` [PATCH 1/4] tail_notify: reinstate watch on reopen Eric Wong
@ 2023-09-07 0:54 ` Eric Wong
2023-09-07 0:54 ` [PATCH 3/4] t/search.t: tweak dir group semantics for all *BSDs Eric Wong
2023-09-07 0:54 ` [PATCH 4/4] xap_helper: fix fcntl() argument order Eric Wong
3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2023-09-07 0:54 UTC (permalink / raw)
To: meta
NetBSD sendmsg can error out with EMSGSIZE instead of EAGAIN or
ETOOMANYREFS when a socket is non-blocking and the reader isn't
keeping up.
---
t/cmd_ipc.t | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/t/cmd_ipc.t b/t/cmd_ipc.t
index 403d0eed..7edfc92f 100644
--- a/t/cmd_ipc.t
+++ b/t/cmd_ipc.t
@@ -80,13 +80,14 @@ my $do_test = sub { SKIP: {
socketpair($s1, $s2, AF_UNIX, $type, 0) or BAIL_OUT $!;
$s1->blocking(0);
my $nsent = 0;
+ my $srclen = length($src);
while (defined(my $n = $send->($s1, $sfds, $src, $flag))) {
$nsent += $n;
- fail "sent 0 bytes" if $n == 0;
+ fail "sent $n bytes of $srclen" if $srclen != $n;
}
- ok($!{EAGAIN} || $!{ETOOMANYREFS},
- "hit EAGAIN || ETOOMANYREFS on send $desc") or
- diag "send failed with: $!";
+ ok($!{EAGAIN} || $!{ETOOMANYREFS} || $!{EMSGSIZE},
+ "hit EAGAIN || ETOOMANYREFS || EMSGSIZE on send $desc")
+ or diag "send failed with: $! (nsent=$nsent)";
ok($nsent > 0, 'sent some bytes');
socketpair($s1, $s2, AF_UNIX, $type, 0) or BAIL_OUT $!;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] t/search.t: tweak dir group semantics for all *BSDs
2023-09-07 0:54 [PATCH 0/4] another round of portability fixes Eric Wong
2023-09-07 0:54 ` [PATCH 1/4] tail_notify: reinstate watch on reopen Eric Wong
2023-09-07 0:54 ` [PATCH 2/4] t/cmd_ipc.t: allow EMSGSIZE send error for NetBSD Eric Wong
@ 2023-09-07 0:54 ` Eric Wong
2023-09-07 0:54 ` [PATCH 4/4] xap_helper: fix fcntl() argument order Eric Wong
3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2023-09-07 0:54 UTC (permalink / raw)
To: meta
NetBSD shares semantics with FreeBSD and OpenBSD, at least;
and presumably all their *BSD cousins behave the same way.
---
t/search.t | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/t/search.t b/t/search.t
index ea5a2a5a..8084c41b 100644
--- a/t/search.t
+++ b/t/search.t
@@ -437,9 +437,10 @@ $ibx->with_umask(sub {
my $all_mask = 07777;
my $dir_mask = 02770;
-# FreeBSD and apparently OpenBSD does not allow non-root users to set S_ISGID,
+# 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)
-if ($^O =~ /(?:free|open)bsd/i) {
+# Presumably all *BSDs behave the same way.
+if ($^O =~ /\A.+bsd\z/i) {
$all_mask = 0777;
$dir_mask = 0770;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] xap_helper: fix fcntl() argument order
2023-09-07 0:54 [PATCH 0/4] another round of portability fixes Eric Wong
` (2 preceding siblings ...)
2023-09-07 0:54 ` [PATCH 3/4] t/search.t: tweak dir group semantics for all *BSDs Eric Wong
@ 2023-09-07 0:54 ` Eric Wong
3 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2023-09-07 0:54 UTC (permalink / raw)
To: meta
*sigh* I only noticed this when running `make check-run' under
OpenBSD.
---
lib/PublicInbox/xap_helper.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h
index 73590efd..70760367 100644
--- a/lib/PublicInbox/xap_helper.h
+++ b/lib/PublicInbox/xap_helper.h
@@ -1168,9 +1168,9 @@ int main(int argc, char *argv[])
if (!worker_pids) err(EXIT_FAILURE, "calloc");
if (pipe(pipefds)) err(EXIT_FAILURE, "pipe");
- int fl = fcntl(F_GETFL, pipefds[1]);
+ int fl = fcntl(pipefds[1], F_GETFL);
if (fl == -1) err(EXIT_FAILURE, "F_GETFL");
- if (fcntl(F_SETFL, pipefds[1], fl | O_NONBLOCK))
+ if (fcntl(pipefds[1], F_SETFL, fl | O_NONBLOCK))
err(EXIT_FAILURE, "F_SETFL");
CHECK(int, 0, sigdelset(&pset, SIGCHLD));
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-07 0:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-07 0:54 [PATCH 0/4] another round of portability fixes Eric Wong
2023-09-07 0:54 ` [PATCH 1/4] tail_notify: reinstate watch on reopen Eric Wong
2023-09-07 0:54 ` [PATCH 2/4] t/cmd_ipc.t: allow EMSGSIZE send error for NetBSD Eric Wong
2023-09-07 0:54 ` [PATCH 3/4] t/search.t: tweak dir group semantics for all *BSDs Eric Wong
2023-09-07 0:54 ` [PATCH 4/4] xap_helper: fix fcntl() argument order 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).