[
https://issues.apache.org/jira/browse/HADOOP-10989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14105719#comment-14105719
]
Colin Patrick McCabe commented on HADOOP-10989:
-----------------------------------------------
Patch looks reasonable to me. Just out of curiosity, was there a specific
operating system or environment you found that had this problem? I haven't
seen it yet, but there are a lot of libraries out there.
{code}
+ // Return value is different on FreeBSD vs. Linux.
+#ifdef __FreeBSD__
if (ret >= 0) {
+#else
+ if (ret > 0) {
+#endif
{code}
Let's describe *how* the return value is different in the comment. My
understanding is that on Linux, the return value is supposed to be the number
of groups found, whereas on FreeBSD, it should be 0 for success and -1 for
failure. We should also include a reference to this JIRA in the comment, or
else someone might try to "optimize" by just replacing it with ret >= 0 for all
cases, as has happened before. It's a very reasonable thing to do after
reading the man page.
I also feel that we should be special-casing Linux here, not FreeBSD. In the
absence of bugs, checking for ret >= 0 should be enough to verify success, and
we're aware of such bugs only on Linux. (Of course this isn't Linux's fault...
probably some 3rd party library)
> Work around buggy getgrouplist() implementations on Linux that return 0 on
> failure
> ----------------------------------------------------------------------------------
>
> Key: HADOOP-10989
> URL: https://issues.apache.org/jira/browse/HADOOP-10989
> Project: Hadoop Common
> Issue Type: Bug
> Components: native
> Affects Versions: 3.0.0, 2.6.0
> Reporter: Chris Nauroth
> Assignee: Chris Nauroth
> Attachments: HADOOP-10989.1.patch
>
>
> HADOOP-10781 corrected the handling of the return value from {{getgrouplist}}
> to work on FreeBSD. However, it also regressed fixes that had been put in
> place to work around issues with {{getgrouplist}} on Linux. This issue will
> restore that behavior, but still retain compatibility with FreeBSD.
--
This message was sent by Atlassian JIRA
(v6.2#6252)