Comments (2)
I think I've found the reason why it is failing, and it's failing on macOSX BigSur bash (GNU bash, version 3.2.57(1)-release (arm64-apple-darwin20)). MacOsX Bigsur is shipped with a really old version.
It seems that enabling errexit
Line 16 in fd6d94a
is making the script exit when
if ! command grep -qc 'GETMESH_HOME' "$detected_profile"; then
is executed . Even though it is a tested command (inside an if). A tested command, as per gnu bash documentation, is:
The shell does not exit if the command that fails is part of the command list immediately following a while or until keyword, part of the test in an if statement, part of any command executed in a && or || list except the command following the final && or ||
Extensive information about set -e
can be found at http://mywiki.wooledge.org/BashFAQ/105
which includes as well a reference to how subshells have propagated that flag https://www.in-ulm.de/~mascheck/various/set-e/
Possible Solutions
-
Use
set +e
before the problematicif
statement: I would discard that option because we will need to remember to set it back, and if the code branching changes over time it can be difficult to maintain it. -
Subshells. Seems like subshell does the trick because
set -e
is not propagated (maybe even by mistake). We can either:- extracting out the
grep
command and storing the count into a local variable:
local getmesh_home_count=$(command grep -c 'GETMESH_HOME' "$detected_profile") if [[ "$getmesh_home_count" -eq 0 ]];
- wrap the if command in parenthesis:
if ! (command grep -qc 'GETMESH_HOME' "$detected_profile"); then
- extracting out the
-
Remove
set -e
from the script as it seems problematic. I would suggest avoid that approach as it will make us to implement error handling manually at each command. Although it might be the best, I don't think it is worth the effort as this problem might only happen in concrete bash versions.
I will go ahead and create a PR for using the wrap if statement approach.
from getmesh.
thanks so much @toffentoffen for the thorough investigation!
I will go ahead and create a PR for using the wrap if statement approach.
agreed, thank you! 😄
from getmesh.
Related Issues (20)
- Unable to start up istio pilot pod using tetrate fips image HOT 4
- unable to find api field in struct meshConfigExtensionProvider for the json field "envoyOtelAls" - installing 1.13.3 HOT 1
- tetrateFIPS NIST certificate details? HOT 1
- Elaborate on how versioning works
- getmesh version: reports open source istio version under TID HOT 3
- v1.16.1 e2e tests failing
- Not able to download 1.17.0 tetratefips distroless flavor HOT 1
- Security Vulnerabilities in getmesh cli version 1.1.4 HOT 1
- Is it intend to remove the support of 1.16.2 ? HOT 1
- getmesh config-validate failing on fresh install
- Bump kiali dependency to the latest possible version HOT 3
- Bump golang.org/x/net and golang.org/x/net/http2 version to 0.0.0-20220906165146-f3363e06e74c HOT 3
- error fetching manifest: error unmarshalling fetched manifest: invalid character '<' looking for beginning of value HOT 1
- Fails to Wrap istioctl install when using the -f flag HOT 2
- Add 1.12.1 Support HOT 1
- Check upgrade should suggest how to upgrade
- getmesh command line fails with -f error HOT 1
- getmesh command to select a distroless image for install HOT 4
- Add ARM builds to getmesh HOT 2
- tetratefips distroless crash HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from getmesh.