arturo-lang / arturo

Simple, expressive & portable programming language for efficient scripting
http://arturo-lang.io
MIT License
673 stars 29 forks source link

Bash script to install nightly does not work #1644

Open ErikSchierboom opened 1 month ago

ErikSchierboom commented 1 month ago

Describe the bug The getting started guide suggest using the following bash script to install the latest nightly:

curl -sSL https://get.arturo-lang.io/latest | sh

To Reproduce Steps to reproduce the behavior:

  1. Run curl -sSL https://get.arturo-lang.io/latest | sh
  2. See error
erik@schierheim:~/exercism$ curl -sSL https://get.arturo-lang.io/latest | sh
======================================

               _
              | |
     __ _ _ __| |_ _   _ _ __ ___
    / _` | '__| __| | | | '__/ _ \
   | (_| | |  | |_| |_| | | | (_) |
    \__,_|_|   \__|\__,_|_|  \___/

     Arturo Programming Language
      (c)2023 Yanis Zafirópulos

======================================
 ► Installer
======================================

 ● Checking environment...
   os: x86_64-linux
   shell: bash

 ● Checking prerequisites...
   2 packages can be upgraded. Run 'apt list --upgradable' to see them.

 ● Downloading...curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
tar (child): /tmp/tmp.COQGG5lfVc/arturo.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

 ● Installing...cp: cannot stat '/tmp/tmp.COQGG5lfVc/arturo': No such file or directory

 ● Cleaning up...

 ● Done!

 :---------------------------------------------------------
 : Arturo has been successfully installed!
 :
 : To be able to run it,
 : first make sure its in your $PATH:
 :
 :    export PATH=/home/erik/.arturo/bin:$PATH
 :
 : and add it to your ~/.bashrc or ~/.profile,
 : so that it's set automatically every time.
 :
 : Rock on! :)
 :---------------------------------------------------------

Expected behavior I would have expected the nightly version to be installed. As the file could not be downloaded, I would also expect this to be acknowledged by the script and not print the "Arturo has been successfully installed!" message :)

Desktop (please complete the following information):

github-actions[bot] commented 1 month ago

Thank you for submitting an issue! :)

drkameleon commented 1 month ago

Good catch!

The truth is I haven't looked into this script for quite some time, but I guess it should be prioritized ahead of the upcoming release.

Could also be fixed along with this suggestion of yours here 😉


@RickBarretto Hadn't we fixed this at some point? Or am I totally mistaken? I honestly don't remember... lol

RickBarretto commented 1 month ago

I thought this too. I'll have a look on this.

We are so much time without touching this script.

I guess, we need to add tests to this too.

RickBarretto commented 1 month ago

image image

Well, it seems that this script suffered with some regression. I remember my first contribution being add support for MSYS2, and this seems not to be working on Terminal nor MSYS2.


Updates

I discovered why, this is just installing for Linux and Mac on x86 architecture. None of us are using it. Look:

For stable and latest image

ErikSchierboom commented 1 month ago

I discovered why, this is just installing for Linux and Mac on x86 architecture. None of us are using it.

@RickBarretto But WSL is x86_64 on Linux. It should behave like any other Linux distro. Maybe the detection is wrong?

RickBarretto commented 1 month ago

But WSL is x86_64 on Linux. It should behave like any other Linux distro. Maybe the detection is wrong?

@ErikSchierboom That is the point. Probably the WSL would work fine, but I'm using MSYS2. Unfortunately WSL is to heavy for my laptop, so I don't use it.

ErikSchierboom commented 1 month ago

I'll have a look

ErikSchierboom commented 1 month ago

@RickBarretto Seems like this is a general issue with using sh on Ubuntu: https://kinoshita.eti.br/2016/11/05/checking-the-operating-system-type-in-shell-script.html

Nope, that is not the issue :)

ErikSchierboom commented 1 month ago

I think the actual issue is this grep part: grep "browser_download_url.*${1}" in this command:

downloadUrl=$(curl -s https://api.github.com/repos/arturo-lang/$REPO/releases | grep "browser_download_url.*${1}" | cut -d : -f 2,3 | tr -d \" | head -1)

If I download curl -L -O https://get.arturo-lang.io/latest, that file is different from https://github.com/arturo-lang/arturo-lang.io/blob/main/installer/nightly.sh, which does work. Maybe the redirect points to the wrong file?

https://api.github.com/repos/arturo-lang/nightly/releases

RickBarretto commented 1 month ago

@ErikSchierboom , thanks a lot for your help.

Just for reference, I read this issue again and I noticed you are using the WSL, I thought this was the new Macs ARM. My bad.

Thanks for sending this news, and also the grep issue.

I'll have a look on it when I come home. :wink:

RickBarretto commented 1 month ago

Well, the commands itself are right... I just ran it manually:

image

This seems like the script is right, but well, this is installing only for Linux amd64. So, anyway, this will need some update very soon.

RickBarretto commented 1 month ago

What I'll need to check is this:

tar (child): /tmp/tmp.COQGG5lfVc/arturo.tar.gz: Cannot open: No such file or directory

Probably the temporary-directory creator is broken. I'm not sure if I can actually test it, since I don't know if MSYS2 has the same behavior for temp folders. But anyway, I'll try this later and keep you updated. 😉

ErikSchierboom commented 1 month ago

I still think the problem is with the script download somehow. See:

erik@schierheim:~/exercism$ curl -sSL https://get.arturo-lang.io/latest | grep 'currentOS="Linux"'
erik@schierheim:~/exercism$ curl -sSL https://raw.githubusercontent.com/arturo-lang/arturo-lang.io/main/installer/nightly.sh | grep 'currentOS="Linux"'
        linux*)     currentOS="Linux" ;;
        linux-gnu*) currentOS="Linux" ;;
                currentOS="Linux"

I've ran the following on both my mac, WSL machine and some random server on the internet, all with the same result (/latest) not returning the right version. Maybe someone else can check too?

RickBarretto commented 1 month ago

I'll have a look. I think this is time to a rewrite. We have some problems with those scripts.

1st, to get the download link, this is using head -1, but if the order changes, everything breaks. 2nd, latest and nightly does the same thing, only changing one variable. This means that any change on the code must reflect in the other one.