Skip to content

dotnet-install script causes shell to exit #25

Closed

Description

@JohnRusk

Steps to reproduce

  1. Create an Ubuntu 16.04 VM in Azure
  2. Run the following:
  • wget https://dot.net/v1/dotnet-install.sh
  • chmod 700 dotnet-install.sh
  • source dotnet-install.sh --shared-runtime --version 1.1.2

Expected behavior

A message is displayed about missing dependencies (libuwind8 etc)

Actual behavior

It just exits my shell. Unless its a subshell, this results in my whole terminal window just closing.

Workaround

Install all the dependencies first, with sudo apt-get install curl libunwind8 gettext apt-transport-https

Activity

  1. ghost closed this as completedon Sep 14, 2017
  2. omajid commented on Sep 14, 2017

    @omajid
    Member

    @johnbeisner The reporter mentioned that they only see this when the script fails - for example, when dependencies are missing.

    The bug seems very real to me. I can reproduce it on my system too. Here is one way to see the error:

    source ./scripts/obtain/dotnet-install.sh --runtime-id fedora.26-x64
    

    (But source ./scripts/obtain/dotnet-install.sh --runtime-id fedora.24-x64 will work)

    More interestingly, even if the script works, what happens when you run false after sourcing the script?

    The script does set -e but never set +e. When the script is sourced, this leaks into the shell. Now any user command that fails will cause the shell to exit.

    Here is a smaller reproducer for the issue:

    #!/bin/bash
    set -e
    false
    

    If you save this as exit-on-source and then do a source ./exit-on-source, your shell will exit.

  3. ghost reopened this on Sep 14, 2017
  4. masaeedu commented on Sep 20, 2017

    @masaeedu

    @johnbeisner I'm seeing this on Powershell as well. You can trivially reproduce it by running docker run -it --rm microsoft/dotnet-framework powershell, then run iwr -UseBasicParsing https://dot.net/v1/dotnet-install.ps1 | iex. This will end up killing the docker container. You can work around it by opening a sacrificial subshell, but then the path modifications are lost.

  5. JohnRusk commented on Oct 4, 2017

    @JohnRusk
    Author

    Just a note of another side effect of this issue. The scripts recently started checking another dependency (libcurl). For the users of my app, I'd written up instructions on how to install the necessary prerequisites. Now, there was a new prerequisite, not listed in my instructions. So bang!, the dotnet install script exited and closed their shell.

    In other words, this issue magnifies the effect of any other change or problem that may be introduced to the script.

  6. Repository owner unassigned on Dec 23, 2019
  7. transferred this issue fromdotnet/clion Jan 31, 2020
  8. transferred this issue fromdotnet/sdkon May 19, 2020
  9. donJoseLuis commented on May 28, 2020

    @donJoseLuis
    Contributor

    @JohnRusk greetings. The side effect issue you mentioned is tracked in #36

    Problem summary:

    • when the scripts (either PS1 or SH) run into trouble the container is killed
  10. self-assigned this
    on Nov 5, 2020
  11. vlada-shubina commented on Nov 16, 2020

    @vlada-shubina
    Member

    We agreed not to fix the error handling when sourcing dotnet-install.sh script at the moment as it requires a lot of efforts for changing the error handling. As the workaround, the script can be launched in the subshell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions