Bug 92035

Summary: magicfilter-t misidentifies PCL file as text
Product: [Retired] Red Hat Linux Reporter: Matthew Melvin <matthewmelvin>
Component: redhat-config-printerAssignee: Tim Waugh <twaugh>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-12-08 15:13:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matthew Melvin 2003-06-01 09:53:15 UTC
Description of problem:

I'm using HP DeskJet 950c connected locally to a redhat server shared to the 
local network via samba.  The local host can print fine but print jobs from 
remote hosts come out corrupted.  Sometimes raw PCL data is printed, sometimes 
the first few lines are printed okay but then the printer errors.  

The files being delivered to the redhat server are already in PCL format ready 
to be sent to the printer but they are being re-interpreted as if they were 
text.  If the files are cat'ed straight to /dev/lp0 the printed output is what 
is exected, but if passed through lpd and magicfilter they are corrupted.  

This happens with the files generated by both my win2k clients and my redhat 
linux client.  

Changing the text driver in mf.cfg from...

define(TEXTfilter, text "" \r\n\14 )dnl

... to ...

define(TEXTfilter, `cat')dnl

... causes remote print jobs to be printed as expected.

Version-Release number of selected component (if applicable):

redhat-config-printer-0.6.47-1
hpijs-1.3-32

How reproducible:

Always.

Steps to Reproduce:
1.  Use redhat-config-printer to setup printer queue 'lp' for a hp dj 950c 
using the hpijs driver.
2.  Share printer via samba.
3.  Print to shared printer from either windows or linux.
    
Actual results:

Correct output when printing from the local host.
Corrupted output when printing from remote clients.

Expected results:

Correct output when printing from the local host.
Correct output when printing from remote clients.

Additional info:

Capturing the various temp files (the print job as delivered 
to /var/spool/samba, and the printconf file created in /tmp) and running 
magicfilter-t in debug mode we see the files are being treated as text...

[root@localhost]# cat /tmp/fromlinux.pcl | magicfilter-t --
debug /tmp/printconf  > /dev/null
0: /text/ text [ 

ip2]
[root@localhost]# cat /tmp/fromwindows.pcl | magicfilter-t --
debug /tmp/printconf  > /dev/null
0: /text/ text [ 

ip2]
[root@localhost]# 

.... this seems to be due to leading nulls on the pcl files...

[root@localhost]# od -c fromlinux.pcl | head -4
0000000  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
0025360  \0  \0  \0  \0  \0  \0  \0  \0 033   E 033   %   -   1   2   3
0025400   4   5   X   @   P   J   L       E   N   T   E   R       L   A
[root@localhost]# od -c fromwindows.pcl | head -4
0000000  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
0022600 033   E 033   %   -   1   2   3   4   5   X   @   P   J   L    
0022620   J   O   B       N   A   M   E       =       "   0   1   6   e
[root@localhost]# 

... confusing magic filter.  Run these files through magic filter with the 
nulls removed  and they are correclty identified...

[root@localhost ]# dd if=/tmp/fromlinux.pcl bs=1 skip=11000 | magicfilter-t --
debug /tmp/printconf  > /dev/null
0: /pcl/ cat 
1379818+0 records in
1379818+0 records out
[root@localhost ]# dd if=/tmp/fromwindows.pcl bs=1 skip=9600 | magicfilter-t --
debug /tmp/printconf  > /dev/null
0: /pcl/ cat 
429003+0 records in
429003+0 records out
[root@localhost ]# 

A bit of trial and error with dd told me the linux file has 11000 nulls and the 
windows file has 9600 nulls although I don't know if those are constants or 
just artifacts of these particular printjobs. The PCL fliles I'm using for my 
debugging are the test pages from their respective systmes.

Comment 1 Tim Waugh 2003-06-26 08:45:41 UTC
If you are sending raw data to the queue, you need to set it up as a raw queue.
 If you are using the hpijs driver, it is not a raw queue.

Comment 2 Matthew Melvin 2003-06-27 02:53:24 UTC
This would suggest I have two options.  I can either set the printer as a 'raw'
queue, in which case the remote hosts can print but the local host can not.  Or
I can setup the printer as a hpisj queue, in which case the local host can
print, but the remote hosts can not.  Isn't this what the ...

define(PCLfilter, `cat')dnl

.. directive is meant to addresss - "this file has already be prepared for the
printer - just send it without further modification'.  Except magicfilter isn't
making use of this directive becuase it thinks the file is text.

How can I configure the print queue so taht both local and remote printing
function at the same time?


Comment 3 Tim Waugh 2004-12-08 15:13:52 UTC
magicfilter is no longer used.