Bug 2302036

Summary: Lmod fails to run when installed in mockbuild / container
Product: [Fedora] Fedora Reporter: Jan AndrĂ© Reuter <j.reuter>
Component: lua-jsonAssignee: Michel Lind <michel>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: michel, orion
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: lua-json-1.3.4-8.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-08-02 02:23:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan André Reuter 2024-07-31 12:12:14 UTC
While trying to figure out what is broken in https://bugzilla.redhat.com/show_bug.cgi?id=2301980, I tried to rebuild Scalasca for Fedora Rawhide.

After figuring out another issue preventing GCC from being detected correctly, I consistently was not able to load any MPI. The fedpkg mockbuild output showed this:

+ cd -
+ for mpi in mpich openmpi
+ mkdir mpich
+ cd mpich
+ module load mpi/mpich-x86_64
+ '[' -z '' ']'
+ case "$-" in
+ __lmod_sh_dbg=x
+ '[' -n x ']'
+ set +x
Shell debugging temporarily silenced: export LMOD_SH_DBG_ON=1 for Lmod's output
/usr/bin/lua: /usr/share/lua/5.4/json/decode/util.lua:97: attempt to call a string value (field 'version')
stack traceback:
	/usr/share/lua/5.4/json/decode/util.lua:97: in main chunk
	[C]: in function 'require'
	/usr/share/lua/5.4/json/decode.lua:12: in main chunk
	[C]: in function 'require'
	/usr/share/lua/5.4/json.lua:5: in main chunk
	[C]: in function 'require'
	/usr/share/lmod/lmod/libexec/../shells/JsonShell.lua:46: in main chunk
	[C]: in function 'require'
	/usr/share/lmod/lmod/libexec/../shells/BaseShell.lua:295: in upvalue 'l_createShellTbl'
	/usr/share/lmod/lmod/libexec/../shells/BaseShell.lua:327: in function 'BaseShell.isValid'
	/usr/share/lmod/lmod/libexec/utils.lua:1211: in function 'dynamic_shell'
	/usr/share/lmod/lmod/libexec/lmod:342: in function 'main'
	/usr/share/lmod/lmod/libexec/lmod:588: in main chunk
	[C]: in ?
Shell debugging restarted
+ unset __lmod_sh_dbg
+ return 0

I then tried to investigate this a bit further. Trying to install Lmod in a podman instance of Fedora Rawhide, I was able to trigger the same error easily by just installing Lmod without any additional packages.

Unfortunately, this prevents me from trying to rebuild Scalasca. Building for Fedora 40 works fine. Therefore, I expect that a recent update broke something. 

Reproducible: Always

Steps to Reproduce:
1. On a machine, start a Fedora container, e.g. via `podman run -it fedora:rawhide bash`
2. Run `dnf update && dnf install Lmod -y`
3. Run `source /etc/profile`
4. Run `module`
Actual Results:  
One should see the typical long output of Lmod for help

Expected Results:  
Lmod crashes with:

/usr/bin/lua: /usr/share/lua/5.4/json/decode/util.lua:97: attempt to call a string value (field 'version')
stack traceback:
	/usr/share/lua/5.4/json/decode/util.lua:97: in main chunk
	[C]: in function 'require'
	/usr/share/lua/5.4/json/decode.lua:12: in main chunk
	[C]: in function 'require'
	/usr/share/lua/5.4/json.lua:5: in main chunk
	[C]: in function 'require'
	/usr/share/lmod/lmod/libexec/../shells/JsonShell.lua:46: in main chunk
	[C]: in function 'require'
	/usr/share/lmod/lmod/libexec/../shells/BaseShell.lua:295: in upvalue 'l_createShellTbl'
	/usr/share/lmod/lmod/libexec/../shells/BaseShell.lua:327: in function 'BaseShell.isValid'
	/usr/share/lmod/lmod/libexec/utils.lua:1211: in function 'dynamic_shell'
	/usr/share/lmod/lmod/libexec/lmod:342: in function 'main'
	/usr/share/lmod/lmod/libexec/lmod:588: in main chunk
	[C]: in ?

Comment 1 Orion Poplawski 2024-08-01 03:25:10 UTC
The issue is that lua-lpeg went from defining lpeg.version as a function in 1.0.2 to a string in 1.1.0.  This is apparently intentional as indicated in https://www.inf.puc-rio.br/~roberto/lpeg/#func.  There is apparently a fix for handling this upstream in lua-json here: https://github.com/harningt/luajson/pull/48 but it hasn't been released yet.