Hi Kilian, Miguel and slurm-users

As LUA_GLOBALSINDEX has been removed in Lua 5.2 and it's used in slurm-spank-plugins (http://www.lua.org/manual/5.2/manual.html#8) the build of slurm-spank-plugins-lua is failing on redhat8 which uses lua5.3.

/lua.c: error: ‘LUA_GLOBALSINDEX’ undeclared (first use in this//function) />/lua_pushvalue (script->L, LUA_GLOBALSINDEX); /I've made the following patchfor slurm-spank-plugins-lua using this helpfull page:

https://stackoverflow.com/questions/28332452/porting-from-lua-5-1-to-5-2

The patch are still not in production but at least the lua plugins are now built and loaded by slurm19 and lua5.3 (redhat8)

 cat slurm-spank-plugins-0.24-undefined-lua5.3-variable.patch
--- slurm-spank-plugins-0.24.orig/lua/lua.c    2013-03-26 11:48:48.000000000 +0100 +++ slurm-spank-plugins-0.24.work/lua/lua.c    2020-02-12 13:31:03.629012000 +0100
@@ -1045,7 +1045,8 @@
      *   table.
      */
     lua_pushstring (script->L, "__index");
-    lua_pushvalue (script->L, LUA_GLOBALSINDEX);
+//    lua_pushvalue (script->L, LUA_GLOBALSINDEX);
+    lua_pushglobaltable(script->L);
     lua_settable (script->L, -3);

     /*  Now set metatable for the new globals table */
@@ -1054,8 +1055,8 @@
     /*  And finally replace the globals table with the (empty) table
      *   now at top of the stack
      */
-    lua_replace (script->L, LUA_GLOBALSINDEX);
-
+//    lua_replace (script->L, LUA_GLOBALSINDEX);
+    lua_rawseti(script->L,LUA_REGISTRYINDEX,LUA_RIDX_GLOBALS);
     return script;
 }

cat slurm-spank-plugins-0.24-fix-cpu-expand-test.patch
diff -rau slurm-spank-plugins-0.24.orig/lua/lua-schedutils/lua-schedutils.c slurm-spank-plugins-0.24.work/lua/lua-schedutils/lua-schedutils.c --- slurm-spank-plugins-0.24.orig/lua/lua-schedutils/lua-schedutils.c 2013-03-26 10:48:48.000000000 +0000 +++ slurm-spank-plugins-0.24.work/lua/lua-schedutils/lua-schedutils.c 2020-02-06 13:06:27.994728000 +0000
@@ -575,7 +575,7 @@
          *  Push CPU id, either to be used as argument to function, or
          *   as an element for the table:
          */
-        lua_pushnumber (L, i);
+        lua_pushinteger(L, i);

         /*
          *  Call function if needed and leave the result on the stack.


Hope it helps a minimum.

Regards
Regine

Reply via email to