Package: luatex Version: 0.46.0-7 Severity: normal I did a quick check to see if it is still the case that all embedded lua libraries are customized.
The lpeg library is exactly the same (I used md5sums since diff gives no output): e820987a2773bdd55914862dc95ee1fa luapeg/lpeg.c e820987a2773bdd55914862dc95ee1fa /tmp/lua-lpeg-0.9/lpeg.c Moreover the patch to luafilesystem (in attachment) is quite small and may be interesting for the upstreams too, but it is for version 1.4.1, while the current release 1.4.2. I could try to push the patch upstream if luatex authors could move to 1.4.2. The same holds for luazip. I don't even have the ancient version they embed, but the most recent one just adds few #ifdefs for backward compatibility with lua5.0 (luatex uses 5.1). The embedded luasocket version is mostly the same, the patch (attached) is few lines and could be of interest for the upstream. Another customization is that they use luac to embed .lua parts of luasocket in bytecode (C-represented). This helps them embedding luasocket, but is not neede in Debian (that ships the .lua files in standard paths, assuming their lua5.1 customization does not alter them). In my opinion, at a very light cost for the upstreams of luatex, luafilesystem and luasocket (and the Debian packager) we could avoid code duplication for 4 lua libraries (1 of them at 0 cost I think). I offer my help in pushing the needed patches upstream, but I'll do that only if luatex upstreams agree on updating some of their libs and the Debian maintaner to remove the wontfix tag :-) Cheers -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.31-1-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages luatex depends on: ii libc6 2.10.2-2 GNU C Library: Shared libraries ii libpng12-0 1.2.41-1 PNG library - runtime ii libpoppler5 0.12.2-2 PDF rendering library ii zlib1g 1:1.2.3.3.dfsg-15 compression library - runtime Versions of packages luatex recommends: ii texlive-luatex 2009-4 TeX Live: LuaTeX packages luatex suggests no packages. -- no debconf information -- Enrico Tassi
--- /tmp/luafilesystem-1.4.1/src/lfs.c 2008-05-07 21:06:37.000000000 +0200 +++ luafilesystem/src/lfs.c 2009-11-26 16:10:48.000000000 +0100 @@ -78,8 +78,6 @@ #define STAT_STRUCT struct _stati64 #define STAT_FUNC _stati64 #else -#define _O_TEXT 0 -#define _O_BINARY 0 #define lfs_setmode(L,file,m) ((void)((void)file,m), \ luaL_error(L, LUA_QL("setmode") " not supported on this platform"), -1) #ifdef HAVE_STAT64 @@ -468,6 +466,36 @@ return "other"; } + /* +** Convert the inode protection mode to a permission list. +*/ + +#ifdef _WIN32 +static const char *perm2string (unsigned short mode) { + static char perms[10] = "---------\0"; + if (mode & _S_IREAD) + { perms[0] = 'r'; perms[3] = 'r'; perms[6] = 'r'; } + if (mode & _S_IWRITE) + { perms[1] = 'w'; perms[4] = 'w'; perms[7] = 'w'; } + if (mode & _S_IEXEC) + { perms[2] = 'x'; perms[5] = 'x'; perms[8] = 'x'; } + return perms; +} +#else +static const char *perm2string (mode_t mode) { + static char perms[10] = "---------\0"; + if (mode & S_IRUSR) perms[0] = 'r'; + if (mode & S_IWUSR) perms[1] = 'w'; + if (mode & S_IXUSR) perms[2] = 'x'; + if (mode & S_IRGRP) perms[3] = 'r'; + if (mode & S_IWGRP) perms[4] = 'w'; + if (mode & S_IXGRP) perms[5] = 'x'; + if (mode & S_IROTH) perms[6] = 'r'; + if (mode & S_IWOTH) perms[7] = 'w'; + if (mode & S_IXOTH) perms[8] = 'x'; + return perms; +} +#endif /* ** Set access time and modification values for file @@ -537,6 +565,10 @@ static void push_st_size (lua_State *L, STAT_STRUCT *info) { lua_pushnumber (L, (lua_Number)info->st_size); } +/* permssions string */ +static void push_st_perm (lua_State *L, struct stat *info) { + lua_pushstring (L, perm2string (info->st_mode)); +} #ifndef _WIN32 /* blocks allocated for file */ static void push_st_blocks (lua_State *L, STAT_STRUCT *info) { @@ -563,6 +595,7 @@ struct _stat_members members[] = { { "mode", push_st_mode }, + { "permissions", push_st_perm }, { "dev", push_st_dev }, { "ino", push_st_ino }, { "nlink", push_st_nlink }, @@ -644,6 +677,45 @@ } #endif + +/* +** Get file information +*/ +static int file_is_directory (lua_State *L) { + struct stat info; + const char *file = luaL_checkstring (L, 1); + + if (stat(file, &info)) { + lua_pushnil (L); + lua_pushfstring (L, "cannot obtain information from file `%s'", file); + return 2; + } + if ( S_ISDIR(info.st_mode) ) + lua_pushboolean (L, 1); + else + lua_pushboolean (L, 0); + + return 1; +} + +static int file_is_file (lua_State *L) { + struct stat info; + const char *file = luaL_checkstring (L, 1); + + if (stat(file, &info)) { + lua_pushnil (L); + lua_pushfstring (L, "cannot obtain information from file `%s'", file); + return 2; + } + if ( S_ISREG(info.st_mode) ) + lua_pushboolean (L, 1); + else + lua_pushboolean (L, 0); + + return 1; +} + + /* ** Assumes the table is on top of the stack. @@ -663,6 +735,8 @@ static const struct luaL_reg fslib[] = { {"attributes", file_info}, + {"isdir", file_is_directory }, + {"isfile", file_is_file }, {"chdir", change_dir}, {"currentdir", get_dir}, {"dir", dir_iter_factory},
diff -ruN /tmp/luasocket-2.0.2/src/usocket.c luasocket/src/usocket.c --- /tmp/luasocket-2.0.2/src/usocket.c 2007-10-14 01:44:03.000000000 +0200 +++ luasocket/src/usocket.c 2009-11-26 16:10:49.000000000 +0100 @@ -6,13 +6,20 @@ * The penalty of calling select to avoid busy-wait is only paid when * the I/O call fail in the first place. * -* RCS ID: $Id: usocket.c,v 1.37 2007/06/11 23:44:54 diego Exp $ +* RCS ID: $Id: usocket.c,v 1.38 2007/10/13 23:55:20 diego Exp $ \*=========================================================================*/ #include <string.h> #include <signal.h> #include "socket.h" +#if defined(__sun__) +#define HSTRERROR(A) "unknown host error" +#else +#define HSTRERROR(A) hstrerror(A) +#endif + + /*-------------------------------------------------------------------------*\ * Wait for readable/writable/connected socket with timeout \*-------------------------------------------------------------------------*/ @@ -346,7 +353,7 @@ if (err <= 0) return io_strerror(err); switch (err) { case HOST_NOT_FOUND: return "host not found"; - default: return hstrerror(err); + default: return HSTRERROR(err); } }
--- /tmp/lua-zip-1.2.3/src/luazip.c 2007-06-18 20:47:05.000000000 +0200 +++ luazip/src/luazip.c 2009-11-26 16:10:52.000000000 +0100 @@ -3,9 +3,9 @@ http://www.keplerproject.org/luazip/ Author: Danilo Tuler - Copyright (c) 2003-2007 Kepler Project + Copyright (c) 2003-2006 Kepler Project - $Id: luazip.c,v 1.11 2007/06/18 18:47:05 carregal Exp $ + $Id: luazip.c,v 1.9 2006/03/23 20:44:53 carregal Exp $ */ #include <string.h> @@ -13,9 +13,6 @@ #include "zzip/zzip.h" #include "luazip.h" #include "lauxlib.h" -#if ! defined (LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 -#include "compat-5.1.h" -#endif #define ZIPFILEHANDLE "lzipFile" #define ZIPINTERNALFILEHANDLE "lzipInternalFile" @@ -453,13 +450,9 @@ static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; static const char *const modenames[] = {"set", "cur", "end", NULL}; ZZIP_FILE *f = tointernalfile(L, 1); + int op = luaL_checkoption(L, 2, "cur", modenames); long offset = luaL_optlong(L, 3, 0); -#if ! defined (LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 - int op = luaL_findstring(luaL_optstring(L, 2, "cur"), modenames); luaL_argcheck(L, op != -1, 2, "invalid mode"); -#else - int op = luaL_checkoption(L, 2, "cur", modenames); -#endif op = zzip_seek(f, offset, mode[op]); if (op < 0) return pushresult(L, 0, NULL); /* error */ @@ -473,7 +466,7 @@ {"open", zip_open}, {"close", zip_close}, {"type", zip_type}, -// {"files", io_files}, + /* {"files", io_files},*/ {"openfile", zip_openfile}, {NULL, NULL} }; @@ -505,13 +498,13 @@ */ static void set_info (lua_State *L) { lua_pushliteral (L, "_COPYRIGHT"); - lua_pushliteral (L, "Copyright (C) 2003-2007 Kepler Project"); + lua_pushliteral (L, "Copyright (C) 2003-2006 Kepler Project"); lua_settable (L, -3); lua_pushliteral (L, "_DESCRIPTION"); lua_pushliteral (L, "Reading files inside zip files"); lua_settable (L, -3); lua_pushliteral (L, "_VERSION"); - lua_pushliteral (L, "LuaZip 1.2.3"); + lua_pushliteral (L, "LuaZip 1.2.2"); lua_settable (L, -3); }