pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: gtk2+ print problem



On Saturday 21 February 2009 09:02:52 Steven M. Bellovin wrote:
> Mark Davies <mark%ecs.vuw.ac.nz@localhost> wrote:
> > I'm seeing the same problem, but I don't think its related to the
> > SHA1_Update thing because its not just happening to firefox3 -
> > gnumeric is another example and I'm sure there were others.
>
> As I noted, I see it in evince as well.
>
> But I'm reassured that I'm not the only one with the problem, so it's
> not something stupid I've done...

Sat down today and tracked the problem down.  In the GTK Cups print backend 
it was calling cups_get_printer_list() which would loop around calling 
cups_request_printer_list() which starts with this code:

  state = gtk_cups_connection_test_get_state 
(cups_backend->cups_connection_test);
  update_backend_status (cups_backend, state);

  if (state == GTK_CUPS_CONNECTION_IN_PROGRESS || state == 
GTK_CUPS_CONNECTION_NOT_AVAILABLE)
    return TRUE;


before actually sending the ipp request for the printers.
The first time in to this routine the state is 
GTK_CUPS_CONNECTION_IN_PROGRESS and every subsequent time its 
GTK_CUPS_CONNECTION_NOT_AVAILABLE so it never gets to the point of making 
the request.

Why this happens is that in gtk_cups_connection_test_get_state() it does a 
connect() on a non blocking socket so the first time through it gets an 
EINPROGRESS and subsequent times it gets an EISCONN whereas the code seems 
to assume that the connect() should succeed in the subsequent cases.

So the below patch gets it working for me:

--- modules/printbackends/cups/gtkcupsutils.c~  2009-01-08 
05:33:32.000000000 +1300
+++ modules/printbackends/cups/gtkcupsutils.c   2009-03-15 17:59:52.000000000 
+1300
@@ -1290,7 +1290,7 @@
 
           error_code = errno;
 
-          if (code == 0)
+          if (code == 0 || error_code == EISCONN)
             {
               close (test->socket);
               test->socket = -1;

cheers
mark


Home | Main Index | Thread Index | Old Index