Hi Zhao,
Lmod always executes modulefiles inside a restricted sandbox; there is no setting to allow full Lua execution directly in a modulefile. To run unrestricted Lua, place your logic in SitePackage.lua (which is not sandboxed) and expose selected functions to modulefiles via sandbox_registration. This is the supported way to grant modulefiles controlled access to full Lua. Modifying src/sandbox.lua to loosen restrictions is possible but unsafe and not recommended. For details, see the “SitePackage.lua and the Sandbox” section of the Lmod documentation. If you share what functionality you need, I can suggest the safest approach.
Best,
Matthew
From: Hongyi Zhao <hon...@gm...>
Date: Monday, December 1, 2025 at 19:44
To: lmod-users <lmo...@li...>
Subject: [Lmod-users] Query regarding Lua sandbox limitations and executing arbitrary Lua code in modulefiles.
Dear Robert and the Lmod community,
It appears that Lmod runs modulefiles within a restricted sandbox
environment, limiting access to the full standard Lua library (e.g.,
certain `os.*` or `io.*` functions).
Is there a configuration option or a specific method to allow the
execution of **arbitrary/full Lua code** directly within a `.lua`
modulefile?
Best regards,
Zhao
--
Assoc. Prof. Hongsheng Zhao <hon...@gm...>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province
_______________________________________________
Lmod-users mailing list
Lmo...@li...
https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.sourceforge.net%2Flists%2Flistinfo%2Flmod-users&data=05%7C02%7C%7Cb9ca750255ac46f0070608de314453cd%7C31d7e2a5bdd8414e9e97bea998ebdfe1%7C0%7C0%7C639002366699830382%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=LjpMAdMkyUbd6df7o054X8MTkd%2Bu93yxUd5H%2BrzFVZw%3D&reserved=0<https://lists.sourceforge.net/lists/listinfo/lmod-users>
>> This message is from an external sender. Learn more about why this <<
>> matters at https://links.utexas.edu/rtyclf. <<
|