unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: Gaelan Steele <gaelans@icloud.com>
Cc: meta@public-inbox.org
Subject: [RFT] syscall: set default constants for Inline::C platforms
Date: Mon, 8 Apr 2024 09:48:43 +0000	[thread overview]
Message-ID: <20240408094843.M120440@dcvr> (raw)
In-Reply-To: <0C20FAD1-1983-4C38-BB6C-03D9DEFC0D58@icloud.com>

Gaelan Steele <gaelans@icloud.com> wrote:
> Unfortunately this patch broke public-inbox on Darwin:
> 
> Bareword "SIZEOF_cmsghdr" not allowed while "strict subs" in use at /tmp/public-inbox/lib/PublicInbox/Syscall.pm line 456.
> BEGIN not safe after errors--compilation aborted at /tmp/public-inbox/lib/PublicInbox/Syscall.pm line 460.
> Compilation failed in require at /tmp/public-inbox/lib/PublicInbox/DS.pm line 31.
> BEGIN failed--compilation aborted at /tmp/public-inbox/lib/PublicInbox/DS.pm line 32.
> Compilation failed in require at /tmp/public-inbox/lib/PublicInbox/Daemon.pm line 17.
> BEGIN failed--compilation aborted at /tmp/public-inbox/lib/PublicInbox/Daemon.pm line 17.
> Compilation failed in require at /tmp/public-inbox/script/public-inbox-httpd line 7.
> BEGIN failed--compilation aborted at /tmp/public-inbox/script/public-inbox-httpd line 7.
> 
> I’m not enough of a Perl person to fully untangle this. As
> best I can tell, the intent is that non-Linux/BSD OSes should
> still work with Inline::C, but this doesn’t work in practice
> due to a bug?

Right.  Patch below should fix it, test feedback appreciated.

> It may also be possible to use the BSD approach on Darwin -
> Darwin ascribes to the BSD school of thought where libc is the
> only Officially Stable interface, but if you can get away with
> it on the real BSDs maybe you can get away with it on fake BSD
> too.

NetBSD and FreeBSD both document the underlying syscall numbers
remain stable (but not the name => number mapping).  OpenBSD has
no stable numbering, but goes as far as to patch Perl to route
the `syscall' perlop through their libc to avoid breaking Perl
scripts.

I have no idea if Darwin maintains any stability guarantees at
all like the above OSes, so Inline::C may be safer, here.

-------8<-------
Subject: [PATCH] syscall: set default constants for Inline::C platforms

This ought to fix compile errors on platforms we don't
explicitly support.

Reported-by: Gaelan Steele <gaelans@icloud.com>
---
 lib/PublicInbox/Syscall.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/lib/PublicInbox/Syscall.pm b/lib/PublicInbox/Syscall.pm
index 829cfa3c..99af5bf5 100644
--- a/lib/PublicInbox/Syscall.pm
+++ b/lib/PublicInbox/Syscall.pm
@@ -317,6 +317,10 @@ BEGIN {
 		)
 	}
 	$PACK{CMSG_ALIGN_size} = SIZEOF_size_t;
+	$PACK{SIZEOF_cmsghdr} //= 0;
+	$PACK{TMPL_cmsg_len} //= undef;
+	$PACK{CMSG_DATA_off} //= undef;
+	$PACK{TMPL_msghdr} //= undef;
 }
 
 # SFD_CLOEXEC is arch-dependent, so IN_CLOEXEC may be, too

  reply	other threads:[~2024-04-08  9:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-28 14:56 [PATCH 00/14] IT'S ALIVE! www loads cindex join data Eric Wong
2023-11-28 14:56 ` [PATCH 01/14] test_common: create_*: detect changes all parameters Eric Wong
2023-11-28 14:56 ` [PATCH 02/14] t/cindex*: require SCM_RIGHTS for these tests Eric Wong
2024-01-29 21:23   ` [PATCH 0/2] pure Perl sendmsg/recvmsg on *BSD Eric Wong
2024-01-29 21:23     ` [PATCH 1/2] syscall: update formatting to match our codebase Eric Wong
2024-01-29 21:23     ` [PATCH 2/2] syscall: use pure Perl sendmsg/recvmsg on *BSD Eric Wong
2024-04-06  0:43       ` Gaelan Steele
2024-04-08  9:48         ` Eric Wong [this message]
2024-04-08 12:12           ` [RFT] syscall: set default constants for Inline::C platforms Gaelan Steele
2024-04-08 20:11             ` Eric Wong
2023-11-28 14:56 ` [PATCH 03/14] codesearch: eliminate redundant substitutions Eric Wong
2023-11-28 14:56 ` [PATCH 04/14] solver: schedule cleanup after synchronous git->check Eric Wong
2023-11-28 14:56 ` [PATCH 05/14] xap_helper.h: move cindex endpoints to separate file Eric Wong
2023-11-28 14:56 ` [PATCH 06/14] xap_helper: implement mset endpoint for WWW, IMAP, etc Eric Wong
2023-11-28 14:56 ` [PATCH 07/14] hval: use File::Spec to make relative paths for href Eric Wong
2023-11-28 14:56 ` [PATCH 08/14] www: load and use cindex join data Eric Wong
2023-11-28 14:56 ` [PATCH 09/14] git: speed up ->git_path for non-worktrees Eric Wong
2023-11-28 14:56 ` [PATCH 10/14] cindex: require `-g GIT_DIR' or `-r PROJECT_ROOT' Eric Wong
2023-11-28 14:56 ` [PATCH 11/14] git: speed up Git->new by 5% or so Eric Wong
2023-11-28 14:56 ` [PATCH 12/14] admin: resolve_git_dir respects symlinks Eric Wong
2023-11-28 14:56 ` [PATCH 13/14] cindex: extra quit checks Eric Wong
2023-11-28 14:56 ` [PATCH 14/14] www: start working on a repo listing Eric Wong
2023-11-28 17:55 ` [PATCH 15/14] www: load cindex join data for ->ALL, too Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240408094843.M120440@dcvr \
    --to=e@80x24.org \
    --cc=gaelans@icloud.com \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).