[Dev-luatex] beta 0.20.0 released

Norbert Preining preining at logic.at
Wed Dec 5 16:21:31 CET 2007


Hi Taco!

Thanks a lot for the new release, soon there will be packages for linux
build on various archs on Debian.

On point:

On Mi, 05 Dez 2007, Taco Hoekwater wrote:
> * the lua functions os.sleep(), os.times(), os.gettimeofday()
>    and os.tmpdir() have been added.

os.tmpdir always tries to create a directory in . which is bad if it
happens that you are in /.

I changed the function so that it takes an argument = template, and in
case there is no argument tries . as before:

change os.tmpdir so that it takes an argument for template
Author: Norbert Preining <preining at logic.at>
License: GPLv2
---
 src/texk/web2c/luatexdir/lua/loslibext.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Index: luatex-0.20.0/src/texk/web2c/luatexdir/lua/loslibext.c
===================================================================
--- luatex-0.20.0.orig/src/texk/web2c/luatexdir/lua/loslibext.c	2007-12-05 13:41:29.000000000 +0100
+++ luatex-0.20.0/src/texk/web2c/luatexdir/lua/loslibext.c	2007-12-05 16:12:20.000000000 +0100
@@ -305,7 +305,16 @@
 
 static int os_tmpdir (lua_State *L) {
   char *s; 
-  char tempdir[] = "luatex.XXXXXX";
+  char *ret = (char *)luaL_optstring(L, 1, "luatex.XXXXXX");
+  char *tempdir;
+  if (ret) {
+    tempdir = strdup(ret);
+  } else {
+    int en = errno;
+    lua_pushnil(L);
+    lua_pushfstring(L, "%s", strerror(en));
+    return 2;
+  }
 #ifdef HAVE_MKDTEMP
   s = mkdtemp(tempdir);
 #else

I have NO idea whatsoever on lua programming, parts of it were copied
from other sources and adapted etc. Please use whatever you need and fix
the errors. I tested it with texdoclua and 
	os.tmpdir("/tmp/texdoc.XXXXXX")
and it worked.

It would be nice if you could include that into upstream, thanks

Best wishes

Norbert

-------------------------------------------------------------------------------
Dr. Norbert Preining <preining at logic.at>        Vienna University of Technology
Debian Developer <preining at debian.org>                         Debian TeX Group
gpg DSA: 0x09C5B094      fp: 14DF 2E6C 0307 BE6D AD76  A9C0 D2BF 4AA3 09C5 B094
-------------------------------------------------------------------------------
TUMBY (n.)
The involuntary abdominal gurgling which fills the silence following
someone else's intimate personal revelation.
			--- Douglas Adams, The Meaning of Liff


More information about the dev-luatex mailing list