From ff704a73f471399ff613fad35352e42276f5d3bf Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 19 Aug 2025 00:33:35 +0000 Subject: [PATCH] test_common: fix +SCM_RIGHTS check We need to ensure we don't attempt to load a module named `+SCM_RIGHTS' by skipping it after expansion to module names Furthermore, start deprioritizing Inline::C in the help text since it'll be difficult to support in alternative implementations of Perl. --- lib/PublicInbox/TestCommon.pm | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index ac8028788..33bd9faba 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -251,10 +251,8 @@ sub require_mods (@) { next; } } elsif ($mod eq '+SCM_RIGHTS') { - if (my $msg = need_scm_rights()) { - push @need, $msg; - next; - } + push @need, need_scm_rights(); + next; } elsif ($mod eq ':fcntl_lock') { next if $^O eq 'linux' || require_bsd; diag "untested platform: $^O, ". @@ -722,13 +720,16 @@ sub ignore_inline_c_missing { } sub need_scm_rights () { - state $ok = PublicInbox::Spawn->can('send_cmd4') || do { + state $ok = do { require PublicInbox::Syscall; - PublicInbox::Syscall->can('send_cmd4'); # Linux only - } || eval { require Socket::MsgHdr; 1 }; - return if $ok; - 'need SCM_RIGHTS support: Inline::C unconfigured/missing '. - '(mkdir -p ~/.cache/public-inbox/inline-c) OR Socket::MsgHdr missing'; + PublicInbox::Syscall->can('send_cmd4'); # Linux+*BSD + } || eval { require Socket::MsgHdr; 1 } || + PublicInbox::Spawn->can('send_cmd4'); + return () if $ok; + ('need SCM_RIGHTS support: Socket::MsgHdr OR ' . + '(syscall numbers + msg_hdr pack templates missing) OR ' . + 'Inline::C unconfigured/missing '. + '( mkdir -p ~/.cache/public-inbox/inline-c)' ); } # returns a pipe with FD_CLOEXEC disabled on the write-end -- 2.47.3