[OS X TeX] [OT] getting mathtex.cgi to run

Alan Munn amunn at msu.edu
Mon Oct 27 17:49:22 CET 2008


At 1:41 AM +0200 10/24/08, Peter Dyballa wrote:
>Am 23.10.2008 um 20:34 schrieb Alan Munn:
>
>>If I just put the file in the CGI folder, it fails to have 
>>sufficient permissions to create two temp directories.  I fixed 
>>this (dangerously, I suspect) by doing sudo chmod u+s mathtex.cgi, 
>>but then I get the error that it can't run the latex program.  
>>(This is generated by the script itself, so the script is working). 
>>At first I thought that the problem was building the script with 
>>/usr/texbin/latex etc. as the relevant path, so I rebuilt it with 
>>the full path (/usr/local/texlive/2007/bin/i386-darwin/latex) but 
>>that still didn't fix the problem.
>
>There is a very easy solution: re-compile mathtex.cgi with 
>-DCACHE=\"path/\" and path is /var/tmp/... The optimal path would 
>start with /var/tmp/folders.`id -u` - but the command id -u would 
>have to be executed at run-time!

Thanks for your suggestions, Pete.

Unfortunately,  this didn't seem to work.

>
>Mathtex.c has the lines:
>
>#if !defined(CACHE) 
>   #define CACHE "mathtex/"		/* relative to mathtex.cgi */
>#endif
>#if !defined(CACHELOG)	 
>   #define CACHELOG "mathtex.log"	/* default cache log file */
>#endif
>
>so by default it creates the directory 
>/Library/Webserver/CGI-Executables/mathtex and in it the default LOG 
>file mathtex.log. You could help mathtex.cgi you could:
>
>	sudo mkdir /Library/Webserver/CGI-Executables/mathtex
>	sudo chmod 777 /Library/Webserver/CGI-Executables/mathtex
>	sudo touch /Library/Webserver/CGI-Executables/mathtex/mathtex.log
>	sudo chmod 666 /Library/Webserver/CGI-Executables/mathtex/mathtex.log
>	sudo chown -R www /Library/Webserver/CGI-Executables/mathtex
>
>This way the directory /Library/Webserver/CGI-Executables/mathtex 
>would be open for all and everyone could delete or change the file 
>/Library/Webserver/CGI-Executables/mathtex/mathtex.log.

This is what I tried, and it doesn't work.

>
>Apache runs with uid set to www, I think. When mathtex.cgi inherits 
>this then the directory could be made 775 and the LOG file 664, but 
>this is a guess, *not* allowing everyone to do everything.
>
>The last option is to make the programme setuid bit, i.e., sudo 
>chmod +s mathtex.cgi. This would make the programme run under the 
>uid of the LOG file owner, i.e., www, the owner of 
>/Library/Webserver/CGI-Executables/mathtex and the owner of the 
>Apache process (I think). And this should resolve all permission 
>problems ...

But it didn't.  I think I'm giving up on this.  There's something I 
clearly don't understand about permissions within the CGI-Executables 
folder.

The only thing that partially works is when mathtex.cgi is owned by root.

Then it correctly creates the mathtex folder inside CGI-Executables

But then the error I get is that it can't find the LaTeX programs, 
even though it was compiled with the correct path to latex.

I'm not sure I want to waste too much of my or your time on this.

Alan




-- 
Alan Munn						amunn at msu.edu
Department of Linguistics
and Germanic, Slavic, Asian and African Languages		Tel. 
	517-355-7491
Michigan State University, East Lansing MI 48824 USA	Fax	517-432-2736



More information about the macostex-archives mailing list