trolldbois / python-haystack

Process heap analysis framework - Windows/Linux - record type inference and forensics
http://trolldbois.blogspot.com/search?q=python-haystack
GNU General Public License v3.0
94 stars 33 forks source link

haystack breaks ctypes pointer NULL conversion behavior #1

Closed intgr closed 11 years ago

intgr commented 11 years ago

I don't know whether you actually care about this, but I felt best to report this anyway.

One of our developers accidentally used pip to install your 'haystack' package instead of 'django-haystack'. By complete chance, everything else seemed to work fine, but it broke a completely unrelated module in our project which uses ctypes bindings, because of the way your haystack overrides ctypes.c_types_p

Here's a quick test case:

>>> import ctypes
>>> libc = ctypes.CDLL('libc.so.6')
# works
>>> libc.tmpnam.argtypes = [ctypes.c_char_p]
>>> libc.tmpnam.restype = ctypes.c_char_p
>>> libc.tmpnam(None)
'/tmp/filegsk9cA'
# breaks after importing haystack
>>> import haystack
>>> libc.tmpnam.argtypes = [ctypes.c_char_p]
>>> libc.tmpnam(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: expected CString instance instead of NoneType
trolldbois commented 11 years ago

HI,

nice to know. thanks

I'm sorry for the time lost on your project.

2012/10/17 Marti notifications@github.com

I don't know whether you actually care about this, but I felt best to report this anyway.

One of our developers accidentally used pip to install your 'haystack' package instead of 'django-haystack'. By complete chance, everything else seemed to work fine, but it broke a completely unrelated module in our project which uses ctypes bindings, because of the way your haystack overrides ctypes.c_types_p

Here's a quick test case:

import ctypes>>> libc = ctypes.CDLL('libc.so.6')# works>>> libc.tmpnam.argtypes = [ctypes.c_char_p]>>> libc.tmpnam.restype = ctypes.c_char_p>>> libc.tmpnam(None)'/tmp/filegsk9cA'# breaks after importing haystack>>> import haystack>>> libc.tmpnam.argtypes = [ctypes.c_char_p]>>> libc.tmpnam(None)Traceback (most recent call last): File "", line 1, in ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: expected CString instance instead of NoneType

— Reply to this email directly or view it on GitHubhttps://github.com/trolldbois/python-haystack/issues/1.

Loïc Jaquemet

edmurphy16 commented 10 years ago

also ran into this error wasted a day finding the resolution because my initial error stated

ArgumentError: argument 2: <type 'exceptions.TypeError'>: expected CString instance instead of str

for which google gave no help hopefully adding this comment will at least help future google searches

trolldbois commented 10 years ago

Google help: django-haystack django search error python haystack CString error django CString error haystack c_void_p error ArgumentError: argument 2: : expected CString instance instead of str

This is not a django package.