Bug 888782

Summary: yast2-printer does not restart cupsd when printer driver RPMs changes need it
Product: [openSUSE] openSUSE Tumbleweed Reporter: Johannes Meixner <jsmeix>
Component: YaST2Assignee: Johannes Meixner <jsmeix>
Status: RESOLVED DUPLICATE QA Contact: Jiri Srain <jsrain>
Severity: Minor    
Priority: P4 - Low    
Version: 201407*   
Target Milestone: ---   
Hardware: All   
OS: openSUSE 13.1   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Johannes Meixner 2014-07-24 12:15:46 UTC
In particular when additional printer driver RPMs get installed
- the new RPMs may provide necessary filters that are referenced
  in the PPD files to process print jobs for the new drivers
- the new RPMs may require other RPMs that provide necessary
  filters with additional MIME *.convs files to process print jobs

A restart of cupsd is needed when print job processing has changed.

Currently yast2-printer does not restart cupsd when printer
driver RPMs changes need it.

In this case one can set up a print queue using a PPD from the
new installed printer driver RPM but when print job processing
has changed printing would fail with an error like the IPP error
code "client-error-document-format-not-supported" or a message
of the "lp" program like "Unsupported document-format".

Re-starting yast2-printer does not help.

Only re-starting cupsd helps which means for unexperienced users
that a reboot helps.

It is not possible to re-start cupsd in any case when printer
driver RPMs were changed by yast2-printer because by design
yast2-printer restarts cupsd only when really needed, see
"Basic Implementation Principles:" "Strict Compliance With CUPS" at
http://en.opensuse.org/Archive:YaST_Printer_redesign

It could become tricky to implement a generic test
when print job processing has changed so that yast2-printer
could re-start cupsd only when really needed.
Comment 1 Johannes Meixner 2014-07-24 12:17:04 UTC
Regarding "printer driver RPMs changes" see also bnc#881062
"yast2-printer does not notice printer driver RPMs changes while it runs"
Comment 2 Johannes Meixner 2014-07-31 07:54:38 UTC
In contrast to the related more general issue bnc#889591
"RPMs that provide new printing filters do not restart cupsd"
that is closed "INVALID" bacause a deliberate manual restart of the cupsd
is intended when arbitrary printer driver RPMs are manually installed,
this issue here is different because here such RPMs are installed
via the YaST2-printer dialog "Driver Packages" that has a fixed list
of known printer driver RPMs so that this dialog has full control
what should happen for each of those known printer driver RPMs.

Because of the possible arbitrary bad side effects when restarting
cupsd while print jobs are active (see bnc#889591) a cupsd restart
via the "Driver Packages" dialog should be implemented as follows:

At most one single cupsd restart when finishing the "Driver Packages" dialog
(cf. https://bugzilla.novell.com/show_bug.cgi?id=889591#c1).

This means for each RPM that needs a cupsd restart when it is installed
or removed a "cupsd restart needed" flag is set to "true" when the RPM
was actually installed or removed (the user may cancel installation
or removal).

If this flag is true when finishing the "Driver Packages" dialog,
then the usual user confirmation popup for cupsd restart is shown:

  Restart locally running CUPS daemon
  A restart disrupts all currently active print jobs.
    [Yes]  [No]
Comment 3 Johannes Meixner 2014-08-01 10:18:18 UTC
Meanwhile I think yast2-printer should not implement a generic test
when print job processing has changed because I think this would be
"yet another oversophisticated automatism" - "YaOA" ;-), cf.
https://bugzilla.novell.com/show_bug.cgi?id=889591#c1

Because usually a change in printer driver RPMs (installation
or removal) changes print job processing, I think yast2-printer
should simply show the "Restart locally running CUPS daemon"
user confirmation popup in any case when printer driver RPMs
have been actually changed.

In the end this means one additional line of code (plus comment)
in /usr/share/YaST2/include/printer/driveradd.rb
------------------------------------------------------------------------------
 if package_changed
   Printer.ppds = []
   Printer.connections = []
+  # Show the "Restart locally running CUPS daemon" user confirmation popup
+  # because usually a change in printer driver RPMs (installation or removal)
+  # changes print job processing which requires a restart of cupsd,
+  # see https://bugzilla.novell.com/show_bug.cgi?id=888782
+  Printerlib.GetAndSetCupsdStatus("restart")
------------------------------------------------------------------------------

At first glance this change works well for me.
Comment 6 Johannes Meixner 2014-11-13 16:05:59 UTC
The fix in comment#3 is currently only available for SLE12
which makes this bug a duplicate of boo#902680

*** This bug has been marked as a duplicate of bug 902680 ***
Comment 7 Swamp Workflow Management 2015-02-18 11:06:41 UTC
openSUSE-RU-2015:0313-1: An update that has 7 recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 868241,871548,877516,877520,887562,888782,892395
CVE References: 
Sources used:
openSUSE 13.2 (src):    yast2-printer-3.1.1.1-2.4.1