[Python-bugs-list] [ python-Bugs-827760 ] Bug in dbm - long strings
in keys and values
SourceForge.net
noreply at sourceforge.net
Tue Oct 21 16:05:57 EDT 2003
Bugs item #827760, was opened at 2003-10-21 13:05
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=827760&group_id=5470
Category: None
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: John Draper (jdcrunchman)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bug in dbm - long strings in keys and values
Initial Comment:
#!/usr/local/bin/python
#2003-10-19. Feedback to crunch at shopip.com
import dbm
print """
Python dbm bugs summary:
1. Long strings cause weirdness.
2. Long keys fail without returning error.
This demonstrates serious bugs in the Python dbm
module.
Present in OpenBSD versions 2.2, 2.3, and 2.3.2c1.
len(key+string)>61231 results in the item being 'lost',
without warning.
If the key or string is one character shorter, it is fine.
Writing multiple long strings causes unpredictable results
(none, some, or all of the items are lost without warning).
Curiously, keys of length 57148 return an error, but
longer keys fail without warning
(sounds like an = instead of a > somewhere).
"""
mdb=dbm.open("mdb","n")
print "Writing 1 item to database, but upon reading,"
k='k'
v='X'*61230 #Long string
mdb[k]=v
mdb.close()
md=dbm.open("mdb","r")
print "database contains %i items"%len(md.keys())
md.close()
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=827760&group_id=5470
More information about the Python-bugs-list
mailing list