patch #766650 - whichdb not identifying dbm DBs when dbm linked with gdbm
At this point, the problem appears particular to the OS/2 EMX port of gdbm (which is at v1.7.3) - this combination produces a .pag file but no .dir file. A more sophisticated patch which checks magic numbers when dbm.library indicates that dbm is linked to gdbm, and there is no .dir file, is still attached to the above patch entry for reconsideration after 2.3 is released. This checkin applies a workaround specific to the known failure case.
This commit is contained in:
parent
c4bf893952
commit
a1e93e8dfc
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
|
import sys
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import dbm
|
import dbm
|
||||||
|
@ -29,8 +30,10 @@ def whichdb(filename):
|
||||||
try:
|
try:
|
||||||
f = open(filename + os.extsep + "pag", "rb")
|
f = open(filename + os.extsep + "pag", "rb")
|
||||||
f.close()
|
f.close()
|
||||||
f = open(filename + os.extsep + "dir", "rb")
|
# dbm linked with gdbm on OS/2 doesn't have .dir file
|
||||||
f.close()
|
if not (dbm.library == "GNU gdbm" and sys.platform == "os2emx"):
|
||||||
|
f = open(filename + os.extsep + "dir", "rb")
|
||||||
|
f.close()
|
||||||
return "dbm"
|
return "dbm"
|
||||||
except IOError:
|
except IOError:
|
||||||
# some dbm emulations based on Berkeley DB generate a .db file
|
# some dbm emulations based on Berkeley DB generate a .db file
|
||||||
|
|
Loading…
Reference in New Issue