ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] LuaMetaTeX doesn't find files when symlinked
@ 2023-04-28  4:00 Max Chernoff via ntg-context
  2023-04-28  7:20 ` lynx--- via ntg-context
  0 siblings, 1 reply; 4+ messages in thread
From: Max Chernoff via ntg-context @ 2023-04-28  4:00 UTC (permalink / raw)
  To: ntg-context; +Cc: Max Chernoff

Hi Hans,

With the LuaMetaTeX-based ConTeXt wrapper, it's not generally possible
to run ConTeXt from a symlinked binary in another directory. This shows
up if someone makes symlinks in "/usr/bin" so that they can avoid adding
anything to their $PATH.

If you make run a symlink to the LuaMetaTeX-based ConTeXt wrapper, it
looks for texmfcnf.lua relative to the symlink location, not the symlink
target. With the old LuaTeX/kpse-based wrapper, the script would look
for texmfcnf.lua relative to the symlink target.

I know that my description above is terrible, so here's a demo:

   $ bin=$(mtxrun --expand-var TEXMFOS | head -1)/*
   $ cd $(mktemp -d)
   $ ln -s $bin/luatex $bin/luametatex $bin/context $bin/context.lua $bin/mtxrun $bin/mtxrun.lua .
   $ ./context --nofile
   $ ./context --luatex --nofile
   
Running the above commands used to work with the old LuaTeX/kpse-based
wrapper, but it doesn't work any more. I was able to ""fix"" this by
adding the lines

   if os.selfpath then
       environment.ownbin = lfs.symlinktarget(os.selfpath .. io.fileseparator .. os.selfname)
       environment.ownpath = environment.ownbin:match("^.*" .. io.fileseparator)
   else
       environment.ownpath = kpse.new("luatex"):var_value("SELFAUTOLOC")
       environment.ownbin = environment.ownpath .. io.fileseparator .. (arg[-2] or arg[-1] or arg[0] or "luatex"):match("[^" .. io.fileseparator .. "]*$")
   end
   
to mtxrun.lua, right below the line

   package.loaded["data-ini"] = package.loaded["data-ini"] or true
   
but this is obviously not a very good fix.

There are some threads with more details at:

   https://tug.org/pipermail/tex-live/2023-March/049028.html
   https://gitlab.com/islandoftex/images/texlive/-/issues/30
   
Those links only discuss TL, but I get the same issue if I make a symlink
to the standalone ConTeXt files. 

Thanks,
-- Max
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-04-28 18:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-28  4:00 [NTG-context] LuaMetaTeX doesn't find files when symlinked Max Chernoff via ntg-context
2023-04-28  7:20 ` lynx--- via ntg-context
2023-04-28  8:28   ` Max Chernoff via ntg-context
2023-04-28 18:14     ` lynx--- via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).