user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 0/2] avoid SCM_RIGHTS dep w/o Inline::C||Socket::MsgHdr
@ 2023-08-26 20:14  7% Eric Wong
  2023-08-26 20:14  6% ` [PATCH 2/2] t/xap_helper: skip test if missing SCM_RIGHTS support Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2023-08-26 20:14 UTC (permalink / raw)
  To: meta

Either Inline::C or Socket::MsgHdr is required for SCM_RIGHTS
support (FD passing) on *BSDs where syscall numbers aren't stable.

1/2 is actually an all-around improvement, while 2/2 is a
temporary placeholder while we consider FIFOs or something
else...

Eric Wong (2):
  cindex: make prune work without SCM_RIGHTS support
  t/xap_helper: skip test if missing SCM_RIGHTS support

 lib/PublicInbox/CodeSearchIdx.pm | 60 +++++++++++++++-----------------
 lib/PublicInbox/TestCommon.pm    | 23 ++++++------
 t/xap_helper.t                   |  2 ++
 3 files changed, 44 insertions(+), 41 deletions(-)

^ permalink raw reply	[relevance 7%]

* [PATCH 2/2] t/xap_helper: skip test if missing SCM_RIGHTS support
  2023-08-26 20:14  7% [PATCH 0/2] avoid SCM_RIGHTS dep w/o Inline::C||Socket::MsgHdr Eric Wong
@ 2023-08-26 20:14  6% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-08-26 20:14 UTC (permalink / raw)
  To: meta

xap_helper currently relies on FDs passed via SCM_RIGHTS for
robustness against $TMPDIR failures and over-eager FS cleanup
tasks.  This depends on stable syscall numbers (Linux) or
Inline::C||Socket::MsgHdr being available, though, as Perl5
itself doesn't support SCM_RIGHTS.

We could probably add FIFO support to xap_helper for portability
to systems where neither Inline::C nor Socket::MsgHdr are available,
but that's for another day.
---
 lib/PublicInbox/TestCommon.pm | 23 +++++++++++++----------
 t/xap_helper.t                |  2 ++
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm
index ddee58b1..6da993af 100644
--- a/lib/PublicInbox/TestCommon.pm
+++ b/lib/PublicInbox/TestCommon.pm
@@ -22,7 +22,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
+		create_coderepo no_scm_rights
 		tcp_host_port test_lei lei lei_ok $lei_out $lei_err $lei_opt
 		test_httpd xbail require_cmd is_xdeeply tail_f
 		ignore_inline_c_missing);
@@ -567,6 +567,16 @@ sub ignore_inline_c_missing {
 		grep(!/\bInline\b/, split(/^/m, $_[0])))));
 }
 
+sub no_scm_rights () {
+	state $ok = PublicInbox::Spawn->can('send_cmd4') || do {
+			require PublicInbox::Syscall;
+			PublicInbox::Syscall->can('send_cmd4');
+		} || eval { require Socket::MsgHdr; 1 };
+	return if $ok;
+	'Inline::C unconfigured/missing '.
+	'(mkdir -p ~/.cache/public-inbox/inline-c) OR Socket::MsgHdr missing';
+}
+
 sub test_lei {
 SKIP: {
 	my ($cb) = pop @_;
@@ -591,15 +601,8 @@ SKIP: {
 	$ENV{LANG} = $ENV{LC_ALL} = 'C';
 	my (undef, $fn, $lineno) = caller(0);
 	my $t = "$fn:$lineno";
-	state $lei_daemon = PublicInbox::Spawn->can('send_cmd4') || do {
-			require PublicInbox::Syscall;
-			PublicInbox::Syscall->can('send_cmd4');
-		} || eval { require Socket::MsgHdr; 1 };
-	unless ($lei_daemon) {
-		skip('Inline::C unconfigured/missing '.
-'(mkdir -p ~/.cache/public-inbox/inline-c) OR Socket::MsgHdr missing',
-			1);
-	}
+	state $msg = no_scm_rights();
+	skip $msg, 1 if $msg;
 	$lei_opt = { 1 => \$lei_out, 2 => \$lei_err };
 	my ($daemon_pid, $for_destroy, $daemon_xrd);
 	my $tmpdir = $test_opt->{tmpdir};
diff --git a/t/xap_helper.t b/t/xap_helper.t
index 92da2e6d..3646cf97 100644
--- a/t/xap_helper.t
+++ b/t/xap_helper.t
@@ -4,6 +4,8 @@
 use v5.12;
 use PublicInbox::TestCommon;
 require_mods(qw(DBD::SQLite Search::Xapian));
+my $msg = no_scm_rights;
+plan(skip_all => $msg) if $msg; # TODO: FIFO support?
 use PublicInbox::Spawn qw(spawn);
 use Socket qw(AF_UNIX SOCK_SEQPACKET SOCK_STREAM MSG_EOR);
 require PublicInbox::AutoReap;

^ permalink raw reply related	[relevance 6%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-08-26 20:14  7% [PATCH 0/2] avoid SCM_RIGHTS dep w/o Inline::C||Socket::MsgHdr Eric Wong
2023-08-26 20:14  6% ` [PATCH 2/2] t/xap_helper: skip test if missing SCM_RIGHTS support 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).