Bug#923532: cups-bsd: spool directory fills up

2019-03-01 Thread Helge Kreutzmann
Package: cups-bsd
Version: 2.2.10-4
Severity: normal

By chance I noted that the spool directory fills up over time,
currently:
root@samd:/var/spool/cups# lpq -a
Keine Einträge
root@samd:/var/spool/cups# du -hs .
166M.
root@samd:/var/spool/cups# ls -lh | wc -l
621

The oldest files are from 2017. There are two types of file, some
short text files which seem to describe the print job and pdf and
postscript files, which appear to be the print jobs themselves.

Some files / queues on my system do not print 
so I have to abort the jobs with lprm. If these files are really
(only) this use case I don't know.

If I should run some tests (I currently have an unprintable file at
hand) please tell me.

As a band aid a cron job could be added which deletes files there
older let's say than a week. 


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

Kernel: Linux 4.19.13samd.01 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_UNSIGNED_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to de_DE.UTF-8), LANGUAGE=de_DE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set 
to de_DE.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages cups-bsd depends on:
ii  cups-client2.2.10-4
ii  cups-common2.2.10-4
ii  debconf [debconf-2.0]  1.5.70
ii  libc6  2.28-7
ii  libcups2   2.2.10-4

cups-bsd recommends no packages.

Versions of packages cups-bsd suggests:
ii  cups2.2.10-4
pn  inetutils-inetd | inet-superserver  
ii  update-inetd4.49

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

-- 
  Dr. Helge Kreutzmann deb...@helgefjell.de
   Dipl.-Phys.   http://www.helgefjell.de/debian.php
64bit GNU powered gpg signed mail preferred
   Help keep free software "libre": http://www.ffii.de/


signature.asc
Description: Digital signature


Bug#923532: cups-bsd: spool directory fills up

2019-03-02 Thread Brian Potkin
reassign 923532 cups-daemon
thanks



Thank you for your report, Helge.

On Fri 01 Mar 2019 at 15:30:48 +0100, Helge Kreutzmann wrote:

> Package: cups-bsd
> Version: 2.2.10-4
> Severity: normal
> 
> By chance I noted that the spool directory fills up over time,
> currently:
> root@samd:/var/spool/cups# lpq -a
> Keine Einträge
> root@samd:/var/spool/cups# du -hs .
> 166M.
> root@samd:/var/spool/cups# ls -lh | wc -l
> 621
> 
> The oldest files are from 2017. There are two types of file, some
> short text files which seem to describe the print job and pdf and
> postscript files, which appear to be the print jobs themselves.

c (control or history) files and d (document) files. They should get
cleared with 'cancel -a -x' but might need to be removed with 'rm'.

> Some files / queues on my system do not print 
> so I have to abort the jobs with lprm. If these files are really
> (only) this use case I don't know.
> 
> If I should run some tests (I currently have an unprintable file at
> hand) please tell me.
> 
> As a band aid a cron job could be added which deletes files there
> older let's say than a week.

cupsd.conf(5) explains the PreserveJobFiles and PreserveJobHistory
directives. If you put "PreserveJobFiles 30" in cupsd.conf, does it
work for you?

You may, of course, alter the default PreserveJobHistory value too
but are then likely to hit Bug#921741. Knowing how much of Emin Kaya's
issue you can replicate would be useful.

Regards,

Brian.



Bug#923532: cups-bsd: spool directory fills up

2019-03-02 Thread Helge Kreutzmann
Hello Brian,
On Sat, Mar 02, 2019 at 01:14:29PM +, Brian Potkin wrote:
> Thank you for your report, Helge.

Thanks for the quick reply.

> On Fri 01 Mar 2019 at 15:30:48 +0100, Helge Kreutzmann wrote:
> > By chance I noted that the spool directory fills up over time,
> > currently:
> > root@samd:/var/spool/cups# lpq -a
> > Keine Einträge
> > root@samd:/var/spool/cups# du -hs .
> > 166M.
> > root@samd:/var/spool/cups# ls -lh | wc -l
> > 621
> > 
> > The oldest files are from 2017. There are two types of file, some
> > short text files which seem to describe the print job and pdf and
> > postscript files, which appear to be the print jobs themselves.
> 
> c (control or history) files and d (document) files. They should get
> cleared with 'cancel -a -x' but might need to be removed with 'rm'.

Thanks for the pointer. I usually use "lprm" and always thought that
removing a job also removes all spool files. I did not know about the
command cancel, whose name does not lead to beeing printing specific
(neither starts with cups nor with lp).

Do you think implying "-x" with with lprm would be a worthwile
wishlist bug for upstream?

> > Some files / queues on my system do not print 
> > so I have to abort the jobs with lprm. If these files are really
> > (only) this use case I don't know.
> > 
> > If I should run some tests (I currently have an unprintable file at
> > hand) please tell me.
> > 
> > As a band aid a cron job could be added which deletes files there
> > older let's say than a week.
> 
> cupsd.conf(5) explains the PreserveJobFiles and PreserveJobHistory
> directives. If you put "PreserveJobFiles 30" in cupsd.conf, does it
> work for you?

Neither are currently explicitly set. But the man page says that
PreserveJobFiles has a default value of 1 day and PreserveJobHistory
is yes. Maybe PreserveJobFiles only applies to sucessfully printed
jobs?

> You may, of course, alter the default PreserveJobHistory value too
> but are then likely to hit Bug#921741. Knowing how much of Emin Kaya's
> issue you can replicate would be useful.

Just to be clear: I should first try out PreserveJobHistory? And after
a day all spool files should be gone (if it works)?

Greetings

   Helge
-- 
  Dr. Helge Kreutzmann deb...@helgefjell.de
   Dipl.-Phys.   http://www.helgefjell.de/debian.php
64bit GNU powered gpg signed mail preferred
   Help keep free software "libre": http://www.ffii.de/


signature.asc
Description: Digital signature


Bug#923532: cups-bsd: spool directory fills up

2019-03-03 Thread Brian Potkin
On Sun 03 Mar 2019 at 06:20:10 +0100, Helge Kreutzmann wrote:

> On Sat, Mar 02, 2019 at 01:14:29PM +, Brian Potkin wrote:
> > 
> > c (control or history) files and d (document) files. They should get
> > cleared with 'cancel -a -x' but might need to be removed with 'rm'.
> 
> Thanks for the pointer. I usually use "lprm" and always thought that
> removing a job also removes all spool files. I did not know about the
> command cancel, whose name does not lead to beeing printing specific
> (neither starts with cups nor with lp).
> 
> Do you think implying "-x" with with lprm would be a worthwile
> wishlist bug for upstream?

I am unfamiliar with the lprm command so hope I am not misuderstanding
its manual or you. However, my reading of

  https://github.com/apple/cups/issues/1149

leads me to think that such a report would be closed.
 
> > cupsd.conf(5) explains the PreserveJobFiles and PreserveJobHistory
> > directives. If you put "PreserveJobFiles 30" in cupsd.conf, does it
> > work for you?
> 
> Neither are currently explicitly set. But the man page says that
> PreserveJobFiles has a default value of 1 day and PreserveJobHistory
> is yes. Maybe PreserveJobFiles only applies to sucessfully printed
> jobs?

It does indeed. 

> > You may, of course, alter the default PreserveJobHistory value too
> > but are then likely to hit Bug#921741. Knowing how much of Emin Kaya's
> > issue you can replicate would be useful.
> 
> Just to be clear: I should first try out PreserveJobHistory? And after
> a day all spool files should be gone (if it works)?

Not quite.

First clear out /var/spool/cups.

I'd suggest you put "PreserveJobFiles 30" (and other smallish values)
in cupsd.conf, then print and see whether you can have confidence in
the option being functional. My tests indicate it is reliable. In which
case you should not experience the spool directory getting clogged up
in future.

The history files are much smaller, so do not present the same problem
as the document files. You might decide to leave well alone and not do
anything about them.

If you wish to test the PreserveJobHistory option, replace the previous
cupsd.conf entry with "PreserveJobHistory 30" and print. The c file
should be deleted after 30 seconds. My observations do not accord with
what I think the manual is saying.

Basically, I think a suitable value for PreserveJobHistory would be
something for you to consider.

To save on paper/ink/toner make FileDevice in /etc/cups/cups-files "yes"
and set up this queue to use for printing:

  lpadmin -p testq -v file:/dev/null -E -m drv:///sample.drv/generic.ppd

Regards,

Brian.



Bug#923532: cups-bsd: spool directory fills up

2019-03-04 Thread Helge Kreutzmann
Hello Brian,
On Sun, Mar 03, 2019 at 01:54:56PM +, Brian Potkin wrote:
> On Sun 03 Mar 2019 at 06:20:10 +0100, Helge Kreutzmann wrote:
> 
> > On Sat, Mar 02, 2019 at 01:14:29PM +, Brian Potkin wrote:
> > > 
> > > c (control or history) files and d (document) files. They should get
> > > cleared with 'cancel -a -x' but might need to be removed with 'rm'.
> > 
> > Thanks for the pointer. I usually use "lprm" and always thought that
> > removing a job also removes all spool files. I did not know about the
> > command cancel, whose name does not lead to beeing printing specific
> > (neither starts with cups nor with lp).
> > 
> > Do you think implying "-x" with with lprm would be a worthwile
> > wishlist bug for upstream?
> 
> I am unfamiliar with the lprm command so hope I am not misuderstanding
> its manual or you. However, my reading of
> 
>   https://github.com/apple/cups/issues/1149
> 
> leads me to think that such a report would be closed.

Thanks for the pointer.

> > > cupsd.conf(5) explains the PreserveJobFiles and PreserveJobHistory
> > > directives. If you put "PreserveJobFiles 30" in cupsd.conf, does it
> > > work for you?
> > 
> > Neither are currently explicitly set. But the man page says that
> > PreserveJobFiles has a default value of 1 day and PreserveJobHistory
> > is yes. Maybe PreserveJobFiles only applies to sucessfully printed
> > jobs?
> 
> It does indeed. 

Then this does not help in my case, I guess, but I see.

> 
> > > You may, of course, alter the default PreserveJobHistory value too
> > > but are then likely to hit Bug#921741. Knowing how much of Emin Kaya's
> > > issue you can replicate would be useful.
> > 
> > Just to be clear: I should first try out PreserveJobHistory? And after
> > a day all spool files should be gone (if it works)?
> 
> Not quite.
> 
> First clear out /var/spool/cups.

The cancel command does not work for this (as ordinary user):
LC_ALL=C cancel -ax
cancel: purge-jobs failed: Forbidden

I used "rm d00*" as root.

> I'd suggest you put "PreserveJobFiles 30" (and other smallish values)
> in cupsd.conf, then print and see whether you can have confidence in
> the option being functional. My tests indicate it is reliable. In which
> case you should not experience the spool directory getting clogged up
> in future.

I will test this, but then at least the documention is wrong, because
cupsd.conf(5) says:

PreserveJobFiles seconds
… The default is "86400" (preserve 1 day).

So I set the value to 30, printed one file which does not print and
nothing vanish, even after several minutes. 

I then cancel the job with "cancel" (not my usual lprm). This works.
But again, the file d* is not deleted after the 30 seconds are over.

So to conclude cups is missing a mechanism to remove uprintable files
in the spool directory. 

So the best way is probably a good old "rm d00*" in a suitable cron
job, e.g. cron.weekly.

Thanks for your help.

If any of this knowledge is worth putting into a bug report somewhere
I can do that of course.

Greetings

   Helge
-- 
  Dr. Helge Kreutzmann deb...@helgefjell.de
   Dipl.-Phys.   http://www.helgefjell.de/debian.php
64bit GNU powered gpg signed mail preferred
   Help keep free software "libre": http://www.ffii.de/


signature.asc
Description: Digital signature


Bug#923532: closed by Brian Potkin (Re: Bug#923532: cups-bsd: spool directory fills up)

2019-03-04 Thread Helge Kreutzmann
Hello Brian,
On Mon, Mar 04, 2019 at 03:45:05PM +, Debian Bug Tracking System wrote:
> On Mon 04 Mar 2019 at 11:37:46 +0100, Helge Kreutzmann wrote:
> 
> > On Sun, Mar 03, 2019 at 01:54:56PM +, Brian Potkin wrote:
> > 
> > > I'd suggest you put "PreserveJobFiles 30" (and other smallish values)
> > > in cupsd.conf, then print and see whether you can have confidence in
> > > the option being functional. My tests indicate it is reliable. In which
> > > case you should not experience the spool directory getting clogged up
> > > in future.
> > 
> > I will test this, but then at least the documention is wrong, because
> > cupsd.conf(5) says:
> > 
> > PreserveJobFiles seconds
> > … The default is "86400" (preserve 1 day).
> > 
> > So I set the value to 30, printed one file which does not print and
> > nothing vanish, even after several minutes. 
> > 
> > I then cancel the job with "cancel" (not my usual lprm). This works.
> > But again, the file d* is not deleted after the 30 seconds are over.
> 
> It won't be. PreserveJobFiles handles files which have gone through the
> filtering system. There could many reasons a file is not printed; a
> user would not want it to be removed while the error is rectified.
>  
> > So to conclude cups is missing a mechanism to remove uprintable files
> > in the spool directory. 
> 
> I don't experience this. 'cancel -ax' serves to remove a user's c and d
> files.

Unless there is an error, then it does not. This is the use case I run
into (thought previously I used lprm)

> > So the best way is probably a good old "rm d00*" in a suitable cron
> > job, e.g. cron.weekly.
> > 
> > Thanks for your help.
> > 
> > If any of this knowledge is worth putting into a bug report somewhere
> > I can do that of course.
> 
> PreserveJobFiles with "yes" or "no" or a seconds value and 'cancel -ax'
> appear to work as intended for managing /var/spool/cups. I will close
> this report.

I agree that it works as intended. It is just that a mechanism for
removing failed jobs is in my opinion missing. As you stated such a
mechanism is not intended, so I installed a simply cron job for this.

Greetings

   Helge


-- 
  Dr. Helge Kreutzmann deb...@helgefjell.de
   Dipl.-Phys.   http://www.helgefjell.de/debian.php
64bit GNU powered gpg signed mail preferred
   Help keep free software "libre": http://www.ffii.de/


signature.asc
Description: Digital signature