I am putting together a QA system for our company. I'm using LyX to edit the individual documents, and perl (CGI) scripts to pull it together and do the housekeeping.

One of the jobs I am trying to script is regenerating the whole manual when method statements/procedures have been reissued. I can generate a LyX file with embedded references to all the other LyX files (around 200 of them). Then I want to run "lyx -e latex" against this file to generate LaTeX files to run pdflatex and latex2html against to recreate a PDF and web-site of the whole system.

This works manually. And it works if I run a perl-script from the command-line that calls these commands. But if I try to call the script from a web browser, "lyx -e latex" stalls and the script never returns. I have to kill -9 the lyx process to get rid of the script process.

I don't think it's an ownership/permissions issue. I have created a minimal script that just chdir's to the relevant directory, and then calls lyx -e latex against the relevant file. I can su to the user that apache runs as and call the script, and it runs fine. But if I call the identical script from the browser, it stalls as described. I think the above also indicates it's not a tainting issue (everything is hardcoded - no parameters are passed in this stripped-down script).

I have tried the various ways of calling lyx (backticks, system with list, system with whole command passed as single parameter, fork + exec) and it doesn't make any difference. I have tried calling lyx.bin instead of lyx (which is just a shell wrapper on my system). Of course, I use full paths for the binary and file.

There is no problem if the file called does not contain many embedded files. The problem started when the number of embedded files reached a critical point.

When you run lyx -e latex against a LyX file containing references to embedded files, it seems to run the command against the embedded files as well as the main file. I can tell from looking at the file modification times exactly where the script stalled. It processes around 30 embedded files before stalling. I can run lyx -e latex against the last file to be processed, or any of the succeeding ones without problem, so I don't think it's problems with the individual files.

I am suspicious that it runs out of resources of some sort, but I have no idea what resource constraints there might be on perl called from a CGI-script (not mod_perl) that didn't apply to perl called from the command line.

Sorry for the long explanation, but I wanted to get all the facts in. Does anyone have any ideas why "lyx -e latex" on a file with many embedded children would stall when called from a perl CGI-script? Thanks, Bruno


In reply to Calling "lyx -e latex" from perl CGI-script by bgprior

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.