problem(s) with extractbb and extractbb.lua recently introduced

Bruno Voisin bvoisin at icloud.com
Tue Jul 9 15:55:06 CEST 2024


> Max wrote:
> 
> I assumed that all Unixes would behave the same way, so we only tested
> with Linux and Windows before deploying the new script. macOS seems to
> be different than Linux here, so once I figure out _how_ it's different,
> I should be able to adjust the script fairly easily.


> Karl wrote:
> 
> Until Max figures out the best thing to do,
> for tonight's build, I just commented out that check:
> 
> -- if (script_dir ~= interpreter_dir) and (script_path ~= resolved_script_path) then
> --    error("The script is in an incorrect location: " .. script_dir)
> -- end


After further testing, at the point this test is run, the variables are

	script_dir = /Library/TeX/texbin
	interpreter_dir = /usr/local/texlive/2024/bin/universal-darwin

	script_path = /Library/TeX/texbin/extractbb
	resolved_script_path = /usr/local/texlive/2024/texmf-dist/scripts/texlive/extractbb.lua

This was very low-tech testing: create copies of the script, replace script_dir by interpreter_dir etc. in the error message, rename each copy extractbb.lua in turn, run "extractbb --version", write down the error in each case, repeat.

If I got things right, script_dir and script_path are obtained from Lua's debug.getinfo with

	local script_path = debug.getinfo(1, "S").source:sub(2)
	local script_dir, script_name, script_ext = split_path(script_path)

while interpreter_dir and resolved_script_path are obtained from kpathsea with

	local interpreter_dir = kpse.var_value("SELFAUTOLOC")
	local resolved_script_path = kpse.find_file(
	    script_name .. "." .. (script_ext or SCRIPT_EXT), "texmfscripts", true
	)

and the above tests whether the outcome of the two is the same.

So it seems on the Mac Lua is all about /Library/TeX/texbin, and kpathsea all about /usr/local/texlive/2024, with

	% realpath /Library/TeX/texbin
	/usr/local/texlive/2024/bin/universal-darwin

	% realpath /Library/TeX/texbin/extractbb
	/usr/local/texlive/2024/texmf-dist/scripts/texlive/extractbb.lua

Regarding Max's original test, output is nicer when the test is run in sh rather than macOS's current default shell zsh:

	sh-3.2$ dirname $(type -p luatex)
	/Library/TeX/texbin

	sh-3.2$ dirname $(type -p extractbb)
	/Library/TeX/texbin

	sh-3.2$ kpsewhich --format=texmfscripts extractbb.lua
	/usr/local/texlive/2024/texmf-dist/scripts/texlive/extractbb.lua

	sh-3.2$ realpath $(type -p extractbb)
	/usr/local/texlive/2024/texmf-dist/scripts/texlive/extractbb.lua

Bruno




More information about the tex-live mailing list.