-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the order in which ffi.cdef() is called for the included header files #53
Comments
Is there anything I can do to help get this issue resolved? |
LGTM. Unfortunate that there's no test coverage, but at least it's documented there... |
Call ffi.cdef() for header files in predictable order Closes #53.
@lvh, thanks. Fwiw, I think things like these are hard to test. In practice the |
Unit tests probably shouldn't touch filesystems in the first place; I'm thinking more of a fake |
(In this case, that doesn't really mean you end up not touching the filesystem, I suppose, but you get the idea: instead of trying to coerce the filesystem to produce different orders for |
Currently PyNaCl obtains a list of header files using
glob.glob()
, then callsffi.cdef()
for each header file. This breaks horribly at runtime if the order ofglob()
is different from what it was at build time (which may happen with some file systems, or after restoring a backup), resulting in very cryptic errors at runtime, even though the build/install step succeeded just fine:Under the hood CFFI generates file names like
_cffi__xd64d2119xefb54d7c.so
at compile time, and tries to load a different file at runtime. The reason for this is that the CRC32 part of the file name is based on (among other things) a concatenation of the strings passed foffi.cdef()
, in the order it was called.The fix is to always
.cdef()
the headers in the same order.The text was updated successfully, but these errors were encountered: