]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
test_common: fix +SCM_RIGHTS check
authorEric Wong <e@80x24.org>
Tue, 19 Aug 2025 00:33:35 +0000 (00:33 +0000)
committerEric Wong <e@80x24.org>
Wed, 20 Aug 2025 19:10:15 +0000 (19:10 +0000)
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

index ac802878891e14751197727ab827686fa18a1659..33bd9fabac0a14d9fef99d35d7174a17e92b6104 100644 (file)
@@ -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