[Python-Dev] Re: problems with DBM nonuniformity
Skip Montanaro
skip@pobox.com (Skip Montanaro)
Thu, 29 Nov 2001 19:35:05 -0600
Jason> On Linux, "whitelist.db" = whitelist.db when the default module is
Jason> dbhash, so there is no problem:
...
Jason> However on Solaris for example (default module of dbm):
Jason> % python -c "import anydbm;wl = anydbm.open('whitelist.db','c')"
Jason> % ls -l whitelist*
Jason> -rw------- 1 jason users 0 Nov 29 19:13 whitelist.db.dir
Jason> -rw------- 1 jason users 0 Nov 29 19:13 whitelist.db.pag
Jason> Under Linux, the dbm module acts differently, adding a '.db'
Jason> suffix to the given filename:
Jason> % python -c "import dbm;wl = dbm.open('whitelist.db','c')"
Jason> % ls -l whitelist*
Jason> -rw------- 1 jasonrm acl 16384 Nov 29 17:21 whitelist.db.db
Jason> So, I can't rely on comparing "whitelist" with "whitelist.db"
Jason> filename to filename since the latter might not exist.
...
Jason> Does anyone have some suggestions on how I might support this
Jason> feature in a cross-platform, and generic fashion?
Seems to me the natural thing to do would be to add "get_data_filename" and
"get_index_filename" methods (or something similar) to the underlying
modules (dbhash, bsddb, dbm, etc) and expose them through anydbm.
It's too late for 2.2, but I suspect if you implemented something and method
name(s) could be settled on it would make it into CVS early in the 2.3
cycle. This seems like a small enough change that you just file a bug
report on SourceForge with the proposal and add an implementation when you
have something workable.
--
Skip Montanaro (skip@pobox.com - http://www.mojam.com/)