Bug in @DONE?

Fairlight fairlite at fairlite.com
Tue Feb 20 19:12:46 PST 2007


fP 5.0.14D4, SCO 5.0.6

Weirdest thing.  Using rreport, someone had a problem with their code not
working correctly for an empty output format.  And I do mean empty...no
characters in any section.  Here's how I understand it (roughly):

There was a processing table being run for sort/selection, and it was very
simple, just a select;end.

For the output processing, they had a table that had an @DONE section.
This whole thing worked fine when there were records selected.  However, if
no records were selected, they were getting the error "lp: no printer
specified".

Went through redirect trapping, even put up truss, which showed it was
trying to print something to a printer.  Even when we defined the printer
differently (even one time, using "cat - >/dev/null" as a printer
definition), it'd still always exit with a non-zero status code.  The
actual status code trapped was 1.

Turns out, if I set PFWGT0=ON and changed @DONE to @WGT, it miraculously
started working in both cases, not just the one case.  The problem entirely
went away, rreport started exiting with proper 0 exit code.

Is this a known issue, or what?  Took me a bit to figure out what would fix
it, and half of that was intuition, based on docs I read about @DONE doing
something after all printing/spooling was done.  Seems like @DONE actually
seems to -trigger- printing in some fashion, although when I tried trapping
the output via a modification of /dev/null to /tmp/printdebug, and we had
the form with some actual characters in it, it was always a 0-byte file.
But @WGT doesn't seem to trigger any such thing.

I won't get into why lp was bombing.  I couldn't tell for certain, as when
I put truss in the mix it interfered with the forking and invalidated the
testing for that particular criterion.  It was enough for me to tell it was
actually kicking off the print spooler command, but that's about as useful
as it was.  (With truss in the mix, -anything- it called pulled a SEGV,
including 'cat'.)

The fact that it seems lp shouldn't have been running at all (and doesn't
appear to if @WGT is used instead of @DONE) is really at the heart of it.
And the exit code is definitely different depending which you use.

Any more explanation would have to come from the actual developer.  They
understand their code better than I do.

I'd just like to know if there's a logical reason for this, as neither of
us could think of one.

mark->


More information about the Filepro-list mailing list