http://defect.opensolaris.org/bz/show_bug.cgi?id=14156
The bug is caused by PAPI print backend is loading the same list of 
printers in /etc/printers.conf that CUPS generated. The fix is to check 
that if CUPS is the active print system, do not create the PAPI print 
backend. That check is done through the scf properties "general/active" 
in svc:/application/cups/scheduler:default.



code diff:

Index: base-specs/gtk2.spec
===================================================================
--- base-specs/gtk2.spec    (revision 20645)
+++ base-specs/gtk2.spec    (working copy)
@@ -50,6 +50,8 @@
 Patch13:       gtk+-13-show-lpr-backend.diff
 # date:2009-10-11 owner:gheet type:bug doo#11830
 Patch14:       gtk+-14-check-libs.diff
+# date:2010-01-29 owner:gheet type:bug doo#14156
+Patch15:       gtk+-15-check-cups.diff
 
 BuildRoot:    %{_tmppath}/%{name}-%{version}-build
 Docdir:       %{_defaultdocdir}/doc
@@ -132,6 +134,7 @@
 %patch12 -p1
 %patch13 -p1
 %patch14 -p1
+%patch15 -p1



$ cat patches/gtk+-15-check-cups.diff
diff -urN gtk+-2.18.5/modules/printbackends/papi/gtkprintbackendpapi.c 
../../SUNWgtk2-2.18.5.hacked/i386/gtk+-2.18.5/modules/printbackends/papi/gtkprintbackendpapi.c
--- gtk+-2.18.5/modules/printbackends/papi/gtkprintbackendpapi.c    
2010-01-29 10:17:03.373625542 +0000
+++ 
../../SUNWgtk2-2.18.5.hacked/i386/gtk+-2.18.5/modules/printbackends/papi/gtkprintbackendpapi.c
    
2010-01-29 10:20:00.173396452 +0000
@@ -26,6 +26,7 @@
 #include <fcntl.h>
 #include <stdlib.h>
 #include <string.h>
+#include <libscf.h>
 #include <papi.h>
 
 #include <config.h>
@@ -124,6 +125,33 @@
                                                         
&print_backend_papi_info, 0);
 }
 
+/*
+ * Test to see if CUPS is the "active" print service on Solaris by 
looking for
+ * a special "general/active" boolean property in the CUPS service instance
+ * svc:/application/cups/scheduler:default.  If it exists and is true, CUPS
+ * is the active print service.
+ */
+static int
+cups_is_active()
+{
+  int active = 0;
+
+  scf_simple_prop_t *prop = scf_simple_prop_get(NULL,
+                                   
"svc:/application/cups/scheduler:default",
+                                   "general", "active");
+
+  if ((prop != NULL) && (scf_simple_prop_numvalues(prop) > 0)) {
+      uint8_t *value = scf_simple_prop_next_boolean(prop);
+
+      if (value != NULL)
+          active = *value;
+    }
+
+  scf_simple_prop_free(prop);
+
+  return (active);
+}
+
 G_MODULE_EXPORT void
 pb_module_init (GTypeModule *module)
 {
@@ -142,6 +170,9 @@
 {
   static gboolean loaded = FALSE;
 
+  if (cups_is_active ())
+    return NULL;
+
   if (!loaded)
   {
     GModule *papi;

Reply via email to