[jira] [Commented] (HDFS-7817) libhdfs3: fix strerror_r detection
[ https://issues.apache.org/jira/browse/HDFS-7817?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14343662#comment-14343662 ] Colin Patrick McCabe commented on HDFS-7817: thanks, [~thanhdo]. libhdfs3: fix strerror_r detection -- Key: HDFS-7817 URL: https://issues.apache.org/jira/browse/HDFS-7817 Project: Hadoop HDFS Issue Type: Sub-task Components: hdfs-client Reporter: Colin Patrick McCabe Assignee: Thanh Do The signature of strerror_r is not quite detected correctly in libhdfs3. The code assumes that {{int foo = strerror_r}} will fail to compile with the GNU type signature, but this is not the case (C\+\+ will coerce the char* to an int in this case). Instead, we should do what the libhdfs {{terror}} (threaded error) function does here. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HDFS-7817) libhdfs3: fix strerror_r detection
[ https://issues.apache.org/jira/browse/HDFS-7817?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14339781#comment-14339781 ] Thanh Do commented on HDFS-7817: +1 for this. Will submit a patch soon libhdfs3: fix strerror_r detection -- Key: HDFS-7817 URL: https://issues.apache.org/jira/browse/HDFS-7817 Project: Hadoop HDFS Issue Type: Sub-task Components: hdfs-client Reporter: Colin Patrick McCabe The signature of strerror_r is not quite detected correctly in libhdfs3. The code assumes that {{int foo = strerror_r}} will fail to compile with the GNU type signature, but this is not the case (C\+\+ will coerce the char* to an int in this case). Instead, we should do what the libhdfs {{terror}} (threaded error) function does here. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HDFS-7817) libhdfs3: fix strerror_r detection
[ https://issues.apache.org/jira/browse/HDFS-7817?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14337235#comment-14337235 ] Colin Patrick McCabe commented on HDFS-7817: That's one approach. Another approach is to force a standards-compliant strerror_r to be used by including special #ifdefs at the top of the file using strerror_r. Since sys_errlist is deprecated, that might be the better way. libhdfs3: fix strerror_r detection -- Key: HDFS-7817 URL: https://issues.apache.org/jira/browse/HDFS-7817 Project: Hadoop HDFS Issue Type: Sub-task Components: hdfs-client Reporter: Colin Patrick McCabe The signature of strerror_r is not quite detected correctly in libhdfs3. The code assumes that {{int foo = strerror_r}} will fail to compile with the GNU type signature, but this is not the case (C\+\+ will coerce the char* to an int in this case). Instead, we should do what the libhdfs {{terror}} (threaded error) function does here. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HDFS-7817) libhdfs3: fix strerror_r detection
[ https://issues.apache.org/jira/browse/HDFS-7817?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14335048#comment-14335048 ] Thanh Do commented on HDFS-7817: Hi [~cmccabe]. Thanks for pointing out the code. I was grepping the {{hadoop-hdfs}} folder but not {{hadoop-common}}. So this Jira is about using {{sys_errlist}} instead of {{strerror_r}} for libhdfs3 right? libhdfs3: fix strerror_r detection -- Key: HDFS-7817 URL: https://issues.apache.org/jira/browse/HDFS-7817 Project: Hadoop HDFS Issue Type: Sub-task Components: hdfs-client Reporter: Colin Patrick McCabe The signature of strerror_r is not quite detected correctly in libhdfs3. The code assumes that {{int foo = strerror_r}} will fail to compile with the GNU type signature, but this is not the case (C\+\+ will coerce the char* to an int in this case). Instead, we should do what the libhdfs {{terror}} (threaded error) function does here. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HDFS-7817) libhdfs3: fix strerror_r detection
[ https://issues.apache.org/jira/browse/HDFS-7817?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14334290#comment-14334290 ] Colin Patrick McCabe commented on HDFS-7817: {{hadoop-common-project/hadoop-common/src/main/native/src/exception.c}} has this: {code} const char* terror(int errnum) { #if defined(__sun) // MT-Safe under Solaris which doesn't support sys_errlist/sys_nerr return strerror(errnum); #else if ((errnum 0) || (errnum = sys_nerr)) { return unknown error.; } return sys_errlist[errnum]; #endif } {code} We could do something more clever with detecting POSIX {{strerror_r}}, but it's kind of a pain and {{sys_errlist}} seems to work well. libhdfs3: fix strerror_r detection -- Key: HDFS-7817 URL: https://issues.apache.org/jira/browse/HDFS-7817 Project: Hadoop HDFS Issue Type: Sub-task Components: hdfs-client Reporter: Colin Patrick McCabe The signature of strerror_r is not quite detected correctly in libhdfs3. The code assumes that {{int foo = strerror_r}} will fail to compile with the GNU type signature, but this is not the case (C\+\+ will coerce the char* to an int in this case). Instead, we should do what the libhdfs {{terror}} (threaded error) function does here. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (HDFS-7817) libhdfs3: fix strerror_r detection
[ https://issues.apache.org/jira/browse/HDFS-7817?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14329873#comment-14329873 ] Thanh Do commented on HDFS-7817: Hey [~cmccabe], can you point me to the {{terror}} in libhdfs? I greped for this name but couldn't find it. I would like to take a crack at this if you don't mind. Thanks! libhdfs3: fix strerror_r detection -- Key: HDFS-7817 URL: https://issues.apache.org/jira/browse/HDFS-7817 Project: Hadoop HDFS Issue Type: Sub-task Components: hdfs-client Reporter: Colin Patrick McCabe The signature of strerror_r is not quite detected correctly in libhdfs3. The code assumes that {{int foo = strerror_r}} will fail to compile with the GNU type signature, but this is not the case (C\+\+ will coerce the char* to an int in this case). Instead, we should do what the libhdfs {{terror}} (threaded error) function does here. -- This message was sent by Atlassian JIRA (v6.3.4#6332)