Bug 228505 - Epson Stylus D78 gets wrong driver for queue
Epson Stylus D78 gets wrong driver for queue
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: system-config-printer (Show other bugs)
6
All Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
:
Depends On:
Blocks: FC6Update 228506
  Show dependency treegraph
 
Reported: 2007-02-13 07:50 EST by Tim Waugh
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: 0.7.52-1.fc6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-02-15 04:55:37 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Tim Waugh 2007-02-13 07:50:59 EST
Description of problem:
When trying to create a queue for an Epson Stylus D78 (which is not in the
foomatic database yet), the close-match logic in foomatic.py ends up choosing
Epson Stylus Pro 10000 because

a) when scanning through the list, it isn't sorted in model order, and
b) the 'how many characters match' logic is slightly wrong

Version-Release number of selected component (if applicable):
system-config-printer-0.7.50-1.fc6

How reproducible:
100%

Steps to Reproduce:
1. Run this Python program:

#!/usr/bin/python
import sys
sys.path.append ('/usr/share/system-config-printer')
import foomatic
f=foomatic.Foomatic()
mfg='EPSON'
mdl='Stylus D78'
cmd=['ESCPL2','BDC','D4','D4PX']
print f.getPrinterFromDeviceID(mfg,mdl,commandsets=cmd)
  
Actual results:
Writing new pickle
Please report a bug in Bugzilla against 'foomatic':
  https://bugzilla.redhat.com/bugzilla
Include this complete message.
Guessing Epson-Stylus_Pro_10000 from IEEE 1284 ID:
      <manufacturer>EPSON</manufacturer>
      <model>Stylus D78</model>
      <description></description>
      <commandset>ESCPL2,BDC,D4,D4PX</commandset>
Epson-Stylus_Pro_10000

Expected results:
Writing new pickle
Please report a bug in Bugzilla against 'foomatic':
  https://bugzilla.redhat.com/bugzilla
Include this complete message.
Guessing Epson-Stylus_D68 from IEEE 1284 ID:
      <manufacturer>EPSON</manufacturer>
      <model>Stylus D78</model>
      <description></description>
      <commandset>ESCPL2,BDC,D4,D4PX</commandset>
Epson-Stylus_D68

Additional info:
Fix is:

Index: foomatic.py
===================================================================
RCS file: /usr/local/CVS/system-config-printer/foomatic.py,v
retrieving revision 1.52
diff -d -u -r1.52 foomatic.py
--- foomatic.py 8 Jan 2007 15:59:52 -0000       1.52
+++ foomatic.py 13 Feb 2007 12:49:17 -0000
@@ -776,12 +776,17 @@
             # Try to find the best match (case-insensitive)
             best_matchlen = 0
             mdll = mdl.lower ()
-            for (name, id) in mdls.iteritems():
-                name = name.lower ()
+            mdlnames = mdls.keys ()
+            mdlnames.sort (cups.modelSort)
+            mdlitems = map (lambda x: (x.lower (), mdls[x]), mdlnames)
+            for (name, id) in mdlitems:
                 if mdll[:1 + best_matchlen] == name[:1 + best_matchlen]:
-                    extra = 2
-                    while (mdll[1 + best_matchlen:extra + best_matchlen] ==
-                           name[1 + best_matchlen:extra + best_matchlen]):
+                    # We know we've got one more character matching.
+                    # Can we match any more on this entry?
+                    extra = 1
+                    while (mdll[1 + best_matchlen:1 + best_matchlen + extra] ==
+                           name[1 + best_matchlen:1 + best_matchlen + extra]):
+                        # Yes!  Try another!
                         extra += 1
                         if extra + best_matchlen >= len (name):
                             break
Comment 1 Tim Waugh 2007-02-13 07:56:14 EST
Fixed in CVS.
Comment 2 Tim Waugh 2007-02-13 08:23:46 EST
FC6 test update: 0.7.52-1.fc6.
Comment 3 Tim Waugh 2007-02-14 08:32:02 EST
Fix verified.
Comment 4 Fedora Update System 2007-02-14 15:01:14 EST
Fixed in update: system-config-printer-0.7.52-1.fc6

Note You need to log in before you can comment on or make changes to this bug.