-
Notifications
You must be signed in to change notification settings - Fork 8
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
macOS: ocrd-olena-binarize fails (old bash version) #30
Comments
MacOS ships with a 13 year old bash? Tricky. Can't you upgrade bash? IIRC macOS ships with zsh. Do you know what version? We could add a switch to change from bash to zsh on macOS (with a few adaptions to the code). But I would really strongly recommend using a modern bash with all the features and security fixes etc. |
Yes, meanwhile the default shell for macOS switched to zsh:
Homebrew and other extensions for macOS offer recent versions of bash in |
Why not? This could become part of a native OS installation adaptor. Like
It would be really hard to work without associative arrays ( It would also probably be hard making shell code portable between bash and zsh (0-based vs 1-based array indexing, different array indices syntax, CWD-relative This affects scripts in:
|
There exist competing third party package managers for macOS (Fink, Homebrew, MacPorts, maybe more). In theory I can install more than one of them, but in real life that can cause conflicts, and it always costs a lot of disk space. None of those package managers will install /bin/bash, so Replacing shell code by Python 3 would be the safe choice. |
None of my Debian hosts has zsh installed. I don't think that zsh is the solution. |
I still think that the best solution would be using Python for everything which cannot be done in a POSIX We could check whether |
How about replacing #!/bin/bash with
for MacOS and doing a version check that fails early, loud and explicitly? That would shift the burden of having the right bash in OTOH I'm not as pessimistic about zsh/bash interop as @bertsky. I have to say I'm not keen on reimplementing bashlib in Python especially if it is just about MacOS shipping broken software. |
That's a good suggestion. Only a small number of files seems to use associative arrays with
(list produced by searching the whole generated VIRTUAL_ENV directory) |
Then I guess the host/OS adaptor will have to provide multiple profiles (macos-fink, macos-homebrew, macos-macports etc).
Well if that's more than the overhead for Docker, then macOS is a poor choice for a native installation.
Here I agree with @kba: The traditional way to deal with this is
Again I side with @kba: bashlib was meant as a last resort to easily wrap non-Python tools without knowledge of Python. Any reasonable platform we target natively should support at least a (fairly recent) bash. Especially now that we have invested a lot of work in that direction.
Neither do I. It serves its purpose for interactive work (and arguably well), but this is about the default scripting language.
...this already excludes (associative) arrays and most of variable expansion we use in every other line. I don't think POSIX is a good reference point either. (Except perhaps for shell recipes in makefiles, where it is also the default.)
I'm all in for that! Replacing shebangs and hard-coded |
I'd only replace
|
We could compare Associative arrays are around since 4.0 (but have been fixed/improved since IIRC). 4.4 introduced (among others):
(which of course has security implications)
(I sometimes use this to escape quotations in the input.)
(sounds significant to our trap handling scripts) So, how about:
|
4.4 was released 2016-09-15. I think that is a reasonable expectation.
👍 |
Done: PRs above and bertsky/workflow-configuration@8c86e00) |
Perhaps we should do something in core as well, but I don't know what exactly. As @stweil pointed out, we don't have any shebangs in the library itself. There is, however:
Apart from that, for lib.bash itself, only the version check comes to mind. |
@kba, that's not a good check. It fails with a very recent bash 5.0. Better:
|
|
bashlib: check for bash >= 4.4, fix #445, OCR-D/ocrd_olena#30
macOS provides an old version of bash which obviously does not support
declare -A
:The text was updated successfully, but these errors were encountered: