With the VPN running and without, check the value of (network-lookup-address-info "localhost") and see if the VPN-regime value looks sensible. It is possible that your VPN set up is absconding with host resolution. I'd bet that (nsm-should-check "127.0.0.1") works fine under both scenarios. You could at the command line also ping localhost and see what that reveals or try macOS network "reachability" diagnostic utility scutil -W -r localhost.

On Mon, Dec 16, 2024 at 5:58 AM Robert Pluim <rpluim@gmail.com> wrote:
>>>>> On Mon, 16 Dec 2024 02:03:53 +0000, Stefan Kangas <stefankangas@gmail.com> said:

    Stefan> I see the below test failure when running with a VPN enabled on macOS.
    Stefan> It fails predictably every time, but when I disable the VPN, the test
    Stefan> passes.

    Stefan> Looking into it, it seems like it's this call that leads to the
    Stefan> backtrace:

    Stefan>     (nsm-should-check "localhost")

    Stefan> However, when edebugging `nsm-should-check` and step through the code, I
    Stefan> do not get a backtrace, and it correctly returns t.

    Stefan> Any ideas for how to continue debugging this?

`printf' (or in this case `message') is your friend :-)

I suspect `network-interface-list' is returning unexpected values
because of the VPN, but Iʼd check `network-lookup-address-info' as well

Robert
--