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

Reinhard Kotucha reinhard.kotucha at gmx.de
Tue Jul 16 02:10:13 CEST 2024


On 2024-07-15 at 14:08:46 +0200, Bruno Voisin via tex-live wrote:

 > > On 15 Jul 2024, at 10:07, Reinhard Kotucha <reinhard.kotucha at gmx.de> wrote:
 > >
 > > the texlua equivalent of readlink(1) is
 > >
 > >  lfs.symlinkattributes(path, 'target')
 >
 > Hi Reinhard,
 >
 > Thanks for the tip.
 >
 > First, about the way things are set up on the Mac (as revealed by "ls -l"):
 >
 > - There is a chain of symlinks for the binary directory
 > [...]

Hi Bruno,
I didn't know that the setup on OS X is so complicated.  I always
assumed that there is one symlink

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

so that changing this link is sufficient to switch to other releases.

 > - Then there are symlinks for the binaries themselves
 >
 > 	/Library/TeX/texbin/extractbb
 > 	-> ../../texmf-dist/scripts/texlive/extractbb.lua

This means that there is another symlink /Library/TeX/texmf-dist
pointing to /usr/local/texlive/2024/texmf-dist.

This is strange because once a program is found and executed in
/usr/local/texlive/2024/bin/universal-darwin kpathsea will look for
files in /usr/local/texlive/2024/texmf-dist and not in
/Library/TeX/texmf-dist.

 > So you need to first resolve /Library/TeX/texbin to
 > /usr/local/texlive/2024/bin/universal-darwin, then
 > /Library/TeX/texbin/extractbb =
 > ../../texmf-dist/scripts/texlive/extractbb.lua will point to
 > /usr/local/texlive/2024/texmf-dist/scripts/texlive/extractbb.lua as
 > it should.

No.  There is no need to follow any symlinks at all.  No other program
or script does it.

Could you please put this tiny script into your current working
directory, name it "extractbb.lua", make it executable, and run

  ./extractbb.lua -O <some png file>

---------------------------------------
#!/usr/bin/env texlua

local args = {'ebb', '--extractbb'}

for _,a in ipairs(arg) do table.insert(args,a) end

-- for i,v in ipairs(args) do print (i,v) end

os.exec(args)
---------------------------------------

It works for me on Linux and I don't see any reason why it shouldn't
work on any other platform supported by TeX Live.

All the error messages you and Frank reported come from the
extractbb.lua script we currently have in TeX Live.  The reason is
that the script tries to catch all errors at an extremely low level
and thus isn't portable.

The tiny script above provides exactly the same output as the script
we have in TeX Live:

  $ ./extractbb.lua -O bachotex-venue-1024x768.png
  %%Title: bachotex-venue-1024x768.png
  %%Creator: extractbb 20240407
  %%BoundingBox: 0 0 122 92
  %%HiResBoundingBox: 0.000000 0.000000 121.800244 92.160184
  %%CreationDate: Tue Jul 16 00:14:54 2024

but circumvents all the low-level checks and relies entirely on the
facilities TeX Live provides, especially kpathsea.

Whenever you leave this safe terrain and try to handle the low-level
stuff by yourself it's quite likely that you break TeX Live's
system-independency.  If a script is properly installed there is
absolutely no need to worry about readlink or realpath.

 > Anyway, I'm way over my league here, and I'd better stop.

Your mail was extremely helpful, as usual, so it's definitely not the
right time to give up.

Best regards and thank you very much,
  Reinhard

--
------------------------------------------------------------------
Reinhard Kotucha                            Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover                    mailto:reinhard.kotucha at gmx.de
------------------------------------------------------------------



More information about the tex-live mailing list.