]> xenbits.xensource.com Git - unikraft/libs/lua.git/commitdiff
patches: Remove outdated patch
authorStefan Jumarea <stefanjumarea02@gmail.com>
Mon, 17 Jul 2023 07:28:48 +0000 (10:28 +0300)
committerUnikraft <monkey@unikraft.io>
Tue, 25 Jul 2023 06:55:33 +0000 (06:55 +0000)
The patch was:
* Replacing the lua `main` symbol with `lua_main`.
* Removing checking that the given argument was a script, instead
  checking if there is an initrd filesystem present and trying to
  execute it.

The `main` symbol is already replaced in the preprocessing stage by
adding `-Dmain=lua_main` in the `Makefile.uk` flags, so renaming it is
not needed.

Trying to execute the initrd without properly extracting it will
obviously fail, since `lua` will not be able to read the script properly.
This will result in an `malformed number near '0707010..'` error.

The check for initrd is not needed at all, since the fs driver is
transparent for the application, and the script can be accessed as an
usual file, regardless of the fs driver (initrd, 9pfs, etc.).

Signed-off-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #8

patches/0001-lua-main-add-initrd.patch [deleted file]

diff --git a/patches/0001-lua-main-add-initrd.patch b/patches/0001-lua-main-add-initrd.patch
deleted file mode 100644 (file)
index ecfb8f0..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
---- a/src/lua.c        2017-04-19 19:29:57.000000000 +0200
-+++ b/src/lua.c        2020-02-12 19:38:09.704428160 +0100
-@@ -6,6 +6,8 @@
- #define lua_c
-+#include <uk/plat/memory.h>
-+
- #include "lprefix.h"
-@@ -555,6 +557,9 @@
-   int argc = (int)lua_tointeger(L, 1);
-   char **argv = (char **)lua_touserdata(L, 2);
-   int script;
-+  struct ukplat_memregion_desc img;
-+  char *cstr;
-+  
-   int args = collectargs(argv, &script);
-   luaL_checkversion(L);  /* check that interpreter has correct version */
-   if (argv[0] && argv[0][0]) progname = argv[0];
-@@ -576,24 +581,23 @@
-   }
-   if (!runargs(L, argv, script))  /* execute arguments -e and -l */
-     return 0;  /* something failed */
--  if (script < argc &&  /* execute main script (if there is one) */
--      handle_script(L, argv + script) != LUA_OK)
--    return 0;
-   if (args & has_i)  /* -i option? */
-     doREPL(L);  /* do read-eval-print loop */
--  else if (script == argc && !(args & (has_e | has_v))) {  /* no arguments? */
--    if (lua_stdin_is_tty()) {  /* running in interactive mode? */
-+  /* see if script is available from initrd */
-+  else if (ukplat_memregion_find_initrd0(&img) >= 0) {
-+    cstr = (char *)img.base;
-+    dostring(L, cstr, "initrd");
-+  }
-+  else {
-       print_version();
-       doREPL(L);  /* do read-eval-print loop */
--    }
--    else dofile(L, NULL);  /* executes stdin as a file */
-   }
-   lua_pushboolean(L, 1);  /* signal no errors */
-   return 1;
- }
--int main (int argc, char **argv) {
-+int lua_main (int argc, char **argv) {
-   int status, result;
-   lua_State *L = luaL_newstate();  /* create state */
-   if (L == NULL) {