Bug 105160

Summary: LPD Print System NIS printers are not considered at all if /etc/printers.conf is found.
Product: [Unmaintained] kdeprint Reporter: Trey Jones <trey.jones>
Component: generalAssignee: KDEPrint Devel Mailinglist <kde-print-devel>
Status: RESOLVED UNMAINTAINED    
Severity: normal CC: jlayt
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Solaris   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Trey Jones 2005-05-05 22:43:12 UTC
Version:            (using KDE KDE 3.4.0)
Installed from:    Compiled From Sources
Compiler:          GCC 3.3.5 
OS:                Solaris

In our environment on Solaris 8, an empty /etc/printers.conf is provided by default.  The getEtcPrintersConfName() in kdeprint/lpdunix/kmlpdunixmanager.cpp will not bother asking NIS for printers if it finds an /etc/printers.conf file.  This behavior didn't happen before KDE 3.1.  It would be better if either the routine checked to see if any printers were defined in the file or perhaps combine the contents of this file with the one produced from the NIS map.  Alternatively, give the user an option to decide where printer information should come from or provide a priority list for it.

In my current situation, I fixed it by removing the check for the existence of the local file.  Now, if the ypcat command exists, it will try to retrieve the printers from NIS.  Unfortunately, if it doesn't find any, it won't check the local file (I leave these fixes to the very capable maintainer of kdeprint).  Just thought I'd let you know.

--- kdeprint/lpdunix/kmlpdunixmanager.cpp.orig  2005-05-04 14:44:02.537328000 -0500
+++ kdeprint/lpdunix/kmlpdunixmanager.cpp       2005-05-04 14:49:25.109103000 -0500
@@ -230,11 +230,11 @@
 QString getEtcPrintersConfName()
 {
        QString printersconf("/etc/printers.conf");
-       if (!QFile::exists(printersconf) && !KStandardDirs::findExe( "ypcat" ).isEmpty())
+       if (!KStandardDirs::findExe( "ypcat" ).isEmpty())
        {
-               // standard file not found, try NIS
+               // try NIS if it's available.
                printersconf = locateLocal("tmp","printers.conf");
-               QString cmd = QString::fromLatin1("ypcat printers.conf.byname > %1").arg(printersconf);
+               QString cmd = QString::fromLatin1("ypcat printers.conf.byname > %1 2>&1").arg(printersconf);
                kdDebug() << "printers.conf obtained from NIS server: " << cmd << endl;
                ::system(QFile::encodeName(cmd));
        }
Comment 1 Trey Jones 2005-05-05 23:24:21 UTC
I might add that, as a regular user, I am unable to remove /etc/printers.conf.  This file is on every one of our 75 workstations (part of standard JumpStart corporate load).  Also, I do not have any root access, so the file will probably not be going away anytime soon.
Comment 2 Cristian Tibirna 2005-08-22 21:19:35 UTC
UNCONFIRMED (batch reassigning messed this)
Comment 3 Trey Jones 2005-08-22 21:39:05 UTC
Is anyone ever going to address this?  It should be easy to reproduce.  Just make sure you have a /etc/printers.conf file with nothing in it and use it on a system with NIS printers defined.  You can clearly see in the code that it won't even bother looking at the NIS database if it finds a /etc/printers.conf file.
Comment 4 Kurt Pfeifle 2007-01-09 00:53:51 UTC
For now, I'm setting this bug report to "Confirmed/NEW" although I'm not in a position to confirm for real (neither Solaris 8 here, nor NIS nor LPD in use).

Maybe I can even find someone to look at the code in question and at the (semi-)patch sent by the reporter.

However, I do not believe that the LPD print subsystem in KDEPrint will ever see any additional love in the future. LPD is hardly used any more (all Solaris-on-Workstations using customers I know of have switched to CUPS in recent years). Also, a volunteer who some time ago committed himself to implement better LPD/LPRng subsystem support has now disappeared from the scene.
Comment 5 John Layt 2011-05-27 18:00:15 UTC
KDEPrint is obsolete, unmaintained and will never be revived.  Closing all open bugs.