Ticket #384 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

lpr.debathena should find the cups default printer, and prioritize it above hesiod

Reported by: mitchb Owned by:
Priority: normal Milestone: Karmic Deploy (Canceled)
Component: printing Keywords: cups default printer
Cc: Fixed in version:
Upstream bug:


If the owner of a machine uses the GUI printing administration
application to choose a default printer for their machine,
this isn't honored by the commandline utilities if the machine
prefers lprng. We currently check the PRINTER environment
variable, and then hesiod clusterinfo to find a default queue.
We should check if a default queue has been set in cups, and
use that before turning to hesiod since it reflects a local
sysadmin's choice.

One could argue that if we find the cups default queue, we
should use the cups tools. However, if a machine prefers
lprng normally, and a sysadmin uses the GUI to choose a
default printer, it shouldn't cause which printing system
their commandline apps use to suddenly change, so we should
continue to use the system preference, and simply take the
name of the queue from cups.

The attached patch uses python-cups, which isn't in Etch,
so this may need to wait until Etch is desupported. I'd
first worked out a solution that finds the default printer
in /etc/cups/printers.conf. Unfortunately, the permissions
on that file are fascist, so that doesn't work for mortals.


lpr.debathena.diff Download (672 bytes) - added by mitchb 12 years ago.
Patch to use the default queue set in cups before looking in hesiod

Change History

Changed 12 years ago by mitchb

Patch to use the default queue set in cups before looking in hesiod

comment:1 Changed 12 years ago by geofft

The current revision of printing-config, which got partly restructured (including an implicit default CUPS preference) and grew a python-cups dependency, includes

    # Either we failed to getopt, or nobody told us what printer to use,
    # so let's use the default printer
    default = os.getenv('PRINTER')
    if not default:
        if cupsd:
            default = cupsd.getDefault()
    if not default:
        h = hesiod_lookup(os.uname()[1], 'cluster')

which appears to be equivalent to the patch. So is this resolved?

comment:2 Changed 12 years ago by broder

We lose.

dr-wily:~ broder$ lpoptions -d meadow
copies=1 job-hold-until=no-hold job-priority=50 number-up=1 auth-info-required=none printer-info=meadow printer-is-accepting-jobs=1 printer-is-shared=0 printer-location='SIPB office' printer-make-and-model='HP LaserJet 8150 Series Postscript (recommended) on CUPS.MIT.EDU' printer-state=3 printer-state-change-time=1261143144 printer-state-reasons=none printer-type=18919638
dr-wily:~ broder$ python -c 'import cups; print cups.Connection().getDefault()'

comment:3 Changed 12 years ago by geofft

  • Status changed from new to closed
  • Resolution set to fixed

For some definition of "lose"... The original bug report referred to a sysadmin's preference for the default printer in the GUI (presumably in /etc/cups/printers.conf), which Mitch implies was accessible with getDefault(), so this bug is resolved.

If we want lpoptions -d (run either as root or as a user) to be respected, that's a separate ticket. Note that lpoptions as root writes to /etc/cups/lpoptions, not printers.conf.

Note: See TracTickets for help on using tickets.