[mod_python] odd behaviour of the md5-module in modpy

Graham Dumpleton grahamd at dscpl.com.au
Wed Jul 5 18:36:53 EDT 2006


Deron Meranda wrote ..
> > Am Mittwoch, 5. Juli 2006 16:19 schrieb Alain Tesio:
> > > I had exactly the same problem with values returned by md5 changing
> > > only from modpython.
> > >
> > > On my debian machine it was caused by the installation of the package
> > > libmhash2:
> 
> It sounds like the culprit may have been found, <http://mhash.sourceforge.net/>
> 
> There is also apparently a Python binding to libmhash,
> <http://labix.org/python-mhash>.
> Do you know if that might have been installed as well an your affected
> machines?
> Perhaps it actually replaces the Python built-in hashes some way, although
> I still don't know how the mod_python environment would be different.
> 
> It is probably worth reporting this potential "incompatibility" upstream
> to the
> libmhash/python-mhash folks too to see what they may know.
> It's not a good thing when cryptographic functions silently fail.

There is probably a shared library involved somewhere and they have
chosen names for functions which are the same as some functions
in some other library required by Python for md5 stuff. The libmhash
is probably getting loaded first and because they already exist, the
other libraries functions aren't being used but the wrong ones from
libmhash.

This would be similar to the libexpat version problem where it picks
up the wrong version of expat library loaded by Apache instead of
one compiled into pyexpat. See:

  http://www.dscpl.com.au/articles/modpython-006.html

for that plays out and how it might be similar.

Hope we can sort this out conclusively. For various reasons the new
module importer is currently using md5 hexdigest to construct a
fake but unique (hopefully) module name for loaded modules. This
is used in __name__ attribute of modules. This may be able to be
changed as this carried over from when my module importer was
still storing stuff in sys.modules where using a file pathname with
slashes for module name would cause big problems. In short, the
libmhash problem would cause the new module importer to not work
at all and screw up mod_python big time.

Graham



More information about the Mod_python mailing list