Subject: lpd -r and ouput filter bug?
To: None <tech-userlevel@netbsd.org>
From: Robert Vargason <robert@archon.ifoer.tuwien.ac.at>
List: tech-userlevel
Date: 12/11/2005 15:18:48
hi

I wanted to print from one netbsd machine to another
via lp and use the output filter option. this is where
my troubles started. the machine where I type in the lpr
command is a 1.6 and looking at the source code of lpd
under 1.6 I have a hunch that the 'of' 'lpr -r' option
never really worked. so I compiled a lp daemon from
netbsd 2.1 and the source looks like it should work.
but for me it didn't. the machine at the receiving end
kept complaining 'job could not be printed'. having only
a vague understanding how the lpd works I concluded
that the following takes place: the lpd spools a control
file cf... and a df... file containing the stuff to be
printed. with the output filter it also spools a temporary
file named remote... . it now sends the control file and
the temp file to the other netbsd machine (in the temp
file is the stuff to be printed which went trough the output
filter). and the problem of the receiving machine is
that it receives a control file which says that the file to
be printed is named df... but has received a file named
remote... . it is confused and refuses to print.

this 'bug' can be repaired in printjob.c by sending the
remote...  file with the name of df...
then the receiving machine happily prints:
at the beginning of the sendfile function I added a 
char * save_file;

save_file=file;
to remember the df... filename. because it is changed in the
case of a remote... file (file = tempremote;)

and when sending the filename a few lines later I used this
save_file filename instead of the new tempremote filename:
amt = snprintf(buf, sizeof(buf), "%c%lld %s\n", type,
            (long long)stb.st_size, save_file);

it works for me but is it a clean fix?
whom should I contact concerning this 'bug'?

thank you very much
robert vargason