You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(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.
@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.
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.
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.
Activity
omajid commentedon Sep 14, 2017
@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:
(But
source ./scripts/obtain/dotnet-install.sh --runtime-id fedora.24-x64will work)More interestingly, even if the script works, what happens when you run
falseafter sourcing the script?The script does
set -ebut neverset +e. When the script issourced, 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:
If you save this as
exit-on-sourceand then do asource ./exit-on-source, your shell will exit.masaeedu commentedon Sep 20, 2017
@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 runiwr -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.JohnRusk commentedon Oct 4, 2017
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.
donJoseLuis commentedon May 28, 2020
@JohnRusk greetings. The side effect issue you mentioned is tracked in #36
Problem summary:
vlada-shubina commentedon Nov 16, 2020
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.