/usr/bin/lp on Trusty using -h option doesn't work as expected
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | cups (Ubuntu) |
Medium
|
Louis Bouchard | ||
| | Trusty |
Medium
|
Louis Bouchard | ||
| | Utopic |
Medium
|
Louis Bouchard | ||
Bug Description
[SRU justification]
The -h option should override the value stored in the CUPS_SERVER environment variable
[Impact]
Without this fix, user is unable to define the printserver to use with the -h option
[Fix]
Verify if the -h option has defined the printserver before using CUPS_SERVER to define it.
[Test Case]
$ export CUPS_SERVER="blah"
$ lp -h {valid printserver} -d {printqueue} /etc/hosts
Without the fix :
lp: No such file or directory
With the fix :
request id is {printqueue}-37 (1 file(s))
[Regression]
None expected. New code path (from upstream patch) is only triggered if
-h option is used.
[Original description of the problem]
1) The release of Ubuntu you are using, via 'lsb_release -rd' or System -> About Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty
2) The version of the package you are using, via 'apt-cache policy pkgname' or by checking in Software Center
cups-client:
Installed: 1.7.2-0ubuntu1.1
3) What you expected to happen
When using lp -h to send a print job to a printer, I expected to the job to be sent to the printer and to override any env variables set or conf file setting
4) What happened instead
To summarise the behaviour I'm seeing
1) with CUPS_SERVER env variable unset and no ServerName set in /etc/cups/
Using IPs sends the job to the printer as expected.
2) with CUPS_SERVER env variable set using hostname with/without port and no ServerName set in /etc/cups/
3) with CUPS_SERVER env variable set using IP address with/without port and no ServerName set in /etc/cups/
===
with CUPS_SERVER env variable unset and no ServerName option set in /etc/cups/
$ lp test2.txt
lp: Error - scheduler not responding. (expected as no server is set or specified)
Using hostname
$ lp -h server1:631 test2.txt
lp: Error - add '/version=1.1' to server name.
$ lp -h server1 test2.txt
lp: Error - add '/version=1.1' to server name.
Using IP address
$ lp -h 192.168.254.8 test2.txt
request id is PDF-54 (1 file(s))
$ lp -h 192.168.254.8:631 test2.txt
request id is PDF-55 (1 file(s))
===
With CUPS_SERVER env variable *set CUPS_SERVER=server1
$ lp test2.txt
lp: Error - add '/version=1.1' to server name.
Using hostname
$ lp -h server1 test2.txt
lp: Error - add '/version=1.1' to server name.
$ lp -h server1:631 test2.txt
lp: Error - add '/version=1.1' to server name.
Using IP address
$ lp -h 192.168.254.8 test2.txt
lp: Error - add '/version=1.1' to server name.
$ lp -h 192.168.254.8:631 test2.txt
request id is PDF-56 (1 file(s))
===
With CUPS_SERVER env variable *set CUPS_SERVER=
Same results as above
===
With CUPS_SERVER env variable *set CUPS_SERVER=
$ lp -h 555.555.555.555 test2.txt
request id is PDF-66 (1 file(s))
===
With CUPS_SERVER env variable *set CUPS_SERVER=
Same results as above
| Changed in cups (Ubuntu): | |
| importance: | Undecided → Medium |
| assignee: | nobody → Louis Bouchard (louis-bouchard) |
| tags: | added: cts |
| Louis Bouchard (louis) wrote : | #2 |
Opened upstream bug on the matter : https:/
| Louis Bouchard (louis) wrote : | #3 |
Hello,
I have proposed a patch upstream and am waiting for their answer. I will let you know as soon as I hear from them.
| Changed in cups (Ubuntu): | |
| status: | Confirmed → In Progress |
| Changed in cups (Ubuntu Trusty): | |
| importance: | Undecided → Medium |
| Changed in cups (Ubuntu Utopic): | |
| importance: | Undecided → Medium |
| Changed in cups (Ubuntu Trusty): | |
| status: | New → Confirmed |
| Changed in cups (Ubuntu Utopic): | |
| status: | New → Confirmed |
| Louis Bouchard (louis) wrote : | #4 |
The upstream bug (L4561) has been identified as a duplicate of the following bug :
https:/
This one provides a fix for CUPS v2.1 which encompass much more than our current issue. I'm working on backporting the fix for the CUPS_SERVER issue.
I should be able to propose a fix for Vivid soon.
| Louis Bouchard (louis) wrote : | #5 |
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_
It then runs cups_finalize_
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)
cupsSetServ
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)
}
else
cg->ipp_port = CUPS_DEFAULT_
}
This portion of code is found in 1.7.2 in the cups_read_
if ((!cg->server[0] || !cg->ipp_port) && cups_server)
cupsSetServ
So in order to correctly trigger the server name definition, the following patch is needed :
Index: cups-1.
=======
--- cups-1.
+++ cups-1.
@@ -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...
*/
~
| Louis Bouchard (louis) wrote : | #6 |
debdiff for vivid
| tags: | added: patch |
| Till Kamppeter (till-kamppeter) wrote : | #7 |
Patch pushed into Debian GIT repository for CUPS. Thank you very much for the patch.
| Launchpad Janitor (janitor) wrote : | #8 |
This bug was fixed in the package cups - 1.7.5-10ubuntu2
---------------
cups (1.7.5-10ubuntu2) vivid; urgency=medium
* Fix -h option not honoured when CUPS_SERVER variable
is defined. (LP: #1352809)
-- Louis Bouchard <email address hidden> Wed, 04 Feb 2015 13:07:11 +0100
| Changed in cups (Ubuntu): | |
| status: | In Progress → Fix Released |
| Changed in cups (Ubuntu Trusty): | |
| status: | Confirmed → In Progress |
| Changed in cups (Ubuntu Utopic): | |
| status: | Confirmed → In Progress |
| Changed in cups (Ubuntu Trusty): | |
| assignee: | nobody → Louis Bouchard (louis-bouchard) |
| Changed in cups (Ubuntu Utopic): | |
| assignee: | nobody → Louis Bouchard (louis-bouchard) |
| Louis Bouchard (louis) wrote : | #9 |
debdiff for trusty's SRU
| Louis Bouchard (louis) wrote : | #10 |
debdiff for Utopic
| description: | updated |
Hello Michael, or anyone else affected,
Accepted cups into utopic-proposed. The package will build now and be available at http://
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
| Changed in cups (Ubuntu Utopic): | |
| status: | In Progress → Fix Committed |
| tags: | added: verification-needed |
| Chris J Arges (arges) wrote : | #12 |
Hello Michael, or anyone else affected,
Accepted cups into trusty-proposed. The package will build now and be available at http://
Please help us by testing this new package. See https:/
If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-
Further information regarding the verification process can be found at https:/
| Changed in cups (Ubuntu Trusty): | |
| status: | In Progress → Fix Committed |
| Louis Bouchard (louis) wrote : | #13 |
Verified for both Utopic & Trusty. Thanks
| tags: |
added: verification-done removed: verification-needed |
| Launchpad Janitor (janitor) wrote : | #14 |
This bug was fixed in the package cups - 1.7.5-3ubuntu3
---------------
cups (1.7.5-3ubuntu3) utopic-proposed; urgency=medium
* Fix -h option not honoured when CUPS_SERVER variable
is defined. (LP: #1352809)
-- Louis Bouchard <email address hidden> Mon, 09 Feb 2015 11:36:08 +0100
| Changed in cups (Ubuntu Utopic): | |
| status: | Fix Committed → Fix Released |
The verification of the Stable Release Update for cups has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.
| Launchpad Janitor (janitor) wrote : | #16 |
This bug was fixed in the package cups - 1.7.2-0ubuntu1.4
---------------
cups (1.7.2-0ubuntu1.4) trusty-proposed; urgency=medium
* Fix -h option not honoured when CUPS_SERVER variable
is defined. (LP: #1352809)
-- Louis Bouchard <email address hidden> Mon, 09 Feb 2015 11:22:42 +0100
| Changed in cups (Ubuntu Trusty): | |
| status: | Fix Committed → Fix Released |
| Johannes Martin (johannes-martin) wrote : | #17 |
The bug is back in cups-client 1.7.2-0ubuntu1.7!


Status changed to 'Confirmed' because the bug affects multiple users.