Bug#877888: closed by Brian Potkin <claremont...@gmail.com> (Re: Bug#877888: cups-bsd: lpq and lp ignore the PRINTER environment variable)

2017-10-15 Thread Sanjoy Mahajan
> Thanks for doing that. As it happens, cups 2.2.5 is now in unstable so I
> re-tested. None of the issues we both observed appear to be present in
> this version. I have not looked closely to find the cause of the fix but
> it is a good note on which to close this report.

Maybe it was this commit?



-Sanjoy



Bug#877888: cups-bsd: lpq and lp ignore the PRINTER environment variable

2017-10-14 Thread Sanjoy Mahajan
On 2017-10-11 18:52, Brian Potkin  wrote:

> When it came to unstable (only /etc/cups/lpoptions existing) I obtained 
> the same as you did.
>
> It would be good if you would test some of my observations and report
> before the bug is forwarded upstream.

Brian,

I've reproduced your results.  Below is the log.  The only difference
from yours is that my usual printer is called lj400 instead of pcl.  All
tests were run as a regular user starting from no /etc/cups/lpoptions or
~/.cups/lpoptions (restarting cups after moving /etc/cups/lpoptions to
/etc/cups/lpoptions.bak, just in case).

  $ lpstat -a
  lj400 accepting requests since Fri 13 Oct 2017 09:49:03 PM EDT
  [and many others listed]

  $ lpq
  lpq: Error - no default destination available.

  $ PRINTER=lj400 lpq
  lpq: Error - PRINTER environment variable names non-existent destination 
"lj400".

  $ lpq -Plj400
  lj400 is ready
  no entries

  $ PRINTER=lj400 lp /etc/nsswitch.conf 
  lp: Error - scheduler not responding.

  $ lpoptions -d lj400
  [options displayed]

  $ lpq
  lpq: Error - no default destination available.

  $ PRINTER=xxx lpq
  lpq: Error - PRINTER environment variable names non-existent destination 
"xxx".

  $ lpq -Plj400
  lj400 is ready
  no entries

  $ PRINTER=lj400 lp /etc/nsswitch.conf
  lp: Error - scheduler not responding.



Bug#877888: cups-bsd: lpq and lp ignore the PRINTER environment variable

2017-10-11 Thread Brian Potkin
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.



Bug#877888: cups-bsd: lpq and lp ignore the PRINTER environment variable

2017-10-06 Thread Sanjoy Mahajan
Package: cups-bsd
Version: 2.2.4-7
Severity: normal
File: /usr/bin/lpq

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.)

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))

It went to the default destination despite the environment setting.

Here is my /etc/cups/lpoptions:

Default lj400 fitplot=true PageSize=Letter sides=two-sided-long-edge
Dest lj400/gs fitplot=true PageSize=Letter pdftops-renderer=gs 
sides=two-sided-long-edge
Dest mh235 fitplot=true PageSize=Letter sides=two-sided-long-edge
Dest mh271 fitplot=true PageSize=Letter sides=two-sided-long-edge
Dest mh271/duplex fitplot=true PageSize=Letter sides=two-sided-long-edge
Dest mh271/saver fitplot=true number-up=2 PageSize=Letter 
sides=two-sided-long-edge
Dest mh371 PageSize=Letter sides=two-sided-long-edge
Dest mitx duplex=duplexnotumble
Dest psc outputorder=reverse PageSize=Letter PrintoutMode=High

-Sanjoy

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.12.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), 
LANGUAGE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages cups-bsd depends on:
ii  cups-client  2.2.4-7
ii  cups-common  2.2.4-7
ii  debconf  1.5.63
ii  libc62.24-17
ii  libcups2 2.2.4-7

cups-bsd recommends no packages.

Versions of packages cups-bsd suggests:
ii  cups  2.2.4-7
ii  update-inetd  4.44

-- debconf information:
  cups-bsd/setuplpd: false

--