microsoft / dev-proxy

Dev Proxy is an API simulator that helps you effortlessly test your app beyond the happy path.
https://aka.ms/devproxy
MIT License
481 stars 56 forks source link

Bug: Linux setup script broken when you don't specify a version #808

Closed waldekmastykarz closed 3 months ago

waldekmastykarz commented 3 months ago

When you try to install Dev Proxy on Linux using the setup script, you get the following error:

Archive:  ./devproxy.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of ./devproxy.zip or
        ./devproxy.zip.zip, and cannot find ./devproxy.zip.ZIP, period.

The same script works fine when you specify a version to install.

The issue is caused by incorrectly detecting if a version has been passed through command line args: https://github.com/microsoft/dev-proxy/blob/4d802c1b63b05d4aa80cecf562466b5f1e772e0b/scripts/setup.sh#L45-L52

If no version has been passed, $0 is set to bash which makes the setup script think a version has been passed after all.

Repro

bash -c "$(curl -sL https://aka.ms/devproxy/setup.sh)"