OpenPrinting / cups

OpenPrinting CUPS Sources
https://openprinting.github.io/cups
Apache License 2.0
1.05k stars 187 forks source link

Cannot set temp queue as default destination if there is no permanent queue installed #833

Closed zdohnal closed 1 week ago

zdohnal commented 10 months ago

CUPS 2.4.7, Fedora 38

$ lpstat -a $ lpstat -e test_linux $ lpoptions -d test_linux device-uri=ipps://test%20%40%20linux._ipps._tcp.local/cups printer-info='test @ linux' printer-make-and-model='PostScript Printer' printer-type=25178190 $ lpstat -d no system default destination

It happens because because we use _cupsGetDests() in cupsSetDests2() for getting printers, but IPP_OP_GET_PRINTERS returns only permanent queues, thus cupsSetDests2() ends because it hits IPP_ERROR_NOT_FOUND. I'm on the way with fix - I was able to set the default destination when I use cupsGetDests2() instead of _cupsGetDests(), but I was not able to remove the settings with lpoptions -x test_linux - I will look into it further.

michaelrsweet commented 6 months ago

This is likely a timing issue, but I'd be interested in seeing what "lpstat -p" shows after running the lpoptions command. IPP_OP_CUPS_GET_PRINTERS (CUPS-Get-Printers) returns temporary queues that have been created with CUPS-Create-Local-Printer but haven't "expired"...

michaelrsweet commented 5 months ago

@zdohnal Ping, just trying to close the loop on this...

zdohnal commented 1 month ago

I'm sorry for being late:

[root@default-0 tree]# lpstat -a
lpstat: No destinations added.
root@default-0 tree]# lpstat -e
test_default_0
[root@default-0 tree]# lpoptions -d test_default_0
device-uri=ipps://test%20%40%20default-0._ipps._tcp.local/cups printer-info='test @ default-0' printer-location printer-make-and-model='PostScript Printer' printer-type=25178190
[root@default-0 tree]# lpstat -d
no system default destination
[root@default-0 tree]# lpstat -p
lpstat: No destinations added.

CUPS 2.4.10

michaelrsweet commented 2 weeks ago

OK, so looking at the output - when you set lpoptions to set the default destination, the destination hasn't actually been added at all so there isn't a queue to back it. Seems like we should make sure the local queue exists before saving...

michaelrsweet commented 2 weeks ago

Please try these fixes:

[master 85e977d09] Add a temporary queue before setting the defaults for lpoptions (Issue #833)

[2.4.x 141153e6d] Add a temporary queue before setting the defaults for lpoptions (Issue #833)

zdohnal commented 1 week ago

It works (at least for 2.4.x, master encountered errors, probably related to CI failures on master pipeline), thanks!