Bug#825219: cupsfilter fails with filters which require DEVICE_URI
Package: cups
Version: 2.1.3-5+b1
Severity: normal
Tags: upstream
401dne.ppd was obtained from printer-driver-postscript-hp and has
the line
*cupsFilter: "application/vnd.cups-postscript 0 hpps"
in it. Using
/usr/sbin/cupsfilter -p 401dne.ppd -m printer/foo -e > out.ps 2>log
results in an empty out.ps and these lines in the log:
: ERROR: Improper environment: Must be run by CUPS.
ERROR: hpps (PID 3392) stopped with status 1
The hpps filter contains
# CUPS provided environment
try:
device_uri = os.environ['DEVICE_URI']
printer_name = os.environ['PRINTER']
ppd_file = os.environ['PPD']
except KeyError:
bug("Improper environment: Must be run by CUPS.")
sys.exit(CUPS_FILTER_FAILED)
so it seems to me that hpps expects DEVICE_URI, PRINTER and PPD
environment variables. But cupsfilter does not provide DEVICE_URI.
It would enhance the cupsfilter command if it was considered for
inclusion.
But I am not even sure that would be a complete fix as
PPD=/home/brian/401dne.ppd DEVICE_URI="" PRINTER=cupsfilter /usr/lib/cups/filter/hpps 1 1 1 1 1 < in.ps > out.ps
gets
12345X@PJL JOBNAME=hplip_1_1
@PJL SET USERNAME="1"
@PJL SET JOBNAME="1"
@PJL SET JOBATTR="JobAcct1=1"
@PJL SET JOBATTR="JobAcct2=b'alpha6'"
@PJL SET JOBATTR="JobAcct3=b'lan'"
@PJL SET JOBATTR="JobAcct4=20160524054830"
Traceback (most recent call last):
File "/usr/lib/cups/filter/hpps", line 216, in <module>
os.write(output_fd, to_bytes_utf8('@PJL SET JOBATTR=\"JobAcct5=%s\"\x0a' % opts['job-uuid']))
KeyError: 'job-uuid'
and necessitates adding an option with
PPD=/home/brian/401dne.ppd DEVICE_URI="" PRINTER=cupsfilter /usr/lib/cups/filter/hpps 1 1 1 1 'job-uuid=246' < in.ps > out.ps
Regards,
Brian.
Reply to: