aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-02-06 13:12:46 -0800
committerKartik K. Agaram <vc@akkartik.com>2022-02-06 13:12:46 -0800
commit8a9efc1b9171b22fc254e6e533cf9e364b273807 (patch)
tree045a5a629acae9af1aa3f77365cffc7dec7b2bfe /src
parentb79d6be383b1ab6eae85595abccf36aaf833016d (diff)
downloadteliva-8a9efc1b9171b22fc254e6e533cf9e364b273807.tar.gz
drop module 'package'
Just like with `require`, we don't we don't know how to sandbox it. (Though we still have `require` because standard libraries outside apps need it. I need to make sure apps can't invoke `require`..)
Diffstat (limited to 'src')
-rw-r--r--src/linit.c1
-rw-r--r--src/loadlib.c38
-rw-r--r--src/luaconf.h7
-rw-r--r--src/lualib.h3
4 files changed, 0 insertions, 49 deletions
diff --git a/src/linit.c b/src/linit.c
index b22d822..fd32a0d 100644
--- a/src/linit.c
+++ b/src/linit.c
@@ -16,7 +16,6 @@
static const luaL_Reg lualibs[] = {
{"", luaopen_base},
- {LUA_LOADLIBNAME, luaopen_package},
{LUA_TABLIBNAME, luaopen_table},
{LUA_IOLIBNAME, luaopen_io},
{LUA_OSLIBNAME, luaopen_os},
diff --git a/src/loadlib.c b/src/loadlib.c
index 6158c53..b1c0ebd 100644
--- a/src/loadlib.c
+++ b/src/loadlib.c
@@ -306,22 +306,6 @@ static int ll_loadfunc (lua_State *L, const char *path, const char *sym) {
}
-static int ll_loadlib (lua_State *L) {
- const char *path = luaL_checkstring(L, 1);
- const char *init = luaL_checkstring(L, 2);
- int stat = ll_loadfunc(L, path, init);
- if (stat == 0) /* no errors? */
- return 1; /* return the loaded function */
- else { /* error; error message is on stack top */
- lua_pushnil(L);
- lua_insert(L, -2);
- lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init");
- return 3; /* return nil, error message, and where */
- }
-}
-
-
-
/*
** {======================================================
** 'require' function
@@ -569,19 +553,6 @@ static int ll_module (lua_State *L) {
}
-static int ll_seeall (lua_State *L) {
- luaL_checktype(L, 1, LUA_TTABLE);
- if (!lua_getmetatable(L, 1)) {
- lua_createtable(L, 0, 1); /* create new metatable */
- lua_pushvalue(L, -1);
- lua_setmetatable(L, 1);
- }
- lua_pushvalue(L, LUA_GLOBALSINDEX);
- lua_setfield(L, -2, "__index"); /* mt.__index = _G */
- return 0;
-}
-
-
/* }====================================================== */
@@ -606,13 +577,6 @@ static void setpath (lua_State *L, const char *fieldname, const char *envname,
}
-static const luaL_Reg pk_funcs[] = {
- {"loadlib", ll_loadlib},
- {"seeall", ll_seeall},
- {NULL, NULL}
-};
-
-
static const luaL_Reg ll_funcs[] = {
{"module", ll_module},
{"require", ll_require},
@@ -630,8 +594,6 @@ LUALIB_API int luaopen_package (lua_State *L) {
luaL_newmetatable(L, "_LOADLIB");
lua_pushcfunction(L, gctm);
lua_setfield(L, -2, "__gc");
- /* create `package' table */
- luaL_register(L, LUA_LOADLIBNAME, pk_funcs);
#if defined(LUA_COMPAT_LOADLIB)
lua_getfield(L, -1, "loadlib");
lua_setfield(L, LUA_GLOBALSINDEX, "loadlib");
diff --git a/src/luaconf.h b/src/luaconf.h
index 6d30f18..13d62a4 100644
--- a/src/luaconf.h
+++ b/src/luaconf.h
@@ -268,13 +268,6 @@
#undef LUA_COMPAT_GETN
/*
-@@ LUA_COMPAT_LOADLIB controls compatibility about global loadlib.
-** CHANGE it to undefined as soon as you do not need a global 'loadlib'
-** function (the function is still available as 'package.loadlib').
-*/
-#undef LUA_COMPAT_LOADLIB
-
-/*
@@ LUA_COMPAT_VARARG controls compatibility with old vararg feature.
** CHANGE it to undefined as soon as your programs use only '...' to
** access vararg parameters (instead of the old 'arg' table).
diff --git a/src/lualib.h b/src/lualib.h
index 779f195..6964d41 100644
--- a/src/lualib.h
+++ b/src/lualib.h
@@ -60,9 +60,6 @@ LUALIB_API int (luaopen_ssl_config) (lua_State *L);
#define LUA_DBLIBNAME "debug"
LUALIB_API int (luaopen_debug) (lua_State *L);
-#define LUA_LOADLIBNAME "package"
-LUALIB_API int (luaopen_package) (lua_State *L);
-
/* open all previous libraries */
LUALIB_API void (luaL_openlibs) (lua_State *L);