Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 228505 - Epson Stylus D78 gets wrong driver for queue
Summary: Epson Stylus D78 gets wrong driver for queue
Alias: None
Product: Fedora
Classification: Fedora
Component: system-config-printer
Version: 6
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Tim Waugh
QA Contact:
Depends On:
Blocks: FC6Update
TreeView+ depends on / blocked
Reported: 2007-02-13 12:50 UTC by Tim Waugh
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version: 0.7.52-1.fc6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2007-02-15 09:55:37 UTC

Attachments (Terms of Use)

Description Tim Waugh 2007-02-13 12:50:59 UTC
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 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):

How reproducible:

Steps to Reproduce:
1. Run this Python program:

import sys
sys.path.append ('/usr/share/system-config-printer')
import foomatic
mdl='Stylus D78'
print f.getPrinterFromDeviceID(mfg,mdl,commandsets=cmd)
Actual results:
Writing new pickle
Please report a bug in Bugzilla against 'foomatic':
Include this complete message.
Guessing Epson-Stylus_Pro_10000 from IEEE 1284 ID:
      <model>Stylus D78</model>

Expected results:
Writing new pickle
Please report a bug in Bugzilla against 'foomatic':
Include this complete message.
Guessing Epson-Stylus_D68 from IEEE 1284 ID:
      <model>Stylus D78</model>

Additional info:
Fix is:

RCS file: /usr/local/CVS/system-config-printer/,v
retrieving revision 1.52
diff -d -u -r1.52
--- 8 Jan 2007 15:59:52 -0000       1.52
+++ 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):

Comment 1 Tim Waugh 2007-02-13 12:56:14 UTC
Fixed in CVS.

Comment 2 Tim Waugh 2007-02-13 13:23:46 UTC
FC6 test update: 0.7.52-1.fc6.

Comment 3 Tim Waugh 2007-02-14 13:32:02 UTC
Fix verified.

Comment 4 Fedora Update System 2007-02-14 20:01:14 UTC
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.