GitHub user vespian opened a pull request:
https://github.com/apache/zookeeper/pull/70
Fix NULL handling for getlogin() call
This patch fixes issues with CoreOs if e.g. go binary is linking to
libzookeeper_mt.
The problem here is that:
* in case of statically linked go binaries, they are still relying on glibc
for fetching the most basic system information (accounts, dns, i.e.)
* there is bug/ambiguity in gcc:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15685
* libc libraries differ between centos/debian-jessie(golang container base
image) and CoreOs
* the return code is not checked for getlogin() call:
https://github.com/apache/zookeeper/blob/trunk/src/c/src/zookeeper.c#L1048
(getlogin can return NULL)
So the idea is to actually check exit status from getlogin() call and return
some predefined string if it's NULL.
We may try to fix log_message function itself(i.e. detect NULL pointers to
strings)
but I tend to agree with Manuel López-Ibáñez from gcc bug report - NULL
strings
should not be permitted/avoided.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/vespian/zookeeper
prozlach/fix_getlogin_is_NULL
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zookeeper/pull/70.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #70
----
commit 83e26040b5275d6f48fc1b1c3af210b6f1f4e026
Author: Pawel Rozlach <[email protected]>
Date: 2016-06-07T10:37:01Z
Fix NULL handling for getlogin() call
This patch fixes issues with CoreOs if e.g. go binary is linking to
libzookeeper_mt.
The problem here is that:
* in case of statically linked go binaries, they are still relying on glibc
for fetching the most basic system information (accounts, dns, i.e.)
* there is bug/ambiguity in gcc:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15685
* libc libraries differ between centos/debian-jessie(golang container base
image) and CoreOs
* the return code is not checked for getlogin() call:
https://github.com/apache/zookeeper/blob/trunk/src/c/src/zookeeper.c#L1048
(getlogin can return NULL)
So the idea is to actually check exit status from getlogin() call and return
some predefined string if it's NULL.
We may try to fix log_message function itself(i.e. detect NULL pointers to
strings)
but I tend to agree with Manuel López-Ibáñez from gcc bug report - NULL
strings
should not be permitted/avoided.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---