-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Use correct shebangs on .sh files #16825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
lgtm |
|
Here are the remaining warnings in the bash-using files: |
contrib/commit-name.sh
Outdated
| #!/bin/sh | ||
| # This file is a part of Julia. License is MIT: http://julialang.org/license | ||
|
|
||
| last_tag=$(git describe --tags --abbrev=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not part of this issue/pr, but the next line really shouldn't say 0.4.0-dev any more. @yuyichao did you not port the improved Compat.jl version back to contrib?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't even aware of this script .....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use find to see all scripts.
$ cd julia
$ find . -name "*.sh"
./contrib/prepare_release.sh
./contrib/fixup-libstdc++.sh
./contrib/commit-name.sh
./contrib/fixup-libgfortran.sh
./contrib/filterArgs.sh
./contrib/travis_fastfail.sh
./contrib/install.sh
./contrib/mac/app/run-install-name-tool-change.sh
./contrib/mac/mac-gtk.sh
./contrib/windows/get_toolchain.sh
./contrib/windows/msys_build.sh
./contrib/windows/winrpm.sh
./contrib/relative_path.sh
./contrib/check-whitespace.sh
./src/flisp/bootstrap.sh
./test/perf/micro/java/setup.sh
./base/version_git.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git ls-files '*.sh' is a better bet, as otherwise you'll pick up scripts from dependencies
|
base/version_git.sh is missing a #!/bin/sh on the first line. |
|
|
|
Done. I've also imported the changes to commit-name.sh from Compat.jl |
|
Scripts that still don't comply to standards and use bashisms:
Scripts that are portable:
|
|
Found a caveat on Mac specific code. https://github.com/JuliaLang/julia/blob/master/contrib/mac/app/Makefile#L43 It's not very important, but also won't harm, to use /bin/sh here too. Just so the source is clean from "bash" and people don't get encouraged to use it. For keeping scripts portable, I propose Travis automatically fails if a pull request has the word "bash" on it ;-) |
|
Or more realistically, set up CI for a system that doesn't have bash installed. We nominally support freebsd but I don't know who (if anyone) is regularly testing it lately, and I think because of these scripts you might need bash installed to build on freebsd anyway. oh, and a useful github trick - when linking to specific lines of code, hit |
|
I wouldn't worry about the mac code: bash is already installed on OS X. I think it's more important to have working scripts (with correct shebangs) than worry too much about working bash-free: e.g. I have no idea how one would write filterArgs.sh in pure sh. |
I think a CI for Alpine Linux would be perfect for this, since it has neither glibc or bash installed by default (it uses musl libc and busybox ash). This would solve 2 problems (finding glibc-specific unportable code and bashisms). Alpine is also one damn small distribution. |
It's possible https://wiki.ubuntu.com/DashAsBinSh but not without much longer code, additional dependencies on addition (yet "standard") tools and code that is much harder to understand. |
|
I guess we could call perl, since that is an official requirement, but that seems absurd. |
|
Problem solved. |
|
With #16829 I think contrib/install.sh becomes posix-compliant. Last script that doesn't comply to standards and use bashism is contrib/relative_path.sh |
|
Looks like this can be merged, all checks passed. |
|
#16827 means |
|
True, good catch. |
|
So the last remaining bashism is One of @simonair solutions is a POSIX shell function. It works with a variety of paths, but does not clean multiple slashes or resolve symlinks. Would that be a problem for Julia's case? If so, we could work from simonair's shell script and try to add that feature. There's also Jens solution, which is pretty cool. But I haven't tested it. Do you think we could use either one of these solutions? |
|
(moved to the right pr) |
|
@simonbyrne can you please revert changes to And with this PR (after reverting those 2 changes) we get everything else covered, except for |
|
#16827 and #16829 got merged and Now when this PR is merged (after changes to Nice. |
e8d9804 to
f4abb17
Compare
|
Updated. |
Switches shebangs that can safely use /bin/sh. Partially addresses #16819. Also updates commit-name.sh from Compat.jl
|
Great! I don't think we need to wait for Travis CI again, since this is the same patch minus changes to 2 files. Good to be merged. |
|
Are the shell scripts in |
Some of the shell files were using bash features with /bin/sh, others could have safely used /bin/sh. Now all .sh files pass
checkbashisms.Partially addresses #16819.