Bug#877888: cups-bsd: lpq and lp ignore the PRINTER environment variable
notfound 877888 1.7.5-11+deb8u1
notfound 877888 2.2.1-8
found 877888 2.2.4-8
tags bugnumber
Thank you for your report, Sanjoy. I'm unsure whether cups-bsd is the
right package to file it against but we will leave it there for the time
being.
On Fri 06 Oct 2017 at 13:09:07 -0400, Sanjoy Mahajan wrote:
> lpq and lp are no longer paying attention to the PRINTER environment
> variable. (The cups(1) manpage says that PRINTER is used except for
> setuid binaries. But lpq and lp are not setuid.)
For reference:
https://lists.cups.org/pipermail/cups/2008-February/043643.html
> Here is a commented log with lpq:
>
> $ lpq
> lj400 is ready /* my default destination */
> no entries
> $ PRINTER=mh371 printenv PRINTER
> mh371 /* to show that the environment variable inherits */
> $ PRINTER=mh371 lpq
> lj400 is ready /* but lpq ignores it */
> no entries
> $ lpq -Pmh371
> mh371 is ready /* to show that mh371 is a known destination */
> no entries
>
> And for lp:
>
> $ PRINTER=mh371 lp /usr/share/hplip/data/ps/testpage.ps.gz
> request id is lj400-2890 (1 file(s))
I tried this on jessie (cups 1.7.5-11+deb8u1) and stretch (cups 2.2.1-8),
with and without lpoptions files in /etc/cups and ~/.cups. All behaved as
expected with the above commands.
When it came to unstable (only /etc/cups/lpoptions existing) I obtained
the same as you did.
With no lpoptions in /etc/cups and ~/.cups:
brian@test:~$ lpstat -a
pcl accepting requests since Wed 11 Oct 2017 11:07:04 BST
xxx accepting requests since Wed 11 Oct 2017 17:28:17 BST
brian@test:~$ lpq
lpq: Error - no default destination available.
brian@test:~$ PRINTER=pcl lpq
lpq: Error - PRINTER environment variable names non-existent destination "pcl".
brian@test:~$ lpq -Ppcl
pcl is ready
no entries
brian@test:~$ PRINTER=pcl lp /etc/nsswitch.conf
lp: Error - scheduler not responding.
And now, as a user:
brian@test:~$ lpoptions -d pcl
[Printer options displayed]
brian@test:~$ lpq
lpq: Error - no default destination available.
brian@test:~$ PRINTER=xxx lpq
lpq: Error - PRINTER environment variable names non-existent destination "xxx".
brian@test:~$ lpq -Ppcl
xxx is ready
no entries
brian@test:~$ PRINTER=xxx lp /etc/nsswitch.conf
lp: Error - scheduler not responding.
It would be good if you would test some of my observations and report
before the bug is forwarded upstream.
Cheers,
Brian.
Reply to: