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

Bug#711848: closed by Didier Raboud <odyx@debian.org> (Bug#711848: fixed in cups 1.6.2-10)



On 2013-06-27 11:28:51 +0200, Vincent Lefevre wrote:
> This problem still occurs after the upgrade to cups 1.6.2-10.

In the changelog:

    printers' list to avoid jobs to go to unexpected printers
    (Closes: #711848)

This patch was modifying the cupsGetDests2() function, which was
already working here and was not used by lp and lpr. These commands
use cupsGetNamedDest() instead, and the bug seems to be there. I've
written a patch (attached) to modify cupsGetNamedDest() so that it
mimics what lpq does: instead of using

  _cupsGetDests(http, CUPS_GET_DEFAULT, NULL, &dest, 0, 0)

which returns a wrong default (the system default instead of the
default from ~/.cups/lpoptions), it uses cupsGetDests2 and gets
the default.

I don't know whether this patch is clean (in particular, I'm not sure
about the memory handling) and I haven't tested it extensively, but it
solves my problem.

BTW, it's rather annoying that different functions/commands use
different interfaces to get the default printer. This leads to
inconsistencies, as shown here.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
--- a/cups/dest.c	2013-06-27 13:23:50.000000000 +0200
+++ b/cups/dest.c	2013-06-27 13:26:12.000000000 +0200
@@ -1904,6 +1904,9 @@
 
   if (!_cupsGetDests(http, op, name, &dest, 0, 0))
   {
+    int i, num_dests;
+    cups_dest_t *dests;
+
     if (op == CUPS_GET_DEFAULT || (name && !set_as_default))
       return (NULL);
 
@@ -1912,8 +1915,10 @@
     * configuration file does not exist.  Find out the real default.
     */
 
-    if (!_cupsGetDests(http, CUPS_GET_DEFAULT, NULL, &dest, 0, 0))
-      return (NULL);
+    num_dests = cupsGetDests2(http, &dests);
+    for (i = 0; i < num_dests; i ++)
+      if (dests[i].is_default)
+	dest = &dests[i];
   }
 
   if (instance)

Reply to: