* [PATCH 0/4] DragonFly-related fixes @ 2023-12-01 2:07 Eric Wong 2023-12-01 2:07 ` [PATCH 1/4] t/xap_helper: make sendmsg errors more obvious Eric Wong ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: Eric Wong @ 2023-12-01 2:07 UTC (permalink / raw) To: meta 2/4 probably affects NetBSD and OpenBSD, too, but tests don't always fail... Eric Wong (4): t/xap_helper: make sendmsg errors more obvious xap_helper.h: fix non-assignable stderr case tests: note kevent+tmpfs failures on DragonFly <= 6.4 xap_helper: enable stderr assignment on DragonFly lib/PublicInbox/TestCommon.pm | 23 ++++++++++++++++++++++- lib/PublicInbox/xap_helper.h | 4 ++-- t/dir_idle.t | 7 +++++-- t/kqnotify.t | 2 +- t/xap_helper.t | 1 + 5 files changed, 31 insertions(+), 6 deletions(-) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] t/xap_helper: make sendmsg errors more obvious 2023-12-01 2:07 [PATCH 0/4] DragonFly-related fixes Eric Wong @ 2023-12-01 2:07 ` Eric Wong 2023-12-01 2:07 ` [PATCH 2/4] xap_helper.h: fix non-assignable stderr case Eric Wong ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: Eric Wong @ 2023-12-01 2:07 UTC (permalink / raw) To: meta By ignoring SIGPIPE, we hit our own error path and emit an informative error message instead of dying abruptly and requiring somebody to run `echo $?' to see the child status from their shell. --- t/xap_helper.t | 1 + 1 file changed, 1 insertion(+) diff --git a/t/xap_helper.t b/t/xap_helper.t index 37679ae9..ec78998c 100644 --- a/t/xap_helper.t +++ b/t/xap_helper.t @@ -59,6 +59,7 @@ my $doreq = sub { $x; }; +local $SIG{PIPE} = 'IGNORE'; my $env = { PERL5LIB => join(':', @INC) }; my $test = sub { my (@cmd) = @_; ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] xap_helper.h: fix non-assignable stderr case 2023-12-01 2:07 [PATCH 0/4] DragonFly-related fixes Eric Wong 2023-12-01 2:07 ` [PATCH 1/4] t/xap_helper: make sendmsg errors more obvious Eric Wong @ 2023-12-01 2:07 ` Eric Wong 2023-12-01 2:07 ` [PATCH 3/4] tests: note kevent+tmpfs failures on DragonFly <= 6.4 Eric Wong 2023-12-01 2:07 ` [PATCH 4/4] xap_helper: enable stderr assignment on DragonFly Eric Wong 3 siblings, 0 replies; 5+ messages in thread From: Eric Wong @ 2023-12-01 2:07 UTC (permalink / raw) To: meta I mixed up "flush" with "close" :x Fixes: 87b7f633f241 (xap_helper: implement mset endpoint for WWW, IMAP, etc...) --- lib/PublicInbox/xap_helper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h index 18665567..c1ab66f3 100644 --- a/lib/PublicInbox/xap_helper.h +++ b/lib/PublicInbox/xap_helper.h @@ -714,7 +714,7 @@ static void stderr_restore(FILE *tmp_err) stderr = orig_err; return; #endif - ERR_CLOSE(stderr, EXIT_FAILURE); + ERR_FLUSH(stderr); while (dup2(orig_err_fd, STDERR_FILENO) < 0) { if (errno != EINTR) err(EXIT_FAILURE, "dup2(%d => 2)", orig_err_fd); ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] tests: note kevent+tmpfs failures on DragonFly <= 6.4 2023-12-01 2:07 [PATCH 0/4] DragonFly-related fixes Eric Wong 2023-12-01 2:07 ` [PATCH 1/4] t/xap_helper: make sendmsg errors more obvious Eric Wong 2023-12-01 2:07 ` [PATCH 2/4] xap_helper.h: fix non-assignable stderr case Eric Wong @ 2023-12-01 2:07 ` Eric Wong 2023-12-01 2:07 ` [PATCH 4/4] xap_helper: enable stderr assignment on DragonFly Eric Wong 3 siblings, 0 replies; 5+ messages in thread From: Eric Wong @ 2023-12-01 2:07 UTC (permalink / raw) To: meta I forgot to set TMPDIR=/path/to/non-tmpfs again. --- lib/PublicInbox/TestCommon.pm | 23 ++++++++++++++++++++++- t/dir_idle.t | 7 +++++-- t/kqnotify.t | 2 +- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index 8e7eb950..f2914d09 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -24,7 +24,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 require_bsd + create_coderepo require_bsd kernel_version check_broken_tmpfs 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 @@ -37,6 +37,27 @@ BEGIN { push @EXPORT, @methods; } +sub kernel_version () { + state $version = do { + require POSIX; + my @u = POSIX::uname(); + if ($u[2] =~ /\A([0-9]+(?:\.[0-9]+)+)/) { + eval "v$1"; + } else { + local $" = "', `"; + diag "Unable to get kernel version from: `@u'"; + undef; + } + }; +} + +sub check_broken_tmpfs () { + return if $^O ne 'dragonfly' || kernel_version ge v6.5; + diag 'EVFILT_VNODE + tmpfs is broken on dragonfly <= 6.4 (have: '. + sprintf('%vd', kernel_version).')'; + 1; +} + sub require_bsd (;$) { state $ok = ($^O =~ m!\A(?:free|net|open)bsd\z! || $^O eq 'dragonfly'); diff --git a/t/dir_idle.t b/t/dir_idle.t index 14aad7a1..8d085d6e 100644 --- a/t/dir_idle.t +++ b/t/dir_idle.t @@ -16,10 +16,12 @@ my $end = 3 + now; local @PublicInbox::DS::post_loop_do = (sub { scalar(@x) == 0 && now < $end }); rmdir("$tmpdir/a/b") or xbail "rmdir $!"; PublicInbox::DS::event_loop(); -is(scalar(@x), 1, 'got an rmdir event') or xbail explain(\@x); -if (@x) { +if (is(scalar(@x), 1, 'got an rmdir event')) { is($x[0]->[0]->fullname, "$tmpdir/a/b", 'got expected fullname') and ok($x[0]->[0]->IN_DELETE, 'IN_DELETE set'); +} else { + check_broken_tmpfs; + xbail explain(\@x); } rmdir("$tmpdir/a") or xbail "rmdir $!"; @@ -30,6 +32,7 @@ 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 { + check_broken_tmpfs; diag explain(\@x); } rename("$tmpdir/c", "$tmpdir/j") or xbail "rmdir $!"; diff --git a/t/kqnotify.t b/t/kqnotify.t index cf32b633..add477a4 100644 --- a/t/kqnotify.t +++ b/t/kqnotify.t @@ -62,6 +62,6 @@ 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'); +is(scalar(@$hit), 1, 'detected self removal') or check_broken_tmpfs; done_testing; ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] xap_helper: enable stderr assignment on DragonFly 2023-12-01 2:07 [PATCH 0/4] DragonFly-related fixes Eric Wong ` (2 preceding siblings ...) 2023-12-01 2:07 ` [PATCH 3/4] tests: note kevent+tmpfs failures on DragonFly <= 6.4 Eric Wong @ 2023-12-01 2:07 ` Eric Wong 3 siblings, 0 replies; 5+ messages in thread From: Eric Wong @ 2023-12-01 2:07 UTC (permalink / raw) To: meta It looks like DragonFly inherited this from FreeBSD to allow us to save us some syscalls. --- lib/PublicInbox/xap_helper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/xap_helper.h b/lib/PublicInbox/xap_helper.h index c1ab66f3..1f8c426b 100644 --- a/lib/PublicInbox/xap_helper.h +++ b/lib/PublicInbox/xap_helper.h @@ -64,7 +64,7 @@ # define MY_DO_OPTRESET() do { optind = optreset = 1; } while (0) #endif -#if defined(__FreeBSD__) || defined(__GLIBC__) +#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__GLIBC__) # define STDERR_ASSIGNABLE (1) #else # define STDERR_ASSIGNABLE (0) ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-12-01 2:07 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-12-01 2:07 [PATCH 0/4] DragonFly-related fixes Eric Wong 2023-12-01 2:07 ` [PATCH 1/4] t/xap_helper: make sendmsg errors more obvious Eric Wong 2023-12-01 2:07 ` [PATCH 2/4] xap_helper.h: fix non-assignable stderr case Eric Wong 2023-12-01 2:07 ` [PATCH 3/4] tests: note kevent+tmpfs failures on DragonFly <= 6.4 Eric Wong 2023-12-01 2:07 ` [PATCH 4/4] xap_helper: enable stderr assignment on DragonFly 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).