[MediaWiki-l] Problem wfShellExec

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[MediaWiki-l] Problem wfShellExec

Javier Bezos-2
I'm not sure this is a problem in the server or in MediaWiki.

I have an extension which calls a bash script with wfShellExec. The
bash file consists essentially of

touch $1.A
latex $1
dvipng $1
touch $1.B

The touch'es are just to see if the bash file is run. And indeed it's.
However, neither .dvi nor .log files are created (which are the result
of running latex). However, when running the script from the
command line everything is ok.

This extension is based on WikiTeX.php, and the lines calling the
script are:

$cmd =  wfEscapeShellArg( $wfTexConvert, $tempName, $dpi, "$storedir/$hash"
);
wfProfileIn( "TeX-shellexec" );
$convtext = trim( wfShellExec( $cmd ) );
wfProfileOut( "TeX-shellexec" );

Any ideas about what's wrong? Perhaps some permission not set?

By the way, TeX is TeXLive2012, installed separately, and the site is
www.wikilengua.org .

Javier



--
______________________________

Javier Bezos López
T. 34 913 467 440
www.fundeu.es
www.wikilengua.org
www.manualdeestilo.com
Twitter <http://www.twitter.com/fundeu>,
Facebook<http://www.facebook.com/fundeu>,
YouTube <http://www.youtube.com/user/fundeu>y Google+<http://gplus.to/fundeu>
_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem wfShellExec

Moritz Schubotz-2
Hi Javier,

you might want to have a look at the math extension.

https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FMath/39c785dc30edc044f371f86e9cf2e2d777421992/MathTexvc.php#L204

There you see how it's done for calling texvc.
You might also want to consider to use LaTeXML instead of shelling out.
LaTeXML covers a wide range of LaTeX (including citations) and can be runs
as web-service, that produces MathML.

https://www.mediawiki.org/wiki/Extension:Math#LaTeXML

Best
Moritz





On Mon, Oct 7, 2013 at 3:14 AM, Javier Bezos <[hidden email]> wrote:

> I'm not sure this is a problem in the server or in MediaWiki.
>
> I have an extension which calls a bash script with wfShellExec. The
> bash file consists essentially of
>
> touch $1.A
> latex $1
> dvipng $1
> touch $1.B
>
> The touch'es are just to see if the bash file is run. And indeed it's.
> However, neither .dvi nor .log files are created (which are the result
> of running latex). However, when running the script from the
> command line everything is ok.
>
> This extension is based on WikiTeX.php, and the lines calling the
> script are:
>
> $cmd =  wfEscapeShellArg( $wfTexConvert, $tempName, $dpi, "$storedir/$hash"
> );
> wfProfileIn( "TeX-shellexec" );
> $convtext = trim( wfShellExec( $cmd ) );
> wfProfileOut( "TeX-shellexec" );
>
> Any ideas about what's wrong? Perhaps some permission not set?
>
> By the way, TeX is TeXLive2012, installed separately, and the site is
> www.wikilengua.org .
>
> Javier
>
>
>
> --
> ______________________________
>
> Javier Bezos López
> T. 34 913 467 440
> www.fundeu.es
> www.wikilengua.org
> www.manualdeestilo.com
> Twitter <http://www.twitter.com/fundeu>,
> Facebook<http://www.facebook.com/fundeu>,
> YouTube <http://www.youtube.com/user/fundeu>y Google+<
> http://gplus.to/fundeu>
> _______________________________________________
> MediaWiki-l mailing list
> [hidden email]
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>



--
Mit freundlichen Grüßen
Moritz Schubotz

  Telefon (Büro):  +49 30 314 22784
  Telefon (Privat):+49 30 488 27330
  E-Mail: [hidden email]
  Web: http://www.physikerwelt.de
  Skype: Schubi87
  ICQ: 200302764
  Msn: [hidden email]
_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem wfShellExec

Javier Bezos-2
And the server is Nginx.

Javier


2013/10/7 Javier Bezos <[hidden email]>

> I'm not sure this is a problem in the server or in MediaWiki.
>
> I have an extension which calls a bash script with wfShellExec. The
> bash file consists essentially of
>
> touch $1.A
> latex $1
> dvipng $1
> touch $1.B
>
> The touch'es are just to see if the bash file is run. And indeed it's.
> However, neither .dvi nor .log files are created (which are the result
> of running latex). However, when running the script from the
> command line everything is ok.
>
> This extension is based on WikiTeX.php, and the lines calling the
> script are:
>
> $cmd =  wfEscapeShellArg( $wfTexConvert, $tempName, $dpi,
> "$storedir/$hash" );
> wfProfileIn( "TeX-shellexec" );
> $convtext = trim( wfShellExec( $cmd ) );
> wfProfileOut( "TeX-shellexec" );
>
> Any ideas about what's wrong? Perhaps some permission not set?
>
> By the way, TeX is TeXLive2012, installed separately, and the site is
> www.wikilengua.org .
>
> Javier
>
>
>
> --
> ______________________________
>
> Javier Bezos López
> T. 34 913 467 440
> www.fundeu.es
> www.wikilengua.org
> www.manualdeestilo.com
> Twitter <http://www.twitter.com/fundeu>, Facebook<http://www.facebook.com/fundeu>,
> YouTube <http://www.youtube.com/user/fundeu>y Google+<http://gplus.to/fundeu>
>
>
>


--
______________________________

Javier Bezos López
T. 34 913 467 440
www.fundeu.es
www.wikilengua.org
www.manualdeestilo.com
Twitter <http://www.twitter.com/fundeu>,
Facebook<http://www.facebook.com/fundeu>,
YouTube <http://www.youtube.com/user/fundeu>y Google+<http://gplus.to/fundeu>
_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: Problem wfShellExec

Marcin Cieslak-3
In reply to this post by Javier Bezos-2
>> Javier Bezos <[hidden email]> wrote:
> The touch'es are just to see if the bash file is run. And indeed it's.
> However, neither .dvi nor .log files are created (which are the result
> of running latex). However, when running the script from the
> command line everything is ok.

Most probably this is related to file access permissions.
Keep in mind that the script is executed as the webserver
user ("www", "apache", "nobody", ....) which is probably
different than the user you are logged as when trying
it from the command line.

First, I would figure out ("pwd > /tmp/whereami" from the
script) where your script ends up running (and in which
directory it attempts to create files), and then
check permissions on that directory.

//Saper


_______________________________________________
MediaWiki-l mailing list
[hidden email]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l