Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 902495

Summary: app-text/texlive-2021 pdftex launched from php failed on redundant part of script
Product: Gentoo Linux Reporter: zbynek.hubinka
Component: Current packagesAssignee: TeX project <tex>
Status: UNCONFIRMED ---    
Severity: normal CC: flow, jstein, zbynek.hubinka
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description zbynek.hubinka 2023-03-21 06:40:59 UTC
When pdftex is launched from php (i. e. by exec() or system()), crashes with error in script /usr/share/texmf-dist/tex/luatex/lualibs/lualibs-basic-merged.lua, line 4211. There is a conditional construction to recognize OS type by questionable presence of PATH variable, especially a semicolon sign in it. PHP in default not supply the environment variables, so the function find(where, what,...) get value of nil instead of string and crashes. Older version of lua probably handled this as a warning and no error appeared. 

One solution: keeping the issue in mind and do not forget to copy the PATH variable into PHP by putenv(). This should be a problem in third-party hosted systems, because it can be considered as security option. 

Other: make a complex patch to texlive distribution, which throws out all the obviously redundant parts of the script connected with the OS detection (it is clear the system is NOT Windows). 

Another one: make a patch which just add a comment into line 4211:

local onwindows=os.type=="windows" or find(os.getenv("PATH"),";",1,true)

to

local onwindows=false -- os.type=="windows" or find(os.getenv("PATH"),";",1,true)

this should be satisfactory. Unfortunately I'm not very common with patching.
Comment 1 Florian Schmaus gentoo-dev 2024-03-01 10:35:16 UTC
This should be reported and fixed upstream.

@zbynek.hubinka@tul.cz would you mind making a report upstream and mention the link to the report here?
Comment 2 zbynek.hubinka 2024-03-01 11:00:37 UTC
(In reply to Florian Schmaus from comment #1)
> This should be reported and fixed upstream.
> 
> @zbynek.hubinka@tul.cz would you mind making a report upstream and mention
> the link to the report here?

OK, but I am new at bugzilla, so I do not know how.