lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Sometime on Sat, 16 Jan 2010, steve donovan wrote:
>BTW, I will try get the Lua 5.1 test suite working on Windows so
>that we can evaluate the latest GCC versions more thoroughly. For
>instance, whether the more aggressive optimizations are without
>issues.

I made a stab at this, but stopped after running into a strong
dependence on os.tmpname() in the very first test case invoked by
all.lua. The issue is that os.tmpname() is horribly misfunctional
on Windows, thanks to a poor implementation of tmpnam() by MS in
pretty much all versions of the C runtime libraries.

According to MS, tmpnam() returns a filename with a leading '\',
and documents that to mean that the name is approved for use in
the current directory. Exactly what part of Windows uses a name
beginning with backslash to mean "current directory" is never
specified. The effect is that code like

        local f = io.open(os.tmpname(),"w")

attempts to create a file on the root of the current drive after
guaranteeing the name is unique in the current directory but not
on the root, which even if it succeeds is a bad idea.

It would probably be a good idea to fix this in the os library
for Windows builds. Replacing tmpnam() with something that uses
the TMP or TEMP environment variables is probably superior, but I
haven't taken the time to create a better solution.

The generated name will also include a dot, which seems to
interact badly with its usage in the test suite as a possible
module name passed to either require or to the -l option on the
lua command line.


Ross Berteig                               Ross@CheshireEng.com
Cheshire Engineering Corp.           http://www.CheshireEng.com/
+1 626 303 1602
+1 626 351 1590 FAX