Bug 1196730

Summary: DNSSD TXT record doesn't include rejecting flag
Product: [Fedora] Fedora Reporter: Marek Kašík <mkasik>
Component: cupsAssignee: Tim Waugh <twaugh>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: jpopelka, twaugh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-27 16:39:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Store CUPS_PRINTER_REJECTING also in "Type" field in printers.conf
none
Store CUPS_PRINTER_REJECTING also in "Type" field in printers.conf
none
Git-format patch against master
none
Git-format patch against master
none
Git-format patch against master none

Description Marek Kašík 2015-02-26 15:52:59 UTC
Created attachment 995675 [details]
Store CUPS_PRINTER_REJECTING also in "Type" field in printers.conf

Description of problem:
CUPS doesn't set CUPS_PRINTER_REJECTING flag in "printer-type" TXT record. This flag is important if we want to avoid waking up all printers just to know their state.


Version-Release number of selected component (if applicable):
cups-1.7.5-15.fc21


How reproducible:
Always


Steps to Reproduce:
1. Set sharing of a printer over dnssd
2. cupsreject the-printer
3. look at printer-type TXT record of the printer


Actual results:
CUPS_PRINTER_REJECTING is not set


Expected results:
CUPS_PRINTER_REJECTING is set


Additional info:
It would help to finish fixing of this bug: https://bugzilla.gnome.org/show_bug.cgi?id=743323.

Comment 1 Marek Kašík 2015-02-26 17:27:00 UTC
Created attachment 995703 [details]
Store CUPS_PRINTER_REJECTING also in "Type" field in printers.conf

This patch works better because the original type is still stored somewhere when I set the printer to accept jobs again.
It results in Accepting set to "Yes" and Type with the CUPS_PRINTER_REJECTING flag still set without this patch.

Comment 2 Tim Waugh 2015-02-27 10:00:14 UTC
Created attachment 995960 [details]
Git-format patch against master

I think you mean something like this. The printers.conf file already stores the accepting state for each printer, and when constructing printer-type for IPP attributes the Type field is combined with the Accepting field. It wasn't happening when constructing printer-type for the DNS-SD TXT record though.

Comment 3 Marek Kašík 2015-02-27 12:15:26 UTC
(In reply to Tim Waugh from comment #2)
> Created attachment 995960 [details]
> Git-format patch against master
> 
> I think you mean something like this. The printers.conf file already stores
> the accepting state for each printer, and when constructing printer-type for
> IPP attributes the Type field is combined with the Accepting field. It
> wasn't happening when constructing printer-type for the DNS-SD TXT record
> though.

Thank you, yes this is better solution.
Just one observation, if I call "cupsreject/cupsaccept", the TXT record is not changed immediately so I run "cupsenable/cupsdisable" to ensure that the change is propagated to the TXT record. Would it be possible to update the TXT record when the accepting state changes?

Comment 4 Tim Waugh 2015-02-27 13:54:01 UTC
Created attachment 996048 [details]
Git-format patch against master

Try this.

Comment 5 Marek Kašík 2015-02-27 15:05:35 UTC
Unfortunately, CUPS doesn't update the TXT record immediately with the patch.

Comment 6 Marek Kašík 2015-02-27 15:12:50 UTC
We probably need to do something like cupsdSetPrinterState() does here:

  if (update)
    cupsdRegisterPrinter(p);

which calls dnssdRegisterPrinter() which calls the dnssdBuildTxtRecord().

Comment 7 Tim Waugh 2015-02-27 15:18:55 UTC
Created attachment 996090 [details]
Git-format patch against master

Ah, yes. OK, how about this one?

Comment 8 Marek Kašík 2015-02-27 15:29:47 UTC
(In reply to Tim Waugh from comment #7)
> Created attachment 996090 [details]
> Git-format patch against master
> 
> Ah, yes. OK, how about this one?

Yes, this patch updates the rejecting flag immediately. Thank you very much.

Comment 9 Tim Waugh 2015-02-27 16:39:40 UTC
Rejected upstream.