Skip to content

Fix duplicate local printers in DNS-SD discovery (Issue #1531)#1573

Open
abubakarsabir924-cell wants to merge 1 commit into
OpenPrinting:masterfrom
abubakarsabir924-cell:fix-local-printer-duplicate-1531
Open

Fix duplicate local printers in DNS-SD discovery (Issue #1531)#1573
abubakarsabir924-cell wants to merge 1 commit into
OpenPrinting:masterfrom
abubakarsabir924-cell:fix-local-printer-duplicate-1531

Conversation

@abubakarsabir924-cell
Copy link
Copy Markdown
Contributor

Fixes #1531

Root cause: In cups_enum_dests(), permanent cupsd queues were
never stored in _cups_dnssd_data_t. So when cups_dest_query_cb()
fired, there was no local queue data to compare against DNS-SD
discovered printers.

Fix:

  • Added num_local and local_dests fields to _cups_dnssd_data_t
  • Store permanent cupsd queues before DNS-SD browse starts
  • In cups_dest_query_cb(), compare rp field from DNS-SD TXT
    record against local queue names
  • If matched, mark device as INCOMPATIBLE to suppress duplicate

Note: Tested build successfully. Would appreciate testing from
someone who can reproduce the issue with a shared printer setup.

@abubakarsabir924-cell
Copy link
Copy Markdown
Contributor Author

@tillkamppeter Sir,
I found the exact root cause: permanent cupsd queues were never stored in _cups_dnssd_data_t, so cups_dest_query_cb() had no local data to compare against DNS-SD discovered printers.

The fix compares the rp field from DNS-SD TXT records against local queue names — if matched, the device is marked INCOMPATIBLE to suppress the duplicate.
I chose rp over UUID because rp is available directly at TXT parse time, avoiding async timing issues.

I tested the build successfully and ran lpstat -e with a local test printer — no duplicates appeared. However, I don't have a shared printer setup to fully reproduce the exact scenario from the issue, so I'd appreciate if you could test on your system.

I don't have a shared printer setup to reproduce the exact scenario locally. Since you mentioned you can reproduce this, could you please test this fix on your system?

Happy to update based on your feedback!

@abubakarsabir924-cell
Copy link
Copy Markdown
Contributor Author

Hi @tillkamppeter Sir, I hope you're doing well.

I'm just following up on this PR when you have a moment to review, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local printers also created as remote printers on the same machine

1 participant