makem.sh
makem.sh copied to clipboard
MacOS woes
The script works fine on Github actions, but I cannot get it to work locally. I get Invalid rule: ./makem.sh, and the coloring doesn't work either.
When I just run make or ./makem.sh, I get the following output
\e[0;31mERROR (2020-04-03 11:48:54): Invalid rule: ./makem.sh\e[0m
\e[0;31mERROR (2020-04-03 11:48:54): Invalid rule: -o\e[0m
\e[0;31mERROR (2020-04-03 11:48:54): Invalid rule: dhe:E:i:s::vf:CO\e[0m
\e[0;31mERROR (2020-04-03 11:48:54): Invalid rule: -l\e[0m
\e[0;31mERROR (2020-04-03 11:48:54): Invalid rule: exclude:,emacs:,install-deps,install-linters,debug,debug-load-path,help,install:,verbose,file:,no-color,no-compile,no-org-repo,sandbox::\e[0m
\e[0;31mERROR (2020-04-03 11:48:54): Invalid rule: --\e[0m
\e[0;31mLOG (2020-04-03 11:48:54): Finished with 6 errors.\e[0m
make: *** [init] Error 6
I use MacOS Mojave, Zsh with Oh My Zsh configs and Emacs version 27.0.50.
I see terminal control characters in your output. I would say that one of these is your problem:
I use MacOS Mojave, Zsh with Oh My Zsh configs
@buggaarde See also https://github.com/alphapapa/restic-runner#macos. This seems to be a common issue on MacOS.
@alphapapa It seems that MacOS just has a hard time with this shell script.
What you suggested in your link fixed the problem which I posed in the title, by using gnu getopt instead of the version that comes with MacOS.
I also had to use gsed instead of sed, since that was also giving me problems.
Now I'm stuck with an error in the lowercasing of test_name on line 555's ${test_name,,}, that seems to be a Bash 4.0 feature. And as I can tell, MacOS doesn't come with an up-to-date version of Bash. So that will have to be installed, and used, as well.
It's probably easier to run the tests inside a Docker container.
MacOS has a hard time with many things because Apple refuses to use up-to-date versions of standard tools, including, as you noticed, Bash. I'm frequently asked to add workarounds for these problems in my code, but I usually decline to burden my projects with hacks to work around Apple's stubbornness and disinterest in user freedom. (If that makes me sound like a FOSS zealot to some people, so be it, but I'm relatively mild about it.) Sometimes I will add a small note in the documentation if other users can confirm simple workarounds, but other than that, I can only recommend that users use standard, Free tools and platforms. I hope you understand. Thanks for reporting these issues; I can't discover them myself since I don't use a Mac.
No problem. I really appreciate the attention to these problems, even though it's not your tool that has any issues.
I'm gonna try to make the script work. When I do, do you want to include the steps in your docs, or do you have something else in mind with the 'help wanted'-tag?
Yes, if you could propose a simple addition to the documentation, similar to the one on the restic-runner readme file, that would be great. Thanks.
\e[0;31mERROR
The color is not displayed, It's because the preinstalled bash on macOS doesn't support indirect expansion:
$ /bin/bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.
I workaround the issue with brew install bash.
I am using latest bash version, but still my colors where broken. Turned out, getopt was the cultprit. Thanks for the suggestion.
My solution is to use Docker, I've put my setup up here: https://gist.github.com/jscheid/84af350a6115067c92c0181cbb94810b
Aside from letting you use makem on MacOS (without having to jump through hoops) it also gives you a known-good, always-fresh environment to run your tests in.
@alphapapa perhaps you would even want to add these files to your package?
I workaround the issue with brew install bash.
An alternative way to get a recent version of bash would be Nix. It can be used to install nix-emacs-ci as well, which would be useful if you want to use a different version of Emacs for testing.
@alphapapa perhaps you would even want to add these files to your package?
@jscheid Thanks, that looks very interesting. It would make it easy to test in different versions of Emacs locally. I'll consider adding those files or mentioning them in the readme. :)