pandoc icon indicating copy to clipboard operation
pandoc copied to clipboard

pandoc-lua can't require binary packages when installed with Conda

Open iandol opened this issue 1 year ago • 5 comments

Explain the problem.

This is a weird issue. I've been trying to switch to more isolated workflow, using local environments of tools, and in this case used a conda manager pixi to install lua luarocks and pandoc local to a working folder. I used luarocks to install a lua debugging package mobdebug. Given a minimal test.lua script:

md = require("mobdebug")

print("Hello World")

Run with lua it is ok:

ζ lua test.lua 
Hello World

but run with pandoc-lua, a mapping process and mapped file (non-platform) have different Team IDs error occurs:

ζ ➪ pandoc-lua test.lua
Error running Lua:
error loading module 'socket.core' from file '/Users/ian/Code/dotpandoc/.pixi/envs/default/lib/lua/5.4/socket/core.so':
	dlopen(/Users/ian/Code/dotpandoc/.pixi/envs/default/lib/lua/5.4/socket/core.so, 0x0006): tried: '/Users/ian/Code/dotpandoc/.pixi/envs/default/lib/lua/5.4/socket/core.so' (code signature in <605C052E-EA8E-36D3-9CC1-598BA8D1AC1E> '/Users/ian/Code/dotpandoc/.pixi/envs/default/lib/lua/5.4/socket/core.so' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/System/Volumes/Preboot/Cryptexes/OS/Users/ian/Code/dotpandoc/.pixi/envs/default/lib/lua/5.4/socket/core.so' (no such file), '/Users/ian/Code/dotpandoc/.pixi/envs/default/lib/lua/5.4/socket/core.so' (code signature in <605C052E-EA8E-36D3-9CC1-598BA8D1AC1E> '/Users/ian/Code/dotpandoc/.pixi/envs/default/lib/lua/5.4/socket/core.so' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)
stack traceback:
	[C]: in function 'require'
	...de/dotpandoc/.pixi/envs/default/share/lua/5.4/socket.lua:12: in main chunk
	[C]: in function 'require'
	.../dotpandoc/.pixi/envs/default/share/lua/5.4/mobdebug.lua:99: in main chunk
	[C]: in function 'require'
	test.lua:2: in main chunk

This error only occurs for compiled libraries, pure lua code requires are ok. Something in the way pandoc is compiled increases the security level of the bundled lua. I thought I'd report this edge case for visibility than imagining it could be fixed.

Pandoc version? V3.3 on macOS 14.6

iandol avatar Aug 08 '24 01:08 iandol

See also #6850. A PR to clear that up in the docs would be greatly appreciated.

tarleb avatar Aug 08 '24 08:08 tarleb

Thanks @tarleb -- this is quite a messy issue to document, the current reference to this in the docs is only for the statically-linked linux build, and my issue was on a conda-built binary for macOS. I wonder if a note right at the top under Installing pandoc for statically-linked builds in general then referenced by each OS?

iandol avatar Aug 14 '24 01:08 iandol

I also wonder whether it is worth mentioning the fact that Conda can be used to install pandoc is worth adding to that doc as well?

iandol avatar Aug 14 '24 01:08 iandol

Adding Conda as another install option would be good, I think :+1:

I wonder if a note right at the top under Installing pandoc for statically-linked builds in general then referenced by each OS?

Good idea. Would you have time to create a PR?

tarleb avatar Aug 14 '24 17:08 tarleb

Yes, I can do this.

iandol avatar Aug 15 '24 00:08 iandol

Fixed via #10098.

tarleb avatar Jul 20 '25 17:07 tarleb