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

* Re: [NTG-context] LuaMetaTeX doesn't find files when symlinked
  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
  0 siblings, 1 reply; 4+ messages in thread
From: lynx--- via ntg-context @ 2023-04-28  7:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: lynx


[-- Attachment #1.1: Type: text/plain, Size: 3526 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 4934 bytes --]

[-- Attachment #2: Type: text/plain, Size: 496 bytes --]

___________________________________________________________________________________
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

* Re: [NTG-context] LuaMetaTeX doesn't find files when symlinked
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Max Chernoff via ntg-context @ 2023-04-28  8:28 UTC (permalink / raw)
  To: ntg-context; +Cc: Max Chernoff


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
___________________________________________________________________________________

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

* Re: [NTG-context] LuaMetaTeX doesn't find files when symlinked
  2023-04-28  8:28   ` Max Chernoff via ntg-context
@ 2023-04-28 18:14     ` lynx--- via ntg-context
  0 siblings, 0 replies; 4+ messages in thread
From: lynx--- via ntg-context @ 2023-04-28 18:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: lynx


[-- Attachment #1.1: Type: text/plain, Size: 2139 bytes --]

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
like....partially 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
> ___________________________________________________________________________________

[-- Attachment #1.2.1: Type: text/html, Size: 3322 bytes --]

[-- Attachment #1.2.2: 22cb063c.png --]
[-- Type: image/png, Size: 35652 bytes --]

[-- Attachment #2: Type: text/plain, Size: 496 bytes --]

___________________________________________________________________________________
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).