Subject: bin/30272: lpd -r sends data file with wrong name
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <collver@peak.org>
List: netbsd-bugs
Date: 05/18/2005 15:33:00
>Number:         30272
>Category:       bin
>Synopsis:       lpd -r sends data file with wrong name
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed May 18 15:33:00 +0000 2005
>Originator:     collver@peak.org
>Release:        NetBSD 2.0
>Organization:
>Environment:
System: NetBSD sanctum 2.0 NetBSD 2.0 (SANCTUM) #0: Wed Apr 20 22:07:11 PDT 2005 ben@sanctum:/usr/src/sys/arch/i386/compile/SANCTUM i386
Architecture: i386
Machine: i386
>Description:

When using an input filter with a remote printer, as enabled by the -r
flag for lpd, the print jobs fail on the remote end.  The syslog error
message is:

May 17 23:46:46 faq lpd[15859]: lp: job could not be printed (cfA029sanctum.takilma.net)

The problem is that in printjob.c:sendfile():file=tempremote;, the data
file name is changed but the entries in the control file remain
unchanged.

The result is that cfA029sanctum.takilma.net and remote25288b are
transferred to the remote lpd.  However, lpd reads the following lines
from the control file, and attempts to open dfA029sanctum instead of
remote25288b.

fdfA029sanctum
UdfA029sanctum

>How-To-Repeat:
>Fix:

Either unlink the original data file and rename tempremote to that, or
update the control file before transfering it to the remote lpd.

My temporary workaround is to remove the -r option, and configure 2
printers in /etc/printcap on the client system.  One of them is a remote
printer without a filter.  The other is a local printer with a filter
that uses lpr to send the output to the remote printer.  Not elegant!