Skip to content

Go SSL segfault on nix darwin #27353

@robx

Description

@robx

Issue description

This is from the comments #18223 (which might be closed because go1.6 does build on darwin).

Go programs that use SSL segfault when neither SSL_CERT_FILE nor NIX_SSL_CERT_FILE environment variables are set.

I'm not sure about the impact of this and the whole story around {NIX_,}SSL_CERT_FILE, but it seems that the program shouldn't segfault, but error out at worst.

Steps to reproduce

Put the expression below (due to @zimbatm) in default.nix, run nix-build.

{ pkgs ? import <nixpkgs> {} }:
let
  inherit (pkgs) stdenv buildGoPackage;
in
  buildGoPackage {
    name = "foo";
    goPackagePath = "github.com/foo/bar";
    src = stdenv.mkDerivation {
      name = "foo-src";
      phases = [ "installPhase" ];
      installPhase = ''
        mkdir $out
        cat <<MAIN > $out/main.go
package main

import (
        "fmt"
        "net/http"
)

func main() {
        resp, err := http.Get("https://google.com/")
        fmt.Println("all good", resp, err)
}
MAIN
      '';
    };
  }

(or see https://gist.githubusercontent.com/zimbatm/8a67bd43242eaaed75924bd25e6fb5c6/raw/1537770e6db2d908fd524c4ff66caf2224e73139/default.nix)

Then run:

$ unset NIX_SSL_CERTFILE
$ unset SSL_CERTFILE
$ ./result-bin/bin/bar
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x144c05b]
...

Technical details

  • System: darwin 16.6.0
  • Nix version: 1.11.11
  • Nixpkgs version: 17.09pre110532.50831d543d
  • Sandboxing enabled: no

Metadata

Metadata

Assignees

No one assigned

    Labels

    6.topic: darwinRunning or building packages on Darwin
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions