tags 561883 + patch thanks The attached patch solves the issue in all affected versions of dhelp (up to 0.6-19).
What the patch does is to use shell scripts for decompression and conversion. The scripts hide the -often quite large- output from the tools and instead just output one line with the offending document's filename. That way the cron job returns a small and easily comprehensible message on errors. Anyone wishing to investigate the error can then manually invoke the decompression/conversion tool upon the file. The patch has been successfully tested with regard to package-building, installation and correct operation on version 0.6-19 sources. regards George Zarkadas
--- a/Makefile +++ b/Makefile @@ -44,6 +44,9 @@ install: cp *.rhtml *.tmpl swish++.conf $(DESTDIR_)/share/dhelp/ mkdir -p $(DESTDIR)/etc cp dhelp.conf-sample $(DESTDIR)/etc/dhelp.conf + mkdir -p $(DESTDIR_)/share/dhelp/scripts + cp scripts/* $(DESTDIR_)/share/dhelp/scripts/ + chmod 755 $(DESTDIR_)/share/dhelp/scripts/* # Translations for i in po/*.po; do \ mkdir -p $(DESTDIR_)/share/locale/`basename $$i .po`/LC_MESSAGES/; \ --- a/debian/dirs +++ b/debian/dirs @@ -1,4 +1,5 @@ usr/share/dhelp +usr/share/dhelp/scripts var/lib/dhelp var/lib/dhelp/tmp etc/apache2/conf.d --- /dev/null +++ b/scripts/conv-pdftotext @@ -0,0 +1,14 @@ +#!/bin/sh +# Script optimised to run from within dhelp's swish++.conf. +# That means: +# * No error checking on parameters; edit swish++.conf the right way. +# * Spit output only on errors (a line pointing to input file). +# +# $1 = Input file, $2 = Output file + +2>/dev/null pdftotext "${1}" "${2}" +EXITVAL=$? +if [ ${EXITVAL} -ne 0 ]; then + echo "Error converting file: ${1}" +fi +exit ${EXITVAL} --- /dev/null +++ b/scripts/conv-pstotext @@ -0,0 +1,14 @@ +#!/bin/sh +# Script optimised to run from within dhelp's swish++.conf. +# That means: +# * No error checking on parameters; edit swish++.conf the right way. +# * Spit output only on errors (a line pointing to input file). +# +# $1 = Input file, $2 = Output file + +2>/dev/null pstotext -output "${2}" "${1}" +EXITVAL=$? +if [ ${EXITVAL} -ne 0 ]; then + echo "Error converting file: ${1}" +fi +exit ${EXITVAL} --- /dev/null +++ b/scripts/gz-extract @@ -0,0 +1,14 @@ +#!/bin/sh +# Script optimised to run from within dhelp's swish++.conf. +# That means: +# * No error checking on parameters; edit swish++.conf the right way. +# * Spit output only on errors (a line pointing to input file). +# +# $1 = Input file, $2 = Output file + +2>/dev/null gzip -dc ${1} > ${2} +EXITVAL=$? +if [ ${EXITVAL} -ne 0 ]; then + echo "Error decompressing file: ${1}" +fi +exit ${EXITVAL} --- a/swish++.conf +++ b/swish++.conf @@ -1,8 +1,9 @@ TempDirectory /var/lib/dhelp/tmp WordThreshold 50000 -FilterFile *.gz gunzip -c %f > @/var/lib/dhelp/tmp/%B -FilterFile *.pdf pdftotext %f @/var/lib/dhelp/tmp/%B.txt -FilterFile *.ps pstotext %f > @/var/lib/dhelp/tmp/%B.txt + +FilterFile *.gz /usr/share/dhelp/scripts/gz-extract %f @/var/lib/dhelp/tmp/%B +FilterFile *.pdf /usr/share/dhelp/scripts/conv-pdftotext %f @/var/lib/dhelp/tmp/%B.txt +FilterFile *.ps /usr/share/dhelp/scripts/conv-pstotext %f @/var/lib/dhelp/tmp/%B.txt IncludeFile HTML *.htm* IncludeFile Text *.txt
signature.asc
Description: This is a digitally signed message part