Comments (9)
@chu11 thank you for this issue.
I think it should work if you use make SHELL_PATH=/bin/sh test
instead of make test
.
It is also more flexible to not hardcode /bin/sh
. And on some platform /bin/sh
might be too old or not as feature complete as we need.
What could be done is to detect when the current shell is not appropriate and if that is the case to suggest using something like make SHELL_PATH=/bin/sh test
instead of make test
.
from sharness.
This can be closed now. My patch (0dddcc9) was merged in 2019.
from sharness.
@chriscool That seems like a good idea, to simply just warn the user if bourne shell isn't used. I think the main issue for me was just seeing tons of failures of 'make test' and not sure what to make of it.
from sharness.
which shell does sharness depend on anyways? sh or bash?
from sharness.
Sharness should work with most sh compatible shells. There are no strict rules, but there are some guidelines about what can be used in the Git documentation:
https://github.com/git/git/blob/master/Documentation/CodingGuidelines
from sharness.
so i guess the question is whether it does work with ash or dash. did anyone test that?
switching to /bin/sh can have pretty bad consequences where that shell is not bash, if there are bashisms in the code. this would need to be tested explicitly, IMHO.
from sharness.
On Ubuntu machines /bin/sh is dash and it works. I don't know about ash, but when reviewing PRs I take care about not accepting bashisms.
About testing this, yeah we could use https://www.shellcheck.net/ as it detects bashisms.
from sharness.
The code code from Git's test-lib where all the code is supposed to be POSIX compatible, so there really is no need to discuss which shell to use; it's /bin/sh
.
--- a/sharness.sh
+++ b/sharness.sh
@@ -51,7 +51,7 @@ export SHARNESS_TEST_SRCDIR
export SHARNESS_ORIG_TERM
# Export SHELL_PATH
-: "${SHELL_PATH:=$SHELL}"
+: "${SHELL_PATH:=/bin/sh}"
export SHELL_PATH
# if --tee was passed, write the output not only to the terminal, but
Git also defaults to /bin/sh
.
Now, if for some reason you want to use a different shell, just do: make SHELL_PATH=/bin/zsh test
, and you can be happy knowing that you made everything fail.
However, defaulting to currently running shell is certainly one of the worse choices to make.
from sharness.
See: https://github.com/git/git/blob/master/Documentation/CodingGuidelines#L1-L19 for how Git handles POSIX compatibility.
I tend to agree with @felipec 's patch and plan to merge his merge request (#93).
We use https://www.shellcheck.net/ to detect bashisms and avoid potential compatibility isues now by the way.
So I think I will close this issue when merging @felipec 's patch.
from sharness.
Related Issues (20)
- add --tee option from git test-lib.sh HOT 1
- sharness.sh is executable? HOT 3
- Release tarballs are not signed HOT 4
- Clarify purpose of "aggregate-results.sh" HOT 12
- Cleanup actions are only run if no tests failed HOT 8
- Additional test function for string comparison? HOT 5
- Document usage of "trash" directory HOT 2
- Document how to release a new Sharness version HOT 2
- Line feed regression HOT 3
- Lots of dangling branches HOT 2
- SHARNESS_TEST_SRCDIR and extensions HOT 3
- Sharness self-test fails HOT 2
- Can't locate object method "follower" via package "IO::Pty"
- test_expect_failure test 2 = 2 does not fail with prove HOT 4
- trash dir as home dir when run on Windows HOT 1
- testing scripts with sourced functions HOT 1
- Make a release v1.2 HOT 1
- Usage with `prove` would need more documentation HOT 6
- Calling functions from Git submodule fails with v1.2.0 release (Regression) HOT 8
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 sharness.