Ticket #985 (new defect)

Opened 10 years ago

Last modified 9 years ago

checking for whether CUPS is running is fragile

Reported by: kaduk Owned by:
Priority: normal Milestone: Upstream Utopia
Component: -- Keywords:
Cc: Fixed in version:
Upstream bug:  LP:814908

Description

We've recently discovered that we need to check whether CUPS is running in a few places, e.g. when adding printers. The obvious way, using lpstat -r, is actually nontrivial since that command merely prints output, instead of returning a status value of success for running and failure for not-running.
Thus, we end up parsing its output, which is fragile to upstream changing that output.

It looks like we currently check for CUPS' status in:

config/cluster-cups-config/debian/postinst
config/cluster-cups-config/debian/configure-athena-printers

but that's just a quick check of the past 300 transactions in source-commits.

We should (a) file an upstream bug that lpstat -r should return a usable status code, and (b) try to make our scripts robust to any changes upstream might decide to make.

Change History

comment:1 Changed 10 years ago by kaduk

  • Upstream bug set to LP:814908

comment:2 Changed 9 years ago by kaduk

also config/cupsys-config/debian/configure-athena-printers since r25317

comment:3 Changed 9 years ago by kaduk

Zephyr discussion of hpijs parsing lpstat output reminds us that we should probably be setting LC_ALL=C here, a bit reminiscent of #958

comment:4 Changed 9 years ago by kaduk

Got a reply to the launchpad bug:

Checking for presence of the file /var/run/cups/cupsd.pid to find out if
cups is running is more robust in my opinion.

Anyway if you think lpstat -r needs to return nonzero value if cups isn't
running this should be reported upstream to CUPS here:
http://www.cups.org/str.php
Please also add a link to the upstream str in this bug report.

** Changed in: cups (Ubuntu)
   Importance: Undecided => Wishlist

** Changed in: cups (Ubuntu)
       Status: New => Triaged

** Tags added: needs-upstream-report
Note: See TracTickets for help on using tickets.