Item1238: working\tmp files have wrong permissions for genpdf to work
Priority: Normal
Current State: No Action Required
Released In:
Target Release: n/a
Foswiki 1.0 on Win2003 with cygwin perl and Apache (
WampServer 2.0), HTMLDOC 1.8.27. After installing GenPDFAddOn, and poking the 'Generate PDF' button, the working/tmp directory gets populated with files like this:
-rw------- 1 SYSTEM root 4432 Mar 10 08:16 GenPDFAddOnPdUQf4l1X3.html (amongst others)
My error.log gets a message like this:
htmldoc produced zero length output (C:/bin/HTMLDOC/htmldoc.exe): HTMLDOC Version 1.8.27 Copyright 1997-2006 Easy Software Products, All Rights Reserved.
This software is based in part on the work of the Independent JPEG Group.
ERROR: No HTML files!
Usage:
htmldoc [options] filename1.html [ ... filenameN.html ]
...
... (and after the rest of the helpscreen output) ...
... (the command line arguments used.)
--book --quiet --links --linkstyle plain --outfile /cygdrive/f/www/ElectronicsWiki/working/tmp/GenPDFAddOnciaRoCNBCS.pdf --format pdf14 --portrait --size letter --path /cygdrive/f/www/ElectronicsWiki/working/tmp --browserwidth 860 --titlefile /cygdrive/f/www/ElectronicsWiki/working/tmp/GenPDFAddOnybAdNhi59z.html --no-toc --firstpage p1 --duplex --pagelayout single --pagemode outline /cygdrive/f/www/ElectronicsWiki/working/tmp/GenPDFAddOnDouIAV4uuJ.html
Which seems to go away when I manually change the permissions to something like this:
-rwxrwxrwx 1 SYSTEM root 47748 Mar 10 07:27 GenPDFAddOnPnPyNAbpCp.html
and then from the DOS prompt run this:
C:\>c:\bin\HTMLDOC\htmldoc.exe f:\www\FOSWiki\working\tmp\GenPDFAddOnPnPyNAbpCp.html
I believe that htmldoc doesn't have enough permission to read the input file, but I don't know how to convince genpdf to loosen its permissions. Could I have done something different in my initial setup, or in my set_foswiki_permissions script?
I'm also having issues with mailnotify that I need to hunt down. Perhaps Windows programs running under Apache don't have the authority to access cygwin controlled files??? Perhaps I should have added
CYGWIN=ntsec to my .bash_profile when installing cygwin or something(doc problem). Or maybe genpdf should just allow "other" to read the .html files.
Thanks
--
JohnKern - 10 Mar 2009
Have you considered using either Active State perl or Strawberry perl?
I've tested GenDPF with both of these implementations and they worked okay. Correction; I have NOT tested
GenPDF on Windows. The htmldoc command is not free on windows. Have to purchase the precompiled binary and I don't have a copy of it to test with.
The
GenPDF command builds all files using the "File::Temp" routines. From what I find, permission 600 is correct. When the htmldoc command is executed it should be running under the same ID as the server, so I don't understand why it can't read the files.
Please test using ?pdfdebug=1 in the URL, and capture the output in data/debug.txt
--
GeorgeClark - 11 Mar 2009
Contents of data/debug.txt are these:
| 11 Mar 2009 - 06:25 |
GenPDF - preparing
WebHome
| 11 Mar 2009 - 06:26 |
GenPDF - Calling htmldoc with args: --book --quiet --links --linkstyle plain --outfile /cygdrive/f/www/ElectronicsWiki/working/tmp/GenPDFAddOnTFhoU6GVHn.pdf --format pdf14 --portrait --size a4 --path /cygdrive/f/www/ElectronicsWiki/working/tmp --browserwidth 860 --titlefile /cygdrive/f/www/ElectronicsWiki/working/tmp/GenPDFAddOnP7fLIEEFVe.html --no-toc --firstpage p1 --pagelayout single --pagemode outline /cygdrive/f/www/ElectronicsWiki/working/tmp/GenPDFAddOnyXx7Kn30Nk.html
| 11 Mar 2009 - 06:26 |
GenPDF - htmldoc exited with 1
Maybe I'll give a try with CYGWIN=ntsec in my cygwin .bash_profile, but it is unclear how/when that takes effect. ntea has also been suggested so I'll look into that also.
--
JohnKern - 11 Mar 2009
Another piece of info may be this additional output line which appears in the error.log:
[Wed Mar 11 06:59:18 2009] genpdf: Use of uninitialized value in string eq at /cygdrive/f/www/ElectronicsWiki/lib/Foswiki/Sandbox.pm line 73.
Please check what you have in your lib/LocalSite.cfg. Line 73 is testing the setting for OS. If this is not set, it probably is causing the Sandbox function used to execute htmldoc to improperly configure things. The code generating the uninitialized variable is:
# Shell quoting - shell used only on non-safe platforms
if ( $Foswiki::cfg{OS} eq 'UNIX'
|| ( $Foswiki::cfg{OS} eq 'WINDOWS'
&& $$Foswiki::cfg{DetailedOS} eq 'cygwin' ) ) {
$CMDQUOTE = "'";
--
JohnKern - 11 Mar 2009
When the
GeneratePDF button is pressed, the following appears in the browser, which is interestingly different than what appears in the error.log file:
Foswiki detected an internal error - please check your Foswiki logs and webserver logs for more information.
htmldoc produced zero length output (C:path): HTMLDOC Version 1.8.27 Copyright 1997-2006 Easy Software Products, All Rights Reserved.
This software is based in part on the work of the Independent JPEG Group.
ERROR: No HTML files!
Usage:
htmldoc [options] filename1.html [ ... filenameN.html ]
...
I tried a couple different values in this file (F:\www\ElectronicsWiki\lib\Foswiki\Contrib\GenPDFAddOn\Config.spec), but no difference.
Config.spec is used as a template by the bin/configure utility to build the entries in lib/LocalSite.cfg. So changes need to be made in LocalSite.cfg.
--
JohnKern - 11 Mar 2009
My
LocalSite.cfg contains this line:
$Foswiki::cfg{Extensions}{GenPDFAddOn}{htmldocCmd} = 'C:/bin/HTMLDOC/htmldoc.exe';
and these:
$Foswiki::cfg{OS} = 'WINDOWS';
$Foswiki::cfg{DetailedOS} = 'cygwin';
As expected (I believe
Someone told me that line counts in perl error messages include only executable lines. Wrong??
--
JohnKern - 12 Mar 2009
We could not get GenPDF to work on Apache / cygwin until we used this syntax:
$Foswiki::cfg{WorkingDir} = 'f:/www/ElectronicsWiki/working';
instead of the usual
"/cygdrive/f/www/..."
I hope we didn't break anything else that needs working or working/tmp.
--
JohnKern - 17 Mar 2009
So, if I got my
GenPDF to work with a configuration tweak, should I then close the Task? How is that done? I believe that it takes advantage of cygwin's ability to resolve the "f:/www" syntax. I'll try again soon on Strawberry perl.
--
JohnKern - 20 Mar 2009
John, I believe this is because when Foswiki forks the htmldoc command it runs outside of cygwin and doesn't understand the unix path
/cygdrive/f/www
It needs to see the windows path since htmldoc is a windows program. I'll add some comments to the plugin to mention this.
--
GeorgeClark - 21 Mar 2009