[cups.bugs] [LOW] STR #2949: Tell in the documentation/man page/help output of cupstestppd that CUPS accepts all PPDs which pass "cupstestppd -r" and does not accept PPDs which fail this cupstestppd call

Johannes Meixner jsmeix at suse.de
Tue Sep 23 02:14:34 PDT 2008


Hello,

On Sep 19 08:42 Michael R Sweet wrote (shortened):
> Johannes Meixner wrote:
>> ...
>> 1:
>> The scheduler reads the first line from the input
>> and sees if it identifies itself as a PPD file.
>
> It does this...
>
>> 2a:
>> If it does not identify as a PPD file,
>> the input is used as "System V interface script".
>
> It does this, too...
>
>> 2b:
>> If it does identify as a PPD file,
>> the scheduler attempts to load the input stream
>> with ppdOpenFile(), and if that fails
>> it spits out an error to the error_log file
>> and does not set up (or change) the queue at all.
>
> It does this, too, at least for PPDs specified by "-m" (the ppd-name
> attribute) - look in scheduler/ipp.c:copy_model...

It does not do what I wrote because it does set up a raw queue
when ppdOpenFile() fails.
But it should not set up a queue at all when something fails.

For a test I added a clean /usr/share/cups/model/broken.ppd.gz
and restarted the cupsd to make sure it gets known:
-------------------------------------------------------------------------
nelson:~ # lpinfo -m | grep broken
broken.ppd.gz broken printer
-------------------------------------------------------------------------

Then I corrupted the PPD file (I added a "^foobar$" line) so that
-------------------------------------------------------------------------
nelson:~ # cupstestppd /usr/share/cups/model/broken.ppd.gz
/usr/share/cups/model/broken.ppd.gz: FAIL
       **FAIL**  Unable to open PPD file
                 - Missing asterisk in column 1 on line 21.
                 REF: Page 15, section 3.2.
-------------------------------------------------------------------------

Then I set up a queue with the broken PPD file:
-------------------------------------------------------------------------
nelson:~ # lpadmin -p broken -v file:/dev/null -m broken.ppd.gz \
            && echo ok || echo failed
lpadmin: Unable to copy PPD file!
failed
-------------------------------------------------------------------------
Good: I get an eror message and a non-zero exit code.
but
bad: I get the queue set up as raw queue nevertheless:
-------------------------------------------------------------------------
nelson:~ # tail -n3 /var/log/cups/error_log
I [23/Sep/2008:10:38:48 +0200] Setting broken device-uri
  to "file:/dev/null" (was "file:/dev/null".)
I [23/Sep/2008:10:38:48 +0200] Saving printers.conf...
I [23/Sep/2008:10:38:48 +0200] New printer "broken" added by "root".

nelson:~ # lpstat -v broken
device for broken: /dev/null

nelson:~ # find /etc/cups | grep broken
nelson:~ #
-------------------------------------------------------------------------

In contrast when I set up a queue with a correct PPD
I get in error_log:
-------------------------------------------------------------------------
I [23/Sep/2008:10:49:55 +0200] Setting postscript device-uri
  to "file:/dev/null" (was "file:/dev/null".)
I [23/Sep/2008:10:49:55 +0200] Saving printers.conf...
I [23/Sep/2008:10:49:55 +0200] New printer "postscript" added by "root".
I [23/Sep/2008:10:49:55 +0200] Saving printers.conf...
I [23/Sep/2008:10:49:55 +0200] Printer "postscript" modified by "root".
-------------------------------------------------------------------------

It seems that first of all the queue gets created.
Then in a second step it is changed to assign the PPD file.

When the second step (assign the PPD file) fails, the queue
should be removed if it was created anew right now.

Perhaps it is the underlying problem that creating a queue
with a PPD happens in two steps and in the second step
the cupsd cannot decide if the queue was created anew right now
or if the queue exists since a longer time.

For example if the PPD for an already existing queue should
be exchanged but the new PPD is broken, the queue should not
be changed at all (i.e. the old PPD should be kept).

I tested what happens when I try to replace the good PPD
for the above queue "postscript" with my broken.ppd.gz:
------------------------------------------------------------------
nelson:~ # lpadmin -p postscript -m broken.ppd.gz
lpadmin: Unable to copy PPD file!
------------------------------------------------------------------
The old (working) PPD /etc/cups/ppd/postscript.ppd
was not changed which is exactly what I liked to have!

For me the final result with the current CUPS is that
whatever printer setup tool must check the exit code
of the "lpadmin" call and if it is non-zero, it should
delete the queue when it is created anew right now.
For example like:
------------------------------------------------------------------
nelson:~ # lpadmin -p broken -v file:/dev/null -m broken.ppd.gz \
  || lpadmin -x broken || true
lpadmin: Unable to copy PPD file!

nelson:~ # lpstat -v broken
lpstat: Unknown destination "broken"!
------------------------------------------------------------------


Kind Regards
Johannes Meixner
-- 
SUSE LINUX Products GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany
AG Nuernberg, HRB 16746, GF: Markus Rex





More information about the cups-devel mailing list