bindl-dev / bindl

Project-defined static binary manager.
https://bindl.dev
Apache License 2.0
7 stars 0 forks source link

`bindl get <>` panics on segfault #72

Open chrisyxlee opened 2 years ago

chrisyxlee commented 2 years ago

Steps

❯ make bin/ko
bindl get ko
bin/.bindl/programs/d459221a402aa3047e5ed27db76bb669ae958588e6fde0ed7fcf2d84ff19a9fd-ko/ko

❯ make bin/kind
make: `bin/kind' is up to date.

❯ make bin/ko
make: `bin/ko' is up to date.

❯ make bin/terraform
bindl get terraform
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x10 pc=0x100556024]

goroutine 36 [running]:
github.com/bindl-dev/bindl/command.Get({0x1006ba150, 0x14000098680}, 0x1008e81a0, 0x140001c43c0)
        github.com/bindl-dev/bindl/command/get.go:68 +0xa4
github.com/bindl-dev/bindl/command.IterateLockfilePrograms.func2(0x0?)
        github.com/bindl-dev/bindl/command/command.go:52 +0x50
created by github.com/bindl-dev/bindl/command.IterateLockfilePrograms
        github.com/bindl-dev/bindl/command/command.go:51 +0x188
make: *** [bin/terraform] Error 2

Relevant information

❯ bindl version
version: 0.0.5 (go1.18)
commit: 4b5fba05cd01309ca791844d65e97a3309b7ec0d
date: 2022-04-12T20:40:55Z
❯ ls bin/.bindl/programs
1c265a1ccd92ff1d9767731a8431bcc0fecb7e633a5cec8b950ecb6a777f03c4-kn
a478eb4a6a88a8e3de9dd2e97c1fb96ca7a65c74525f2e132e6a5b333803f7c8-ytt
24f76cfcd464793e5d5fc930924586baff52232206ae2a9040467f802a95d1fc-golangci-lint
d459221a402aa3047e5ed27db76bb669ae958588e6fde0ed7fcf2d84ff19a9fd-ko
98d0f29fbde2154c64653aff81e6d0b9faea5001c5e29ce80ecfb9f67810197b-kind
fda2f5a5b7283c5545221ff8fd245a1c8bd7b5584c8eef94f2a68bf30d3fa833-terraform
bindl.yaml

platforms:
  linux:
    - amd64
    - arm64
  darwin:
    - amd64
    - arm64

_uname: &uname
  OS: &uname_OS
    linux: Linux
    darwin: Darwin
  Arch: &uname_Arch
    amd64: x86_64

programs:

  - name: golangci-lint
    version: 1.45.2
    provider: github
    paths:
      base: golangci/golangci-lint
      target: '{{ .Name }}-{{ .Version }}-{{ .OS }}-{{ .Arch }}.tar.gz'
      checksums:
        artifact: '{{ .Name }}-{{ .Version }}-checksums.txt'

  # kind is a tool for running local Kubernetes clusters using Docker container
  # 'nodes'.
  # https://kind.sigs.k8s.io/
  - name: kind
    version: 0.12.0
    provider: github
    paths:
      base: kubernetes-sigs/kind
      target: '{{ .Name }}-{{ .OS }}-{{ .Arch }}'
      checksums:
        artifact: '{{ .Name }}-{{ .OS }}-{{ .Arch }}.sha256sum'

  # ko is a simple, fast container image builder for Go applications.
  # https://github.com/google/ko
  - name: ko
    provider: github
    version: 0.11.2
    overlay:
      OS:
        linux: Linux
        darwin: Darwin
      Arch:
        amd64: x86_64
    paths:
      base: google/ko
      target: '{{ .Name }}_{{ .Version }}_{{ .OS }}_{{ .Arch }}.tar.gz'
      checksums:
        artifact: checksums.txt

  # Knative is an Open-Source Enterprise-level solution to build Serverless and
  # Event Driven Applications.
  # https://knative.dev/docs/
  # https://github.com/knative/client
  - name: kn
    provider: url
    version: 1.3.1
    paths:
      base: 'https://github.com/knative/client/releases/download/knative-v{{ .Version }}'
      target: '{{ .Name }}-{{ .OS }}-{{ .Arch }}'
      checksums:
        artifact: checksums.txt

  # Terraform is a tool that applies infrastructure changes idempotently and
  # allows people to concurrently work on infrastructure resources.
  # https://www.terraform.io/
  - name: terraform
    version: 1.1.8
    provider: url
    paths:
      base: 'https://releases.hashicorp.com/terraform/{{ .Version }}/'
      target: '{{ .Name }}_{{ .Version }}_{{ .OS }}_{{ .Arch }}.zip'
      checksums:
        artifact: '{{ .Name }}_{{ .Version }}_SHA256SUMS'

  # ytt (pronounced spelled out) is a templating tool that understands YAML
  # structure. It helps you easily configure complex software via reusable
  # templates and user provided values.
  # https://github.com/vmware-tanzu/carvel-ytt
  - name: ytt
    provider: github
    version: 0.40.1
    paths:
      base: vmware-tanzu/carvel-ytt
      target: '{{ .Name }}-{{ .OS }}-{{ .Arch }}'
      checksums:
        artifact: checksums.txt
.bindl.lock

programs:
- checksums:
    golangci-lint-1.45.2-darwin-amd64.tar.gz:
      archive: 995e509e895ca6a64ffc7395ac884d5961bdec98423cb896b17f345a9b4a19cf
      binary: 32f233a3213bf48025bae4af1a41482535454dc9a906daf6df66d4c3c366ca19
    golangci-lint-1.45.2-darwin-arm64.tar.gz:
      archive: c2b9669decc1b638cf2ee9060571af4e255f6dfcbb225c293e3a7ee4bb2c7217
      binary: 24f76cfcd464793e5d5fc930924586baff52232206ae2a9040467f802a95d1fc
    golangci-lint-1.45.2-linux-amd64.tar.gz:
      archive: 595ad6c6dade4c064351bc309f411703e457f8ffbb7a1806b3d8ee713333427f
      binary: 700869bf9234e808ddecf7666cf362747cd94f7679f4d2a125bbff54f2daeb22
    golangci-lint-1.45.2-linux-arm64.tar.gz:
      archive: 1463049b744871168095e3e8f687247d6040eeb895955b869889ea151e0603ab
      binary: f6ea84deab5752583497b77e22e7e0a93c674edf043b341228ba6c030c17585d
  name: golangci-lint
  paths:
    base: https://github.com/golangci/golangci-lint/releases/download/v{{ .Version }}/
    checksums:
      artifact: https://github.com/golangci/golangci-lint/releases/download/v{{ .Version }}/{{ .Name }}-{{ .Version }}-checksums.txt
    target: '{{ .Name }}-{{ .Version }}-{{ .OS }}-{{ .Arch }}.tar.gz'
  version: 1.45.2
- checksums:
    kind-darwin-amd64:
      archive: 969d607a4eb5df20e1ea3841813b7869614235f6b1644c9a27700bff9de5bdfc
      binary: 969d607a4eb5df20e1ea3841813b7869614235f6b1644c9a27700bff9de5bdfc
    kind-darwin-arm64:
      archive: 98d0f29fbde2154c64653aff81e6d0b9faea5001c5e29ce80ecfb9f67810197b
      binary: 98d0f29fbde2154c64653aff81e6d0b9faea5001c5e29ce80ecfb9f67810197b
    kind-linux-amd64:
      archive: b80624c14c807490c0944d21fdc9c3455d6cc904fad486fe236f2187ecaa5789
      binary: b80624c14c807490c0944d21fdc9c3455d6cc904fad486fe236f2187ecaa5789
    kind-linux-arm64:
      archive: 26c16a8ec90e2a3a42f2f8e1c7139b69769ce1011e7a314cb4ae86345e6363bd
      binary: 26c16a8ec90e2a3a42f2f8e1c7139b69769ce1011e7a314cb4ae86345e6363bd
  name: kind
  paths:
    base: https://github.com/kubernetes-sigs/kind/releases/download/v{{ .Version }}/
    checksums:
      artifact: https://github.com/kubernetes-sigs/kind/releases/download/v{{ .Version }}/{{ .Name }}-{{ .OS }}-{{ .Arch }}.sha256sum
    target: '{{ .Name }}-{{ .OS }}-{{ .Arch }}'
  version: 0.12.0
- checksums:
    kn-darwin-amd64:
      archive: 96fc0ac7442bd5cc3b2cded41e4860508ec8862030eef1e8608f9fd422adabbe
      binary: 96fc0ac7442bd5cc3b2cded41e4860508ec8862030eef1e8608f9fd422adabbe
    kn-darwin-arm64:
      archive: 1c265a1ccd92ff1d9767731a8431bcc0fecb7e633a5cec8b950ecb6a777f03c4
      binary: 1c265a1ccd92ff1d9767731a8431bcc0fecb7e633a5cec8b950ecb6a777f03c4
    kn-linux-amd64:
      archive: 313f45643e1b16731db405775841cbfe837c0d0be7f1faf18a31593210c5ce1b
      binary: 313f45643e1b16731db405775841cbfe837c0d0be7f1faf18a31593210c5ce1b
    kn-linux-arm64:
      archive: dc68ad85516b205943a0de4dd79cadbef2851c2640aa84d274a58d13e668345c
      binary: dc68ad85516b205943a0de4dd79cadbef2851c2640aa84d274a58d13e668345c
  name: kn
  paths:
    base: https://github.com/knative/client/releases/download/knative-v{{ .Version }}/
    checksums:
      artifact: https://github.com/knative/client/releases/download/knative-v{{ .Version }}/checksums.txt
    target: '{{ .Name }}-{{ .OS }}-{{ .Arch }}'
  version: 1.3.1
- checksums:
    ko_0.11.2_Darwin_arm64.tar.gz:
      archive: 02acfe3bc856805c25d65bb620e414b98aa504c6194ff8e953ce169edfcc03c6
      binary: d459221a402aa3047e5ed27db76bb669ae958588e6fde0ed7fcf2d84ff19a9fd
    ko_0.11.2_Darwin_x86_64.tar.gz:
      archive: 5e95f6be71bd47b5cc3517de83af254209cb914e4f854c9391e8f993f4003f90
      binary: 0345be9e8b85192cd548ef61df92b8acfa666d4a173081b5c27fa91f1c770cad
    ko_0.11.2_Linux_arm64.tar.gz:
      archive: 48c1d4a7eabdf583dfc1640ca5087f00a6b5bfdd1ac9400c14e7affb2c2d3fbb
      binary: 6b5e376b5d2ff5fe09d5b3fe93375aafefdb53f36453986a2a3a398c90c382bd
    ko_0.11.2_Linux_x86_64.tar.gz:
      archive: afb5dacb44bfeafdc53c6de03d9ff74f4a6003c5617381d3139038aa25f3fb66
      binary: 7f85590cf718c18b41263ecae611f32f01891c7e786389f441672ec9da788f27
  name: ko
  overlay:
    Arch:
      amd64: x86_64
    OS:
      darwin: Darwin
      linux: Linux
  paths:
    base: https://github.com/google/ko/releases/download/v{{ .Version }}/
    checksums:
      artifact: https://github.com/google/ko/releases/download/v{{ .Version }}/checksums.txt
    target: '{{ .Name }}_{{ .Version }}_{{ .OS }}_{{ .Arch }}.tar.gz'
  version: 0.11.2
- checksums:
    terraform_1.1.8_darwin_amd64.zip:
      archive: 29ad0af72d498a76bbc51cc5cb09a6d6d0e5673cbbab6ef7aca57e3c3e780f46
      binary: d66cfdcdd21945118cf0b4c9d77352b697c7e849be2e641a9b833c8d86f83028
    terraform_1.1.8_darwin_arm64.zip:
      archive: d6fefdc27396a019da56cce26f7eeea3d6986714cbdd488ff6a424f4bca40de8
      binary: fda2f5a5b7283c5545221ff8fd245a1c8bd7b5584c8eef94f2a68bf30d3fa833
    terraform_1.1.8_linux_amd64.zip:
      archive: fbd37c1ec3d163f493075aa0fa85147e7e3f88dd98760ee7af7499783454f4c5
      binary: 9b87348dcca11241b41f0a683e93369c99adfb2b0630f228303a6d77dbecfd60
    terraform_1.1.8_linux_arm64.zip:
      archive: 10b2c063dcff91329ee44bce9d71872825566b713308b3da1e5768c6998fb84f
      binary: d53e25607064d9e26e847c5bdccca747396b5acabb067993a794b8bbd7d9d690
  name: terraform
  paths:
    base: https://releases.hashicorp.com/terraform/{{ .Version }}/
    checksums:
      artifact: https://releases.hashicorp.com/terraform/{{ .Version }}/{{ .Name }}_{{ .Version }}_SHA256SUMS
    target: '{{ .Name }}_{{ .Version }}_{{ .OS }}_{{ .Arch }}.zip'
  version: 1.1.8
- checksums:
    ytt-darwin-amd64:
      archive: d46dba5e729e2fe36c369e96eaa2eb5354fb1bf7cf9184f9bfa829b8e5558b94
      binary: d46dba5e729e2fe36c369e96eaa2eb5354fb1bf7cf9184f9bfa829b8e5558b94
    ytt-darwin-arm64:
      archive: a478eb4a6a88a8e3de9dd2e97c1fb96ca7a65c74525f2e132e6a5b333803f7c8
      binary: a478eb4a6a88a8e3de9dd2e97c1fb96ca7a65c74525f2e132e6a5b333803f7c8
    ytt-linux-amd64:
      archive: 11222665c627b8f0a1443534a3dde3c9b3aac08b322d28e91f0e011e3aeb7df5
      binary: 11222665c627b8f0a1443534a3dde3c9b3aac08b322d28e91f0e011e3aeb7df5
    ytt-linux-arm64:
      archive: c5d2f033b375ee87414b51d16c324d7a441de2f256865b5c774c4d5aea30ef60
      binary: c5d2f033b375ee87414b51d16c324d7a441de2f256865b5c774c4d5aea30ef60
  name: ytt
  paths:
    base: https://github.com/vmware-tanzu/carvel-ytt/releases/download/v{{ .Version }}/
    checksums:
      artifact: https://github.com/vmware-tanzu/carvel-ytt/releases/download/v{{ .Version }}/checksums.txt
    target: '{{ .Name }}-{{ .OS }}-{{ .Arch }}'
  version: 0.40.1
wilsonehusin commented 2 years ago

This seems to be the offending line:

https://github.com/bindl-dev/bindl/blob/4b5fba05cd01309ca791844d65e97a3309b7ec0d/command/get.go#L68

Which, shouldn't happen? I'm not sure what's going on 🤔

wilsonehusin commented 2 years ago

I just ran into this problem myself because I was accidentally running amd64 variant of bindl in M1 (arm64). bindl was looking for darwin/amd64 platform when my .bindl-lock.yaml only has darwin/arm64, thus the panic.