mattmc3 / antidote

https://getantidote.github.io - the cure to slow zsh plugin management
MIT License
855 stars 21 forks source link

Antidote requires modern awk version #142

Closed ejdyksen closed 10 months ago

ejdyksen commented 1 year ago

At some point my setup stopped working on an old Mac running Catalina (which is indeed out of support). When starting, Antidote would fail to generate the zsh_plugins.zsh file, which would end up blank, and I would just get this error message:

/dev/fd/12:1: no matches found: --#

I narrowed it down to the awk code. Catalina ships with an ancient version of awk:

❯ /usr/bin/awk --version
awk version 20070501

I don't really know enough awk or what the internals of antidote are doing here exactly, but I believe the offending line is L34 here:

https://github.com/mattmc3/antidote/blob/d6b595275914c425df4a0f85bd1a9399a101ea63/functions/__antidote_parse_bundles#L29-L38

Installing a recent version of awk from Homebrew did fix the problem, so you can feel free to close this if you don't want to investigate further. Thanks for a great project!

mattmc3 commented 1 year ago

Thanks for reporting the issue! I'm willing to support older systems if I have a way I can rely on my GitHub Actions setup to test against those old systems. I don't think there's a way to do that with Catalina currently, but I can keep this open for now and see if there's a way to install an older awk to test with. Conversely, I could rely less on awk for the parser, but Zsh without PCRE is pretty common so I was aiming for something that I could count on on a modern install.

ejdyksen commented 1 year ago

Yeah, Catalina isn't supported on GitHub Actions. If you really wanted to take a look...

You can download the version of Awk used in Catalina (from here) and compile it like this:

curl -L -O https://github.com/apple-oss-distributions/awk/archive/awk-24.140.1.tar.gz
tar -xzf awk-24.140.1.tar.gz
cd awk-awk-24.140.1

xcodebuild -project awk.xcodeproj -scheme awk -archivePath ./awk.xcarchive archive

cp awk.xcarchive/Products/usr/bin/awk /usr/local/bin/awk

This does work and repro the bug on Ventura (you have to delete zsh_plugins.zsh first).

mattmc3 commented 10 months ago

I just cut a new release, v1.9.3. In it, if you have GNU awk (gawk) installed on macOS, antidote will use it instead of an old outdated system awk. I still test and support awk on all modern macOS installs, but this will allow you to still use antidote on an old MacOS with an outdated awk just by running brew install gawk.