[OS X TeX] [OT] getting mathtex.cgi to run
Peter_Dyballa at Web.DE
Thu Oct 23 19:41:07 EDT 2008
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!
Mathtex.c has the lines:
#define CACHE "mathtex/" /* relative to mathtex.cgi */
#define CACHELOG "mathtex.log" /* default cache log file */
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 /
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 ...
There are two major products that come out of Berkeley: LSD and UNIX.
We don't believe this to be a coincidence.
- Jeremy S. Anderson
More information about the MacOSX-TeX