-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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 #392 - Ensure XSI-compliant strerror_r is used. #669
Fix #392 - Ensure XSI-compliant strerror_r is used. #669
Conversation
Maybe it makes more sense to pass it in as a compiler flag, ensuring that it's defined everywhere regardless of code paths? |
Yes, and I'd use an inline function instead of a macro to ensure the XSI function is called. |
Passing the definition as a compiler flag (to libjnidispatch sources) produces undefined behavior (jvm crash) on my Fedora 23 x86_64 system.
I may have a closer look by performing dichotomy to isolate faulty header later, depending on my workload. |
My workload prevents me from looking at the SEGFAULT when the flag is set globally. In the meantime, what about applying this patch as a first step ? |
This macro was used after some standard header includes. Depending on implementation, if one of theses headers were using <string.h>, the later presence of _XOPEN_SOURCE macro would'nt matter. This prevents uninitialized buffer from being passed to snprintf. Signed-off-by: David Keller <[email protected]>
cherry-pick should be ok. On Sun, Sep 11, 2016 at 12:42 PM, matthiasblaesing <[email protected]
|
@DavidKeller please revisit this. Your modifications breaks the windows build:
|
In order to build on Windows 10/Visual studio 2015/MinGW I had to patch @matthiasblaesing which version of Windows/Visual Studio are you using ? |
@DavidKeller I'm building with Windows SDK 7.1 (https://www.microsoft.com/en-us/download/details.aspx?id=8279) - It was a bit tricky to install, but after that it beautifully build JNA. My complete cheat sheet for this:
None the less the changes you made to the build to be able to build with VS 2015 would be very interesting. There is #603, which looks as if it covers the whole problem. While I'm happy that I was able to setup a build environment that works for me, the enviroment uses old software and I see the day coming microsoft pull the 7.1 SDK or it is not installable (even with tricks...). Could you comment with your patches to the build system for VS2015 on that bug? With regard to the changes you did - I just did a quick sanity check (test on linux64, windows 32bit, windows 64bit) and this worked out beautifully. I'll look into this in the next few days, as I also want to merge #700 and both of these PRs need the native parts rebuild, I plan to rebuild the native parts (as far as I can do) after both are merged. |
@DavidKeller sorry for the late reply, but I'm unable to confirm this fix. This is what I see:
The imported symbols are interesting (this was pointed out in #392): pre-build:
my build:
The man-page says:
I tried debian oldstable, but that already carries glibc 2.13, so I could not check if building against a glibc prior to 2.3.4 would result in the problem. At this point I'm reluctant to merge the changes, as a current tool chain produces correct behavior. @twall could you have a look at your build environment and check the libc that is used/present? I'm setting up a build environment - I'm able to build:
I'm looking into qemu-debootstrap, which should make it possible to create chroot without literally putting hours into it for one build. For other architectures I'll experiment, but won't promise. |
I've got an old linux VM with an old glibc version (2.3.6), have done What exactly do you want to validate? On Wed, Sep 21, 2016 at 3:27 PM, matthiasblaesing [email protected]
|
@matthiasblaesing According to man strerror(3):
So the problem is present with any glibc version < 2.4, that's why binaries from @twall build system (glibc 2.3.6) suffer from bug #392. Anyway, even if the build system gets upgraded, I believe theses commits should be applied for tree reasons:
I'm not sure the fact that _POSIX_C_SOURCE is defined by default since glibc 2.4 remove this restriction.
|
@DavidKeller Thank you! As promised I merged the PRs and rebuild the native libraries. To prevent regressions I added a unittest to check the "correct" return from strerror_r. The build script ensures an unlocalized locale, so I have some hope, that the message for a bad filedescriptor is always the same. |
Thank you @matthiasblaesing. I'm afraid the If I were you, I'd remove the |
Motivation: There was a new netty release Modifications: Upgrade to 4.1.107.Final Result: Use latest netty version
This
_XOPEN_SOURCE
macro was used after some standard header includes. Which is not POSIX compliant.Depending on libc implementation, if one of theses headers were using
<string.h>
, the later presence of_XOPEN_SOURCE
macro would't matter as the<string.h>
would't be included again.This prevents uninitialized buffer from being passed to
printf
(search forSTR_ERROR
in dispatch.c).Signed-off-by: David Keller [email protected]