Bug 7915 - Removing the last cups printer fails, the deleted printer remains shared
Summary: Removing the last cups printer fails, the deleted printer remains shared
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: Printing (show other bugs)
Version: unspecified
Hardware: Other Linux
: P3 normal
Target Milestone: ---
Assignee: Andreas Schneider
QA Contact: Samba QA Contact
Depends on:
Reported: 2011-01-14 05:32 UTC by David Disseldorp
Modified: 2020-12-11 11:23 UTC (History)
2 users (show)

See Also:

bso7915_cups_pcap_reload_no_printers_rb1.patch (7.17 KB, patch)
2011-01-14 08:42 UTC, David Disseldorp
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Disseldorp 2011-01-14 05:32:03 UTC
cups_async_callback() is called to receive new printcap data from a child
process which requests the information from cupsd.
Newly received printcap information is stored in a temporary printcap cache
(tmp_pcap_cache). Once the child process closes the printcap IPC file
descriptor, the system printcap cache is replaced with the newly populated
tmp_pcap_cache, however this only occurs if tmp_pcap_cache is non null (has at
least one printer).

If the printcap cache is empty, which is the case when cups is not exporting
any printers, the printcap cache is not replaced resulting in stale data.

The test script attached to bug 7836 can be used to reproduce this bug:
Start the script with no printers presented by cups.

The workaround is to ensure that cups is always exporting at least one printer.
Comment 1 David Disseldorp 2011-01-14 08:37:10 UTC
The fix was previously sent to the samba-technical mailing list:

New version re-based against master, with variable name change. Patch attachment to follow.

The following changes since commit d7af8753abf7dfea6af334e2a6eb9e175127a139:

  s3-waf: fix the build after rpc_winreg removal. (2011-01-14 11:38:40 +0100)

are available in the git repository at:
  git://oss.sgi.com/ddiss/samba bso7915_cups_pcap_reload_no_printers_rb1

David Disseldorp (2):
      s3-printing: remove unneeded local_pcap_copy global
      s3-printing: fix cups pcap reload with no printers

 source3/printing/print_cups.c |   86 +++++++++++++++++++----------------------
 1 files changed, 40 insertions(+), 46 deletions(-)
Comment 2 David Disseldorp 2011-01-14 08:42:51 UTC
Created attachment 6201 [details]
Comment 3 David Disseldorp 2011-01-14 09:45:13 UTC
flag for review
Comment 4 Andreas Schneider 2011-03-04 09:36:39 UTC
I will look at this.
Comment 5 Andreas Schneider 2011-03-07 11:37:17 UTC
This is in master and v3-6-test.