"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Carlo Cabrera <carlo.antonio.cabrera@gmail.com>
Subject:
Re: `got import` segfaults on macOS (got-portable 0.85, 0.86)
To:
Stefan Sperling <stsp@stsp.name>
Cc:
gameoftrees@openbsd.org
Date:
Wed, 15 Mar 2023 21:46:09 +0800

Download raw body.

Thread
Hi Stefan,

> On 15 Mar 2023, at 21:06, Stefan Sperling <stsp@stsp.name> wrote:
> 
> There is a placeholder getopt implementation in compat/getopt.c which is
> used if HAVE_LIBBSD is not defined.
> 
> I suspect that this file gets compiled on MacOS, which unlike Linux should
> already have BSD APIs such as getopt natively. And at run-time there is some
> confusion between getopt() from MacOS libc and getopt() from the compat/getopt.c
> file? Not sure what the root cause is, but following this trail might help.

Thanks for the tip. Let me look into this. In the meantime, I tried a `git
bisect`, and that produced the following:

    4fccd2fe0ffbbc668b66abe63614470635f92f1b is the first bad commit
    commit 4fccd2fe0ffbbc668b66abe63614470635f92f1b
    Author: Thomas Adam <thomas@xteddy.org>
    Date:   Mon Feb 27 22:39:48 2023 +0000
    
        portable: configure: split out dependencies
    
        Rather than assume all dependencies are required for all programs, split
        them out.
    
        This will make packaging easier, as well as splitting the code to use
        subprojects.
    
        Note that due to the use of config.h semantics, in most cases the
        got_compat.h header file is now at the top of the .c file it is included
        in, so that it can handle the system header inclusion properly.

Unfortunately, the commit does not revert cleanly, but I suspect that this
confirms your hypothesis regarding the placeholder `getopt` implementation.

Regards,
Carlo