LabLua in Google Summer of Code 2024
We were very happy to participate again in Google Summer of Code (GSoC)! This is the 9th time we had the opportunity to collaborate with students from all around the world on interesting projects. These are the highlights from the 2024 edition.
- Adapt LuaSQL drivers to Lua 5.4
- Improved debugging support for Pallene
- Lunatik binding for Netfilter
- Port LuaRocks to Teal
Adapt LuaSQL drivers to Lua 5.4
LuaSQL is a library that bridges Lua with various database management systems (DBMS), providing a consistent API for interacting with databases such as MySQL, PostgreSQL, SQLite, and others. With the release of Lua 5.4, the LuaSQL drivers required updates to maintain compatibility and take advantage of the new features introduced in this version. The project involved several key tasks:
- Resolved Incompatibilities: Updated the API by replacing lua_newuserdata with lua_newuserdatauv, ensuring seamless compatibility with Lua 5.4.
- Introduced LUASQL_NEWUD Macro: Developed a macro to abstract version-specific differences in userdata creation, making the codebase more adaptable to different Lua versions.
- To-Be-Closed Variables: Added support for Lua 5.4's to-be-closed variables by incorporating the __close metamethod for environment, connection, and cursor objects, ensuring proper resource management.
- Resource Cleanup: Standardized cleanup methods across all drivers, and improved error handling.
- Expanded Test Suite: Enhanced the test suite to thoroughly verify the implementation of these updates, particularly the to-be-closed support.
In conclusion, the LuaSQL drivers have been successfully updated to be fully compatible with Lua 5.4, incorporating new features and enhancements that improve performance, resource management, and maintainability, ensuring a smooth transition for users to the latest Lua version. An updated version of LuaSQL, incorporating all the mentioned updates, will soon be released.
The Code
The results of this GSOC are summarized in this page. It includes a link to code repository, as well as a list of the pull requests implemented by Chaitanya. Latest version of LuaSQL can be found on LuaRocks, with its updated documentation.
The Student
Chaitanya Deshmukh is an undergraduate student pursuing a degree in Electronics and Communication Engineering from India. He has a keen interest in software development, cloud native technologies, and database management. He is enthusiastic about building innovative solutions and staying updated with the latest trends in the tech industry.
Mentors
Tomás GuisasolaImproved debugging support for Pallene
Pallene is type inferred, ahead-of-time compiled companion language to Lua designed for performance. This is a space currently filled by LuaJIT and Lua C modules. Pallenes syntax is similar to Lua's allowing users to write high-performance code swiftly.
Pallene's debugging experience was hampered by how Lua stack traces display C stack frames, because Pallene compiles down to C. The Lua call stack does not store the line numbers for Lua-to-C calls and does not show C-to-C calls. To address the problem not only for Pallene but also for Lua C modules in general, we created a new library, Pallene Tracer. It provides mechanisms to enable function tracebacks, generating a proper stack-trace for all the C call-frames and their respective line numbers, without modifying the Lua virtual machine. Hence, over the summer time we worked on Pallene Tracer, its adoption in Pallene and finally its adoption into Lua C modules. You can learn more about this journey in Asif's blog.
The Code
For this project we created a Github repository for pallene-tracer. We also created pull requests code to integrate Pallene with Pallene Tracer.
The Student
Syed Naimul Hasan Asif (alias SD Asif Hossein) is an Electrical Engineering undergrad student from Bangladesh. He is passionate about low-level programming, programming languages, operating systems, deep learning and high-performance computing.Mentors
Hugo Gualandi, Srijan Paul, Gabriel LigneulLunatik binding for Netfilter
Lunatik is a framework for scripting the Linux kernel with Lua. It is composed by the Lua interpreter modified to run in the kernel; a device driver (written in Lua =)) and a command line tool to load and run scripts and manage runtime environments from the user space; a C API to load and run scripts and manage runtime environments from the kernel; and Lua APIs for binding kernel facilities to Lua scripts.
The goal of this project was to enable lunatik users to write netfilter kernel modules, xtables (legacy) kernel and corresponding userspace extensions entirely in Lua.
The Code
The code is already merged in the Lunatik repository and a report containing Shehar's contributions can be found here.
The Student
Mohammad Shehar Yaar Tausif is a final year under-graduate student at Indian Institute of Technology (IIT), Kharagpur in India. He is an open-source enthusiast with contributions in multiple open-source projects. Shehar loves working on low-level stuff and is currently exploring Linux Kernel, Networking and Distributed Systems.
Mentors
Lourival Vieira Neto, Marcel MouraPort LuaRocks to Teal
LuaRocks is a package manager for the Lua programming language. It allows developers to install, manage, and distribute Lua packages, which are collections of Lua modules that provide specific functionality. Our project converted the LuaRocks codebase from Lua to Teal, a statically typed dialect of Lua, to make the whole repository easier to read, understand, and improve.
The experience of working on a project with LabLua was amazing and my mentor made it truly one of a kind. I will never forget, not only the things I learned about Lua and Teal, but also all the general tips I received about writing proper code, testing and deploying it, etc. that I will for sure use in the future. I would recommend this experience to everyone considering to apply!