-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Allow using system installation of argon2 #29
Conversation
_ffi_build.py now searches for the library "argon2" which translates to the linker flag -largon2, instead of -llibargon2. This is more consistent with a linker invocation from a system toolchain, especially since the "lib" prefix for libraries is platform-specific.
2b13f9a
to
1521edc
Compare
Codecov Report
@@ Coverage Diff @@
## master #29 +/- ##
==========================================
- Coverage 88.19% 86.58% -1.62%
==========================================
Files 8 8
Lines 161 164 +3
Branches 19 20 +1
==========================================
Hits 142 142
- Misses 19 22 +3
Continue to review full report at Codecov.
|
I am running argon_cffi -> passlib -> devpi-server successfully with this change set. |
Sorry I didn’t get around looking at it sooner. I’m not entirely enthusiastic about guessing the intent by the presence or absence of the argon2 lib, that’s an invitation for blunders and lots of bogus bug reports. :) How would you feel about having an env variable such that you could do something like this:
? |
You are right. I like your idea better than my current solution. |
1521edc
to
d638f38
Compare
|
The TravisCI build fails due to an error reported by flake8. I don't think the issue is caused by this PR, because I never touched |
Yeah, that would be nice! Another question: would it make sense to somehow allow for customisation of where we look for the installed library? Or should we delegate that to overwriting |
…STEM" is set to "1".
…CFFI_USE_SYSTEM is set. Mixing the headers of the bundled argon2 sources with the system headers or library might result in strange behaviour if the versions are different.
…n enum type "I" denoting the algorithm flavour argon2i.
464ed1a
to
2387533
Compare
Personally, I would go with the customization as is. I don't have a use case for an argon2 clib in a non-standard location on my system. Nobody seemed to bother for the last two years, either :) I am unsure, how this PR has affected test coverage, by the way… |
ping @hynek :) |
Hey I’m super sorry that I’m sort of stalling this whole thing and I really appreciate the work and patience you’re putting out there. The main reason is that it’s seriously scary to me. 👻 But I promise I’ll see this to land, since more and more distros are starting to package it. In any case, we’ll have to find some way to test this behaviour in CI, to ensure it doesn’t break later – just Travis is fine. So we’ll have to get an installation of argon2 into Travis and then install argon2_cffi on top of it. Is that something you’d be willing to do? Have you done something like this before? Re: coverage: it used to be 100% until it went down without any changes in our code so I’ll have to figure it out myself – don’t worry about it. |
If other distros want to create a package, it could be worthwhile to involve them. Do you know of any specific bug tracker issues where we could point to this PR? We could possibly acquire a few more testers. I have previously worked with Travis and I will try to get a running test case there. |
I don’t think we need to do any custom tailoring for now. It should be enough to prove that with the correct CFLAGS/LDFLAGS, a custom Argon2 installation is preferred over the vendored one. |
…king against a system argon2 library.
0786592
to
7be1ae9
Compare
|
Wow that’s sweet! We just need a way to ensure that the system one is actually used. Do you think at least on of the two following options (ideally both 😇) would be possible:
I think it should be rather easy but cffi isn’t on the top of my head right now. |
…on2 library should be used.
Huh, this seems to be more difficult than I expected… We could use What I did is disabling the initialization of the vendored argon2 submodule for the system-argon2 case in Travis. This way, we can be sure that the bindings link against the system version. I couldn't come up with anything better. Any other ideas or pointers? |
Hm not really but maybe @reaperhulk has an idea? |
I don't have a very good suggestion for the short term here, but I would suggest that you submit a PR to libargon2 adding a function that returns the current version. Having it be a constant in the headers but not callable makes it very difficult to confirm the runtime version you've loaded. |
Hm i don’t think that would be super helpful for my problem, because the version could very much match. I really need the path of the lib... so I guess I should rather harass the cffi folks? 🤔 |
(FTR I need to ship attrs 17.4, this one is the next in my FOSS queue) |
Thanks! |
This PR checks whether
extras/libargon2/src
is present (i.e. whether the argon2 submodule was checked out). If it is not present, the compilation step of argon2 (build_clib) will be skipped.During build_ext, the compiler is called with the system-specific include and library dirs anyway, so it will just find argon2, if it is installed correctly on the system.
Note that this PR also changes the library name from libargon2 to just argon2. As far as I know, the lib prefix is platform specific. GCC, for example, automatically looks for
libargon2.so
when-largon2
is specified, whereas MSVC should just expectargon2.dll
. Changing the library name causes distutils to append-largon2
on the command line. This is the only change where I am unsure if it breaks something on Windows or MacOS.Solves #28.
Tested on Linux x86_64.
What are your thoughts on this?