question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tools/download.sh exit conditions broken

See original GitHub issue

Every instance of exit 2 >&2 "message here" should be replaced with:

>&2 echo "message here"
exit 2

The former does not work, and does not exit either, because exit is called with too many arguments. This then leads to odd failure conditions later in the script.

Patch for tools.sh follows:

diff --git a/tools/download.sh b/tools/download.sh
index e37acf8..0617985 100755
--- a/tools/download.sh
+++ b/tools/download.sh
@@ -27,18 +27,22 @@ case "$OSTYPE" in
                         version=ubuntu1.16.04.1_amd64.deb
                         ;;
                     *)
-                        exit 2 >&2 "Ubuntu $VERSION_ID is not supported!"
+                        >&2 echo "Ubuntu $VERSION_ID is not supported!"
+                        exit 2 
                 esac
                 ;;
             *)
-                exit 2 >&2 "$NAME is not supported!"
+                >&2  echo "$NAME is not supported!"
+                exit 2 
+                ;;
         esac
         ;;
     darwin*)
         version=pkg
         ;;
     *)
-        exit 2 >&2 "$OSTYPE is not supported!"
+        >&2 echo "$OSTYPE is not supported!"
+        exit 2 
         ;;
 esac

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
tiduxcommented, Aug 19, 2016

This might need its own issue, but seems related: build.psm1 is chock full of hard coded distribution checks, which is causing build failures on Arch Linux (PowerShell itself runs fine with freshly built files from the dotnet-cli package from the AUR dropped in to the /opt/microsoft/powershell-foo directory) and will act as a significant blocker for bootstrapping on Alpine, Debian, or any other distribution not already listed.

This is inefficient, awkward, and wrongheaded. An upstream build system like PowerShell’s should focus on building the executables and libraries needed, and possibly include an installation makefile/psbuild target to drop them into a relative directory.

Let the distributions’ package management teams take advantage of that relative-directory installation target and handle packaging themselves. I guarantee they’ll do a better job than Microsoft will, judging by the inadequate code quality in all the Unix-native stuff like build.sh so far. Even Valve recognizes the benefit their platform receives from allowing binary redistribution and repackaging of the Steam application for Linux. The only reason to not delegate packaging to the distributions is if Microsoft was planning on taking PowerShell so proprietary that even binary redistribution is banned.

That’s not anything we have to worry about, RIGHT?

0reactions
tiduxcommented, Aug 19, 2016

For the curious:

$ bash --version
GNU bash, version 4.3.46(1)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Exit sh script if condition is met
I have a sh-script which should get the number of lines on a specific file; the whole sh script should be exit/stopped as...
Read more >
In a Bash script, how can I exit the entire script if a certain ...
Try this statement: exit 1. Replace 1 with appropriate error codes. See also Exit Codes With Special Meanings.
Read more >
How to stop the bash script when a condition fails?
I am trying to stop a script execution if a certain condition fails,. e.g. false || echo "Obvious error because its false on...
Read more >
ssh and shell through ssh : how to exit? - bash
Everything is going fine but once the script is finished, the connection is not closed. I Have to press CTRL-C to break the...
Read more >
Android Debug Bridge (adb) | Android Studio
Find out about the Android Debug Bridge, a versatile command-line tool that lets you communicate with a device.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found