Re: [NTG-context] LuaMetaTeX doesn't find files when symlinked

2023-04-28 Thread lynx--- via ntg-context
hi, Max 

The two suggestions don't work. I get a message, "Could not start the
command..." each time. 

$ /usr/local/ConTeXt_Standalone/context-linux-64/bin/context --nofile 

results in " no such file or directory " which is, indeed, the case. NB:
I have just let the installer program do its thing, I didn't manipulate
the file structure before or after. Here is what the tree looks
likepartially expanded 

On 2023-04-28 01:28, Max Chernoff via ntg-context wrote:

> Hi Lynx,
> 
>> Today, I created a separate "user command" within TeXstudio, and it
>> points to "/usr/local/ConTeXt_Standalone/context-linux-64/bin/mtxrun" 
>> This command generates the same log output as the example at
>> https://gitlab.com/islandoftex/images/texlive/-/issues/30.
> 
> This is probably not the same issue, since the path "context-linux-
> 64/bin/mtxrun" suggests that that isn't a symlink. (Well, it is a
> symlink mtxrun => ./luametatex, but that email is about multi-level
> symlinks like /usr/bin/context => /usr/local/texlive/2023/bin/x86_64-
> linux/context => ./luametatex)
> 
> To compile a document, you almost certainly want to use "context"
> instead of "mtxrun". So try changing the user command to
> "/usr/local/ConTeXt_Standalone/context-linux-64/bin/context".
> 
> If that doesn't fix anything, run
> 
> $ /usr/local/ConTeXt_Standalone/context-linux-64/bin/mtxrun --generate
> $ /usr/local/ConTeXt_Standalone/context-linux-64/bin/context --make
> 
> and try again.
> 
> If it still doesn't work, then what do you get when you run
> 
> $ /usr/local/ConTeXt_Standalone/context-linux-64/bin/context --nofile
> 
> -- 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
> __
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
___


Re: [NTG-context] LuaMetaTeX doesn't find files when symlinked

2023-04-28 Thread Max Chernoff via ntg-context


Hi Lynx,

> Today, I created a separate "user command" within TeXstudio, and it
> points to "/usr/local/ConTeXt_Standalone/context-linux-64/bin/mtxrun" 
> This command generates the same log output as the example at
> https://gitlab.com/islandoftex/images/texlive/-/issues/30.

This is probably not the same issue, since the path "context-linux-
64/bin/mtxrun" suggests that that isn't a symlink. (Well, it is a
symlink mtxrun => ./luametatex, but that email is about multi-level
symlinks like /usr/bin/context => /usr/local/texlive/2023/bin/x86_64-
linux/context => ./luametatex)

To compile a document, you almost certainly want to use "context"
instead of "mtxrun". So try changing the user command to
"/usr/local/ConTeXt_Standalone/context-linux-64/bin/context".

If that doesn't fix anything, run

   $ /usr/local/ConTeXt_Standalone/context-linux-64/bin/mtxrun --generate
   $ /usr/local/ConTeXt_Standalone/context-linux-64/bin/context --make
   
and try again.

If it still doesn't work, then what do you get when you run

   $ /usr/local/ConTeXt_Standalone/context-linux-64/bin/context --nofile

-- 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
___


Re: [NTG-context] LuaMetaTeX doesn't find files when symlinked

2023-04-28 Thread lynx--- via ntg-context
Max & Hans: 

I installed the stand-alone ConTeXt installation just today. It seems
like I have my $PATH set correctly now. 

I have been editing ConTeXt and running it within TeXstudio. I had set
up a "user command" to execute arara on LaTeX and ConTeXt files when I
did NOT have the "standalone" version installed. It still works
correctly. 

Today, I created a separate "user command" within TeXstudio, and it
points to "/usr/local/ConTeXt_Standalone/context-linux-64/bin/mtxrun" 
This command generates the same log output as the example at
https://gitlab.com/islandoftex/images/texlive/-/issues/30. 

If I understand this correctly, my OLD user command within TeXstudio is
still finding the TeXlive version of ConTeXt, and that TeXlive version
does have the symlinks mentioned by Max (and BTW, I did NOT create
those, they are part of the default TeXlive installation process!). This
is because my OLD "arara" command has the path to the March 13 version
of TeXlive 2023 version (installed from ISO image, with some updates
using tlmgr already installed). 

Lynx 

On 2023-04-27 21:00, Max Chernoff via ntg-context wrote:

> 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
> __
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
___


[NTG-context] LuaMetaTeX doesn't find files when symlinked

2023-04-27 Thread Max Chernoff via ntg-context
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
___