ports/189056: [patch] print/hplip: hpijs PPDs incorrectly accept PDF input
Lawrence The Dreamer Chen
beastie at tardisi.com
Sun Apr 27 17:30:01 UTC 2014
>Number: 189056
>Category: ports
>Synopsis: [patch] print/hplip: hpijs PPDs incorrectly accept PDF input
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Apr 27 17:30:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator: Lawrence "The Dreamer" Chen
>Release: FreeBSD 9.2-RELEASE-p4 amd64
>Organization:
>Environment:
System: FreeBSD zen.lhaven.homeip.net 9.2-RELEASE-p4 FreeBSD 9.2-RELEASE-p4 #0: Tue Apr 8 18:08:22 UTC 2014 root at amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
I original started working on the patch on April 9th, which included
updating to 3.14.4, and fixing the LIB_DEPENDS for cups-base. But, got
distracted by life.
But, I fixed some problems with the hpijs PPDs which I'm providing
here.
The problem is that the PPDs claim to be generated for cups-1.5, and
claim that they can directly consume PDF input by foomatic-rip-hplip.
*cupsFilter: "application/vnd.cups-postscript 100 foomatic-rip-hplip"
*cupsFilter: "application/vnd.cups-pdf 0 foomatic-rip-hplip"
In cups-1.6, support for printers capable of the direct consumption of
PDF files was added.
But, unlike foomatic-rip, foomatic-rip-hplip is only capable of
accepting PS or text. (treating PDF as text, results in just he PDF
header printing.)
>How-To-Repeat:
>Fix:
This patch addresses the deprecation warning that foomatic-rip-hplip
generates and patches all the PPD files. The PPDs are uncompressed,
the line containing "vnd.cups-pdf" is removed, and the file size
line is updated and they are recompressed.
--- patch begins here ---
--- Makefile.orig 2014-04-27 10:20:42.993926678 -0500
+++ Makefile 2014-04-27 12:02:27.109926718 -0500
@@ -153,6 +153,18 @@
${REINPLACE_CMD} -e '/[[:space:]]install-docDATA/ s|install-docDATA||' \
${WRKSRC}/Makefile.in
.endif
+# fix hpijs PPDs
+ ${SED} -e "s,%%WRKSRC%%,${WRKSRC}," \
+ -e "s,%%RM%%,${RM}," \
+ -e "s,%%GZCAT%%,${GZCAT}," \
+ -e "s,%%GREP%%,${GREP}," \
+ -e "s,%%EXPR%%,${EXPR}," \
+ -e "s,%%CAT%%,${CAT}," \
+ -e "s,%%SED%%,${SED}," \
+ -e "s,%%GZIP_CMD%%,${GZIP_CMD}," \
+ -e "s,%%MV%%,${MV}," \
+ ${.CURDIR}/files/ppdfix.sh.in > ${WRKDIR}/ppdfix.sh
+ ${SH} ${WRKDIR}/ppdfix.sh
post-install:
.if ${PORT_OPTIONS:MQT}
--- files/patch-prnt_hpijs_foomatic-rip-hplip.orig 1969-12-31 18:00:00.000000000 -0600
+++ files/patch-prnt_hpijs_foomatic-rip-hplip 2014-04-09 15:01:53.362097359 -0500
@@ -0,0 +1,11 @@
+--- prnt/hpijs/foomatic-rip-hplip.orig 2014-04-09 14:50:13.038097000 -0500
++++ prnt/hpijs/foomatic-rip-hplip 2014-04-09 15:00:12.759098808 -0500
+@@ -1653,7 +1653,7 @@
+ ## if nexessary.
+
+ my $dontparse = 0;
+-if ((!defined(@{$dat->{'args'}})) ||
++if ((!@{$dat->{'args'}}) ||
+ ($#{$dat->{'args'}} < 0)) {
+ # We don't have any options, so we do not need to parse the
+ # PostScript data
--- files/ppdfix.sh.in.orig 1969-12-31 18:00:00.000000000 -0600
+++ files/ppdfix.sh.in 2014-04-27 12:00:20.499926950 -0500
@@ -0,0 +1,24 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# In cups-1.6, support for printers capable of directly consuming PDF was
+# added. And, the hpijs PPDs were generated for cups-1.5, claiming to
+# support the direct consumption of PDF.
+#
+# While foomatic-rip, which can handle PDF, PS or text, foomatic-rip-hplip
+# can only handle PS or text.
+#
+# This script uncompresses each hpijs PPD file, removes the line that sends
+# PDF to foomatic-rip-hplip, and updates the file size line at the end of
+# the file and recompresses it.
+#
+%%RM%% -f /tmp/output.$$ /tmp/newppd.$$
+for ppd in %%WRKSRC%%/ppd/hpijs/*; do
+ %%GZCAT%% ${ppd} | %%GREP%% -v vnd.cups-pdf > /tmp/output.$$
+ NEWSIZE=`%%EXPR%% $(%%CAT%% /tmp/output.$$ | wc -c)`
+ %%SED%% -e '/^*% End of/s/ [0-9][0-9][0-9][0-9][0-9] bytes/ %%NEWSIZE%% bytes/' -e "s/%%NEWSIZE%%/${NEWSIZE}/" /tmp/output.$$ | %%GZIP_CMD%% -c > /tmp/newppd.$$
+ %%MV%% ${ppd} ${ppd}.bak
+ %%MV%% /tmp/newppd.$$ ${ppd}
+done
+%%RM%% -f /tmp/output.$$
--- patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list