Bug 140927

Summary: Language issue when looking for active spooler
Product: Red Hat Enterprise Linux 3 Reporter: Patrice Guay <froggy>
Component: redhat-config-printerAssignee: Tim Waugh <twaugh>
Status: CLOSED DUPLICATE QA Contact:
Severity: high Docs Contact:
Priority: medium    
Version: 3.0   
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: 2004-11-26 15:59:06 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:
Attachments:
Description Flags
Patch to correct this bug none

Description Patrice Guay 2004-11-26 15:08:59 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; fr-FR; rv:1.7.3)
Gecko/20040910

Description of problem:
When the LANG locale is set to something else than "C", "en" or any
"en_XX", redhat-print-config and redhat-config-printer-gui will not work. 

This issue is caused by the following command in Python scripts:
       signal.signal (signal.SIGCHLD, signal.SIG_DFL)
->     f = os.popen ('/usr/sbin/alternatives --display print')
       for l in f.readlines ():
           if l.startswith (" link currently points to"):
               which = l.split ('.')[1].strip ()

The output of '/usr/sbin/alternatives --display print' may not be in
English. To correct this problem, one should use instead:`
       signal.signal (signal.SIGCHLD, signal.SIG_DFL)
->     f = os.popen ('LANG=C /usr/sbin/alternatives --display print')
       for l in f.readlines ():
           if l.startswith (" link currently points to"):
               which = l.split ('.')[1].strip ()

Those lines are found in 3 different scripts:
 - /usr/share/printconf/util/cups_import.py
 - /usr/share/printconf/util/printconf_conf.py
 - /usr/share/printconf/util/queueTree.py

Version-Release number of selected component (if applicable):
redhat-config-printer-0.6.47.3.19-1

How reproducible:
Always

Steps to Reproduce:
1. lang=fr_CA redhat-config-print
    

Actual Results:  The program crash and outputs:

Traceback (most recent call last):
  File "/usr/sbin/printconf", line 9, in ?
    import queueTree
  File "/usr/share/printconf/util/queueTree.py", line 945, in ?
    queueTree()
  File "/usr/share/printconf/util/queueTree.py", line 222, in __init__
    self.active_spooler = self.get_active_spooler ()
  File "/usr/share/printconf/util/queueTree.py", line 243, in
get_active_spooler
    return which
UnboundLocalError: local variable 'which' referenced before assignment


Expected Results:  A GUI should appear. I should be able to configure
my printer via this GUI.

Additional info:

The solution for this bug was submitted by Juan Carlos Castro y Castro
<jcastro.br> in the Tao-discuss mailing list.

http://mailman.taolinux.org/pipermail/tao-discuss/2004-November/000702.html

Comment 1 Patrice Guay 2004-11-26 15:11:18 UTC
Created attachment 107484 [details]
Patch to correct this bug

Comment 2 Tim Waugh 2004-11-26 15:59:06 UTC

*** This bug has been marked as a duplicate of 131563 ***