[Dev-luatex] Fix for luaotfload on Cygwin

Ken Brown kbrow1i at gmail.com
Wed May 22 00:44:24 CEST 2013


There are several problems with luaotfload on Cygwin (detailed below).
The short version of this email as that the problems can be fixed by 
removing all Cygwin-specific code, so that Cygwin is treated like any 
other unix-like system.  The relevant patches are attached.

Here are the details, based on the version of luaotfload in the TeX Live 
2013 pretest as of today.

1. The code incorrectly assumes that Cygwin is a case-insensitive 
system.  This is not necessarily the true; see

 
http://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-casesensitive

I and many other Cygwin users have followed these instructions to make 
Cygwin case sensitive.  As a result, luaotfload-tool failed on my system 
with the cryptic error message

...texmf-dist/tex/luatex/luaotfload/luaotfload-database.lua:921: attempt 
to index field '?' (a nil value)

I finally tracked down the problem to the fact that case was being 
ignored in the filename 
/usr/local/texlive/2013/texmf-dist/fonts/opentype/adobe/sourcecodepro/SourceCodePro-Black.otf.

2. The code uses "cygdrive", ignoring the fact that users can change the 
cygdrive prefix to whatever they want in /etc/fstab.  For example, some 
users prefer to use "mnt".

3. Because the code doesn't use /etc/fonts/fonts.conf, it doesn't add 
the Cygwin system fonts to the database.

4. Because of the use of os.getenv("WINDIR"), the code produces Windows 
paths rather than Posix paths when it scans the Windows font directory. 
  This causes a problem as reported in the thread starting at

   http://cygwin.com/ml/cygwin/2013-04/msg00454.html

and continuing at

   http://cygwin.com/ml/cygwin/2013-05/msg00006.html

After my patch is applied, the correct Posix path is used (because it is 
in /etc/fonts/fonts.conf).

Ken
-------------- next part --------------
--- luaotfload-database.lua.orig	2013-05-18 18:21:33.000000000 -0400
+++ luaotfload-database.lua	2013-05-21 18:02:48.997201900 -0400
@@ -993,25 +993,6 @@
             return path
         end
 
-    elseif os_name == "cygwin" then -- union of ms + unix
-        path_normalize = function (path)
-            path = stringgsub(path, '\\', '/')
-            path = stringlower(path)
-            path = stringgsub(path, '^/cygdrive/(%a)/', '%1:/')
-            local dest = lfsreadlink(path)
-            if dest then
-                if kpsereadable_file(dest) then
-                    path = dest
-                elseif kpsereadable_file(filejoin(filedirname(path), dest)) then
-                    path = filejoin(file.dirname(path), dest)
-                else
-                    -- broken symlink?
-                end
-            end
-            path = filecollapsepath(path)
-            return path
-        end
-
     else -- posix
         path_normalize = function (path)
             local dest = lfsreadlink(path)
@@ -1377,7 +1358,7 @@
             "/System/Library/Fonts",
             "/Network/Library/Fonts",
         }
-    elseif os.type == "windows" or os.type == "msdos" or os.name == "cygwin" then
+    elseif os.type == "windows" or os.type == "msdos" then
         local windir = os.getenv("WINDIR")
         return { filejoin(windir, 'Fonts') }
     else
-------------- next part --------------
--- luaotfload-legacy-database.lua.orig	2013-05-12 18:44:11.000000000 -0400
+++ luaotfload-legacy-database.lua	2013-05-21 18:11:37.138409800 -0400
@@ -425,7 +425,7 @@
         - reading symlinks under non-Win32
         - using kpse.readable_file on Win32
     ]]
-    if os.type == "windows" or os.type == "msdos" or os.name == "cygwin" then
+    if os.type == "windows" or os.type == "msdos" then
         path = path:gsub('\\', '/')
         path = path:lower()
         path = path:gsub('^/cygdrive/(%a)/', '%1:/')
@@ -635,7 +635,7 @@
             "/System/Library/Fonts",
             "/Network/Library/Fonts",
         }
-    elseif os.type == "windows" or os.type == "msdos" or os.name == "cygwin" then
+    elseif os.type == "windows" or os.type == "msdos" then
         local windir = os.getenv("WINDIR")
         return { file.join(windir, 'Fonts') }
     else


More information about the dev-luatex mailing list