Bug 202616

Summary: bug with 3rd party LPR breaking s-c-printer
Product: Red Hat Enterprise Linux 4 Reporter: daryl herzmann <akrherz>
Component: system-config-printerAssignee: Tim Waugh <twaugh>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-08-15 15:00:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description daryl herzmann 2006-08-15 14:47:44 UTC
system-config-printer-0.6.116.5-1  on fully patched EL4.4 x86 box:

/usr/share/printconf/util/cups_import.py  contains this code...

def which_spooler ():
    """Return the name of the active spooler."""
    signal.signal (signal.SIGCHLD, signal.SIG_DFL)
    f = os.popen ('LC_ALL=C /usr/sbin/alternatives --display print')
    for l in f.readlines ():
        if l.startswith (" link currently points to"):
            which = l.split ('.')[1].strip ()
            break

    f.close ()
    return which

the python split line assumes that the lpr binary contains a "." character.  Ex,
lpr.cups .  Our systems use a different version of LPR which doesn't contain
that character and thus the traceback:

# system-config-printer
Traceback (most recent call last):
  File "/usr/sbin/system-config-printer", line 9, in ?
    import queueTree
  File "/usr/share/printconf/util/queueTree.py", line 1236, in ?
    queueTree()
  File "/usr/share/printconf/util/queueTree.py", line 138, in __init__
    if cups_import.import_needed ():
  File "/usr/share/printconf/util/cups_import.py", line 200, in import_needed
    which = which_spooler ()
  File "/usr/share/printconf/util/cups_import.py", line 191, in which_spooler
    which = l.split ('.')[1].strip ()
IndexError: list index out of range

# /usr/sbin/alternatives --display print
<snip>
 link currently points to /usr/athena/bin/lpr
<snip>

This appears to have shown up with the 4.4 update.  Perhaps we could work around
this by renaming the lpr binary and use a "."?

# cd /usr/athena/bin/
# ln -s lpr lpr.isu
# ln -s /usr/athena/bin/lpr.isu /etc/alternatives/print

and that appears to allow system-config-printer to work again....

Thought I would file just to be sure...

thanks!
  daryl

Comment 1 Tim Waugh 2006-08-15 15:00:55 UTC
The system-config-printer application can only configure CUPS, not any 3rd party
spoolers.  Elsewhere there is a test to see whether the link is to 'lpr.cups',
and the application will fail at that point if it is not.

The quoted Python code (checking for output of alternatives) has been present in
system-config-printer since the original release of Red Hat Enterprise Linux 4,
and was not introduced in Update 4.