Closed alerque closed 1 week ago
After many attempts and much puzzling pulling my hair out I finally tracked this down. It turns out the issues is much simpler than what I was trying to look into and the upshot is that this is not a SILE bug, it is a Homebrew packaging issue. The Homebrew package is not giving you the original sile
executable, it is giving you a wrapper script that mucks with the environment variable and then calls the sile
binary.
$ which sile
/opt/homebrew/bin/sile
$ file /opt/homebrew/bin/sile
/opt/homebrew/bin/sile: Bourne-Again shell script text executable, ASCII text, with very long lines (377)
$ cat /opt/homebrew/bin/sile
#!/bin/bash
LUA_PATH="/opt/homebrew/Cellar/sile/0.15.5_1/libexec/vendor/share/lua/5.1/?.lua;/opt/homebrew/Cellar/sile/0.15.5_1/libeare/lua/5.1/?/init.lua;/opt/homebrew/Cellar/sile/0.15.5_1/libexec/vendor/share/lua/5.1/lxp/?.lua;;" LUA_CPATH="/opt/homsile/0.15.5_1/libexec/vendor/lib/lua/5.1/?.so;;" exec "/opt/homebrew/Cellar/sile/0.15.5_1/libexec/bin/sile" "$@"
The Homebrew wrapper script is pretty easy to ditch and (unlike as of when it was first introduced) SILE works fine and doesn't need the workaround it was providing.
On the other hand just removing the wrapper doesn't fix this problem, because as soon as you try to set LUA_PATH
to anything you suddenly run afoul of the original problem the wrapper script was designed to fix. Working around that from the Homebrew side would involve some real shenanigans in the wrapper script. What I'm going to propose instead is that we handle the tricky bits here upstream where it will be a bit easier and then get Homebrew to just drop the wrapper script entirely.
I gave this script to Homebrew user @no-vici:
and got back this:
This suggests to me that
os.getenv()
isn't even working for us in the Rust build on macOS.The fact that it did work but also rendered the Lua build of SILE un-runnable because it no longer had access to the bulid time pseudo-system dependencies is another bug. That should either be fixed as part of this issue or opened for separate tracking here or in Homebrew.
Originally posted by @alerque in https://github.com/sile-typesetter/sile/discussions/2117#discussioncomment-10798054