[tlbuild] luaharfbuzz breaks tostring

Simon Dales simon at getthingsfixed.co.uk
Sat Mar 7 13:50:58 CET 2020


On Sat, 2020-03-07 at 16:42 +0900, Akira Kakuto wrote:
> > If I iterate over luaharfbuzz in texlua it dies with
> > a broken tostring()
> > ...
> 
> We recovered texlua[jit][c] as symbolic links to lua[jit]tex,
> because they, as symbolic links to lua[jit]hbtex, broke context
> and contextjit.
> 
> If you want luaharfbuzz in lua mode, please use
> 'luahbtex --luaonly' instead of 'texlua'.

It also breaks in "luahbtex --luaonly". And why shouldn't it?

The Lua reference says that tostring() should return something sensible
for __all__ values.

By "use" that includes trying to do a recursive list of _G.:
///////////////
--[[!
  @file
  @brief test luaharfbuzz
  ]]

--[[!
  @brief lets us writeout fixed width strings
  ]]
local function write_fixed(Val,Width)
  local w = Width or 10
  io.write(string.sub((Val or '') .. string.rep(' ',w),1,w))
end

--main
for k0,v0 in pairs(_G) do
  io.write(k0 .. '\n') 
  if (type(v0)=='table') then
    for k1,v1 in pairs(v0) do
      io.write('  ') 
      write_fixed(k1,20) 
      write(type(v1),10)
      io.write(tostring(v1))
      io.write('\n') 
    end
	else
    io.write(tostring(v0))
    io.write('\n') 
  end
end
--eof
///////////////

Fails:
--------------
...
luaharfbuzz
  Buffer              table     table: 0xb6c164e8
  Script              table     t_hb2.lua:22: bad argument #1 to
'tostring' (harfbuzz.Script expected, got table)
--------------

I notice, from a quick scan of the sources for the classes/table
entries:
* Those that fail have explicit tostring code.
* Those that merely register the class work fine: i.e. conform to the
Lua reference on tostring() behaviour.

//////////////////

Simon



More information about the tlbuild mailing list.