Analysis of the upstream patch that fixes the problem
================================
The new _cupsSetDefaults() in cups v2.1 has been refactored to use a 
_cups_client_conf_t structure that holds the user defined value. This structure 
gets populated first by cups_init_client_conf(), that reads the 
/etc/cups/client.conf and ~/.cups/client.conf if present.

It then runs cups_finalize_client_conf() that reads in the environment
variables in the _cups_client_conf_t structure.

A new check is added to verify if a value already exists in cg->server
before calling cupsSetServer() on the ENV variable collected value which
is stored in the structure.

The original patch is :
  if (!cg->server[0] || !cg->ipp_port)
    cupsSetServer(cc.server_name);

  if (!cg->ipp_port)
  {
    const char  *ipp_port;              /* IPP_PORT environment variable */

    if ((ipp_port = getenv("IPP_PORT")) != NULL)
    {
      if ((cg->ipp_port = atoi(ipp_port)) <= 0)
        cg->ipp_port = CUPS_DEFAULT_IPP_PORT;
    }
    else
      cg->ipp_port = CUPS_DEFAULT_IPP_PORT;
  }

This portion of code is found in 1.7.2 in the cups_read_client_conf()
starting at line 1027.  The server name given to cupsSetServer() is
conditional to the value set in cups_server :

  if ((!cg->server[0] || !cg->ipp_port) && cups_server)
    cupsSetServer(cups_server);

So in order to correctly trigger the server name definition, the
following patch is needed :

Index: cups-1.7.5/cups/usersys.c
===================================================================
--- cups-1.7.5.orig/cups/usersys.c      2015-02-04 12:58:39.000000000 +0100
+++ cups-1.7.5/cups/usersys.c   2015-02-04 13:10:54.062431647 +0100
@@ -891,6 +891,12 @@
     }

    /*
+    * Check if values have been provided as CLI options
+    */
+    if (cg->server[0])
+      cups_server = cg->server;
+
+   /*
     * Read the configuration file and apply any environment variables; both
     * functions handle NULL cups_file_t pointers...
     */
~

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1352809

Title:
  /usr/bin/lp on Trusty using -h option doesn't work as expected

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1352809/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to