[tex-live] (future) bug in mkluatexfontdb

Paul Vojta vojta at math.berkeley.edu
Fri Jan 14 21:32:57 CET 2011


This is not a problem with the version of luatex shipped with texlive.
However, anyone who compiles luatex from the sources on luatex.org will
get the error message

.../tex/luatex/lualibs/lualibs-dir.lua:37: bad argument #1 to '(for generator)' (directory metatable expected, got nil)

The problem is that, apparently, the "for" command, or perhaps the iterator
provided by lfs.dir, is more finicky now about having the second argument.
For details about iterators, see Chapter 7 of the lua documentation.

Here is a patch that will fix the problem.  The patched file still works
with older versions of luatex, so I see no harm in applying it now instead
of waiting for a new version of luatex to be used in texlive.

(I hope this is the correct place to report this -- I don't know of any
"home site" similar to luatex.org that supports lualib-dir.lua.)

--Paul Vojta, vojta at math.berkeley.edu
-------------- next part --------------
--- tex/luatex/lualibs/lualibs-dir.lua	2010-05-29 02:25:56.000000000 -0700
+++ tex/luatex/lualibs/lualibs-dir.lua	2011-01-13 22:05:56.766564001 -0800
@@ -26,15 +26,15 @@
 local walkdir    = lfs.dir
 
 local function glob_pattern(path,patt,recurse,action)
-    local ok, scanner
+    local ok, scanner, dirobj
     if path == "/" then
-        ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe
+        ok, scanner, dirobj = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe
     else
-        ok, scanner = xpcall(function() return walkdir(path)      end, function() end) -- kepler safe
+        ok, scanner, dirobj = xpcall(function() return walkdir(path)      end, function() end) -- kepler safe
     end
     if ok and type(scanner) == "function" then
         if not find(path,"/$") then path = path .. '/' end
-        for name in scanner do
+        for name in scanner, dirobj do
             local full = path .. name
             local mode = attributes(full,'mode')
             if mode == 'file' then
@@ -51,16 +51,16 @@
 dir.glob_pattern = glob_pattern
 
 local function collect_pattern(path,patt,recurse,result)
-    local ok, scanner
+    local ok, scanner, dirobj
     result = result or { }
     if path == "/" then
-        ok, scanner = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe
+        ok, scanner, dirobj = xpcall(function() return walkdir(path..".") end, function() end) -- kepler safe
     else
-        ok, scanner = xpcall(function() return walkdir(path)      end, function() end) -- kepler safe
+        ok, scanner, dirobj = xpcall(function() return walkdir(path)      end, function() end) -- kepler safe
     end
     if ok and type(scanner) == "function" then
         if not find(path,"/$") then path = path .. '/' end
-        for name in scanner do
+        for name in scanner, dirobj do
             local full = path .. name
             local attr = attributes(full)
             local mode = attr.mode


More information about the tex-live mailing list