Aha! I got the ba***rd!
After several hours of searching through the LPRng code and working out
how it works, I finally discovered the bug.
The bug is in the printjob.c file, for some reason the function
Run_OF_filter() is called in an if as such:
if ( Run_OF_filter( <blurb> ), Status_file_DYN ) {
goto exit;
}
I didn't know that if likes commas in the conditional statement, but
assuming the Status_file is set, the condition always returns true. The
goto exit is then carried out with error message or any other bit of
useful information!
I must say, this is a critical bug as any configuration with the OF
filter defined WILL fail!! (as has happened to me for the last 6 months
thinking that it was a problem with the printers!)
Attached is a patch for LPRng version 3.8.21 to modify the three
instances of this bug.
Hopefully this can be merged with the official version as soon as
possible.
Cheers,
sam
On Wed, 2003-06-25 at 14:53, Sam Lown wrote:
> Hello,
>
> There seems to be a problem with the banner filter program (of)
> execution in LPRng versions above 3.8.15.
>
> The OF filter starts ok, but after suspending the IF filter never kicks
> in and just the banner page gets printed.
>
> It works as expected with LPRng version 3.8.15 however versions 3.8.19
> and above don't.
>
> I've been plagued with this problem for quite some time but only just
> come to realise that this occurs.
>
> Does anyone have any suggestions? is this a configuration error or a
> bug? - as I've used identical configurations with both .15 and .19+ I'd
> imagine it is a bug. I'll try and have a look at the code to see if I
> can narrow the problem down, as soon as I have time!
>
> cheers,
>
> sam
--
CERN, Geneva
IT - Product Support - Unix Infrastructure
E-mail: [EMAIL PROTECTED]
diff -r -C 3 LPRng-3.8.21/src/common/printjob.c LPRng-3.8.21-new/src/common/printjob.c
*** LPRng-3.8.21/src/common/printjob.c Wed Apr 16 01:37:42 2003
--- LPRng-3.8.21-new/src/common/printjob.c Fri Jun 27 17:09:52 2003
***************
*** 123,129 ****
char *id, *s, *banner_name, *transfername, *openname, *format;
struct line_list *datafile, files;
struct stat statb;
!
of_pid = -1;
msgbuffer[0] = 0;
filtermsgbuffer[0] = 0;
--- 123,129 ----
char *id, *s, *banner_name, *transfername, *openname, *format;
struct line_list *datafile, files;
struct stat statb;
!
of_pid = -1;
msgbuffer[0] = 0;
filtermsgbuffer[0] = 0;
***************
*** 194,200 ****
if( Run_OF_filter( send_job_rw_timeout, &of_pid, &of_stdin, &of_stderr,
output, &Outbuf, &Outmax, &Outlen,
job, id, 0,
! msgbuffer, sizeof(msgbuffer)-1 ), Status_file_DYN ){
goto exit;
}
} else if( Outlen ){
--- 194,200 ----
if( Run_OF_filter( send_job_rw_timeout, &of_pid, &of_stdin, &of_stderr,
output, &Outbuf, &Outmax, &Outlen,
job, id, 0,
! msgbuffer, sizeof(msgbuffer)-1 ) ){
goto exit;
}
} else if( Outlen ){
***************
*** 344,350 ****
if( Run_OF_filter( send_job_rw_timeout, &of_pid, &of_stdin, &of_stderr,
output, &Outbuf, &Outmax, &Outlen,
job, id, 0,
! msgbuffer, sizeof(msgbuffer)-1 ), Status_file_DYN ){
goto exit;
}
} else {
--- 344,350 ----
if( Run_OF_filter( send_job_rw_timeout, &of_pid, &of_stdin, &of_stderr,
output, &Outbuf, &Outmax, &Outlen,
job, id, 0,
! msgbuffer, sizeof(msgbuffer)-1 ) ){
goto exit;
}
} else {
***************
*** 510,516 ****
if( Run_OF_filter( send_job_rw_timeout, &of_pid, &of_stdin, &of_stderr,
output, &Outbuf, &Outmax, &Outlen,
job, id, 1,
! msgbuffer, sizeof(msgbuffer)-1 ), Status_file_DYN ){
goto exit;
}
} else {
--- 510,516 ----
if( Run_OF_filter( send_job_rw_timeout, &of_pid, &of_stdin, &of_stderr,
output, &Outbuf, &Outmax, &Outlen,
job, id, 1,
! msgbuffer, sizeof(msgbuffer)-1 ) ){
goto exit;
}
} else {