cupsd doesn't write last printer's Info line from "/etc/cups/printers.conf" to "/etc/printcap" #1346

Closed
michaelrsweet opened this Issue Nov 23, 2005 · 3 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Nov 23, 2005

Version: 1.1.23
CUPS.org User: kssingvo.suse

/etc/cups/printers.conf contains these entries [shortened]:

Info Brother HL-5150D


Info Kyocera Mita FS-C5016N


Info HP LaserJet 1100

This results in such a printcap file [shortened]:
hl5150dseries|Brother HL-5150D:rm=host=hl5150dseries:
km5016|Kyocera Mita FS-C5016N:rm=host:rp=km5016:
laserjet1100|laserjet1100:rm=host:rp=laserjet1100:

Have a closer look at the last line:
Instead of
laserjet1100|HP LaserJet 1100:rm=host:rp=laserjet1100:
you see:
laserjet1100|laserjet1100:rm=host:rp=laserjet1100:

The problem is located in the logic of scheduler/printers.c:LoadAllPrinters()
The AddPrinter() call writes the new printcap file (WritePrintcap())
but the relevant information of the printcap is gathered later.

ATM I see two possibilities to fix:

  • either we add a extra WritePrintcap() call at the end of the loop while (cupsFileGets() != NULL) (= easier solution)
  • or we do the WritePrintcap() after we have read the full information about a printer (= better solution, like we were teached :-) ).

Please note, that I'm speaking of cups-1.1.x, and not about the SVN version.

Collaborator

michaelrsweet commented Nov 23, 2005

CUPS.org User: kssingvo.suse

For the moment I'd chosen the easier solution for SUSE Linux.

Collaborator

michaelrsweet commented Nov 24, 2005

CUPS.org User: mike

Fixed in Subversion repository.

The correct fix is to delay calls to WritePrintcap until after all processing has been done. See the changes in r4854...

Collaborator

michaelrsweet commented Nov 24, 2005

"cups-1.1.23-printcap_info.patch":

--- cups-1.1.23/scheduler/printers.c.orig 2005-11-23 14:30:25.000000000 +0100
+++ cups-1.1.23/scheduler/printers.c 2005-11-23 14:47:01.000000000 +0100
@@ -1011,6 +1011,8 @@
}
}

  • WritePrintcap();

cupsFileClose(fp);
}

michaelrsweet added this to the Stable milestone Mar 17, 2016

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