[Pkg-cups-devel] r819 - in cupsys/trunk: . debian debian/filters
Martin Pitt
mpitt at alioth.debian.org
Fri Aug 15 06:17:51 UTC 2008
Author: mpitt
Date: Fri Aug 15 06:17:51 2008
New Revision: 819
Log:
* debian/filters/pstopdf:
- Do not log to /tmp/pstopdf.log. A user running the filter (e.g. via
cupsfilter) made all other users (including cups itself) unable to run
the filter because of no permission to open the logfile.
- Put unquoted variables into quotes where appropriate.
- Never create an outfile in the same directory as the given infile; the
process might not have write access there.
- set -e.
Modified:
cupsys/trunk/ (props changed)
cupsys/trunk/debian/changelog
cupsys/trunk/debian/filters/pstopdf
Modified: cupsys/trunk/debian/changelog
==============================================================================
--- cupsys/trunk/debian/changelog (original)
+++ cupsys/trunk/debian/changelog Fri Aug 15 06:17:51 2008
@@ -23,6 +23,14 @@
[ Johan Kiviniemi ]
* Add cupsfilter-path-typo.dpatch: Fix a typo in scheduler/cupsfilter.c,
which caused filters not to have /bin in their PATH.
+ * debian/filters/pstopdf:
+ - Do not log to /tmp/pstopdf.log. A user running the filter (e.g. via
+ cupsfilter) made all other users (including cups itself) unable to run
+ the filter because of no permission to open the logfile.
+ - Put unquoted variables into quotes where appropriate.
+ - Never create an outfile in the same directory as the given infile; the
+ process might not have write access there.
+ - set -e.
-- Martin Pitt <mpitt at debian.org> Thu, 14 Aug 2008 17:40:59 +0200
Modified: cupsys/trunk/debian/filters/pstopdf
==============================================================================
--- cupsys/trunk/debian/filters/pstopdf (original)
+++ cupsys/trunk/debian/filters/pstopdf Fri Aug 15 06:17:51 2008
@@ -11,6 +11,8 @@
# NO WARRANTY AT ALL
#
+set -e
+
PSTOPDF=/usr/bin/ps2pdf13
OPTIONS="-r150 -dAutoRotatePages=/None -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dNOPLATFONTS"
@@ -23,46 +25,13 @@
fi
-jobid=$1
-
-#infile=`mktemp /tmp/$jobid.pstopdf.in.XXXXXX`
-#if [ $? -ne 0 ]; then
-# echo "ERROR: Error creating tmpfile $infile" >&2
-# exit 1
-#fi
-#outfile=`mktemp /tmp/$jobid.pstopdf.out.XXXXXX`
-#if [ $? -ne 0 ]; then
-# echo "ERROR: Error creating tmpfile $outfile" >&2
-# exit 1
-#fi
-
-if [ $# -eq 6 ]; then
-
- echo "INFO: file is $6" >&2
- #cp $6 $infile
- #rm -f $6
-
- infile="$6"
- outfile="$infile".pdf
-
- $PSTOPDF $OPTIONS "$infile" "$outfile" 2>&1 >> /tmp/pstopdf.log
-
-else
-
- outfile=`mktemp /tmp/$jobid.pstopdf.out.XXXXXX`
- if [ $? -ne 0 ]; then
- echo "ERROR: Error creating tmpfile $outfile" >&2
- exit 1
- fi
-
- $PSTOPDF $OPTIONS - "$outfile" 2>&1 >> /tmp/pstopdf.log
-
-fi
+jobid="$1"
+outfile=$(mktemp "${TMPDIR:-/tmp}/$jobid.pstopdf.out.XXXXXX")
+trap 'rm -f "$outfile"' 0 1 2 13 15
-cat $outfile
+infile="${6:--}"
-# cp "$infile" "$outfile" /tmp/cups/
+$PSTOPDF $OPTIONS "$infile" "$outfile" >&2
-rm -f "$outfile"
+cat "$outfile"
-exit 0
More information about the Pkg-cups-devel
mailing list