[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread Hudson (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183442#comment-16183442
 ] 

Hudson commented on ZOOKEEPER-2905:
---

SUCCESS: Integrated in Jenkins build ZooKeeper-trunk #3551 (See 
[https://builds.apache.org/job/ZooKeeper-trunk/3551/])
ZOOKEEPER-2905: Don't include `config.h` in `zookeeper.h` (phunt: rev 
0fee905684a82eefb2d7d4a999290fb2f2378b41)
* (edit) src/c/src/zookeeper.c
* (edit) src/c/include/zookeeper.h


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
> Fix For: 3.5.4, 3.6.0, 3.4.11
>
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183438#comment-16183438
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user andschwa commented on the issue:

https://github.com/apache/zookeeper/pull/381
  
Thanks!


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
> Fix For: 3.5.4, 3.6.0, 3.4.11
>
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183439#comment-16183439
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user andschwa closed the pull request at:

https://github.com/apache/zookeeper/pull/381


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
> Fix For: 3.5.4, 3.6.0, 3.4.11
>
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183435#comment-16183435
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user andschwa commented on the issue:

https://github.com/apache/zookeeper/pull/382
  
Thanks!


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
> Fix For: 3.5.4, 3.6.0, 3.4.11
>
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183436#comment-16183436
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user andschwa closed the pull request at:

https://github.com/apache/zookeeper/pull/382


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
> Fix For: 3.5.4, 3.6.0, 3.4.11
>
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183432#comment-16183432
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user andschwa commented on the issue:

https://github.com/apache/zookeeper/pull/383
  
Thanks @phunt!


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
> Fix For: 3.5.4, 3.6.0, 3.4.11
>
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183396#comment-16183396
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user phunt commented on the issue:

https://github.com/apache/zookeeper/pull/382
  
@andschwa - can you close this PR? It's been merged but GH only allows 
keyword commands on the default branch and I don't have admin privs. Thanks 
again.


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
> Fix For: 3.5.4, 3.6.0, 3.4.11
>
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183397#comment-16183397
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user phunt commented on the issue:

https://github.com/apache/zookeeper/pull/381
  
@andschwa - can you close this PR? It's been merged but GH only allows 
keyword commands on the default branch and I don't have admin privs. Thanks 
again.


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
> Fix For: 3.5.4, 3.6.0, 3.4.11
>
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183358#comment-16183358
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user asfgit closed the pull request at:

https://github.com/apache/zookeeper/pull/383


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
> Fix For: 3.6.0
>
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183351#comment-16183351
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user phunt commented on the issue:

https://github.com/apache/zookeeper/pull/383
  
Thanks @andschwa - no worries. :-)


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183346#comment-16183346
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user phunt commented on the issue:

https://github.com/apache/zookeeper/pull/383
  
+1, lgtm. I compiled the c client code under Ubuntu 17.04, also compiled 
and successfully ran the tests for zkpython on the same environment.


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183348#comment-16183348
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user phunt commented on the issue:

https://github.com/apache/zookeeper/pull/382
  
+1, lgtm. I compiled the c client code under Ubuntu 17.04, also compiled 
and successfully ran the tests for zkpython on the same environment.


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-27 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16183349#comment-16183349
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user phunt commented on the issue:

https://github.com/apache/zookeeper/pull/381
  
+1, lgtm. I compiled the c client code under Ubuntu 17.04, also compiled 
and successfully ran the tests for zkpython on the same environment.


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-25 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16179949#comment-16179949
 ] 

Hadoop QA commented on ZOOKEEPER-2905:
--

-1 overall.  GitHub Pull Request  Build
  

+1 @author.  The patch does not contain any @author tags.

+0 tests included.  The patch appears to be a documentation patch that 
doesn't require tests.

+1 javadoc.  The javadoc tool did not generate any warning messages.

+1 javac.  The applied patch does not increase the total number of javac 
compiler warnings.

+1 findbugs.  The patch does not introduce any new Findbugs (version 3.0.1) 
warnings.

+1 release audit.  The applied patch does not increase the total number of 
release audit warnings.

-1 core tests.  The patch failed core unit tests.

+1 contrib tests.  The patch passed contrib unit tests.

Test results: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1043//testReport/
Findbugs warnings: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1043//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1043//console

This message is automatically generated.

> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-25 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16179946#comment-16179946
 ] 

Hadoop QA commented on ZOOKEEPER-2905:
--

+1 overall.  GitHub Pull Request  Build
  

+1 @author.  The patch does not contain any @author tags.

+0 tests included.  The patch appears to be a documentation patch that 
doesn't require tests.

+1 javadoc.  The javadoc tool did not generate any warning messages.

+1 javac.  The applied patch does not increase the total number of javac 
compiler warnings.

+1 findbugs.  The patch does not introduce any new Findbugs (version 3.0.1) 
warnings.

+1 release audit.  The applied patch does not increase the total number of 
release audit warnings.

+1 core tests.  The patch passed core unit tests.

+1 contrib tests.  The patch passed contrib unit tests.

Test results: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1044//testReport/
Findbugs warnings: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1044//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1044//console

This message is automatically generated.

> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-25 Thread Hadoop QA (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16179936#comment-16179936
 ] 

Hadoop QA commented on ZOOKEEPER-2905:
--

-1 overall.  GitHub Pull Request  Build
  

+1 @author.  The patch does not contain any @author tags.

+0 tests included.  The patch appears to be a documentation patch that 
doesn't require tests.

+1 javadoc.  The javadoc tool did not generate any warning messages.

+1 javac.  The applied patch does not increase the total number of javac 
compiler warnings.

+1 findbugs.  The patch does not introduce any new Findbugs (version 3.0.1) 
warnings.

+1 release audit.  The applied patch does not increase the total number of 
release audit warnings.

-1 core tests.  The patch failed core unit tests.

+1 contrib tests.  The patch passed contrib unit tests.

Test results: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1045//testReport/
Findbugs warnings: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1045//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
Console output: 
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/1045//console

This message is automatically generated.

> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16179922#comment-16179922
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user andschwa commented on the issue:

https://github.com/apache/zookeeper/pull/383
  
@hanm and finally this PR is for `master`.

Let me reiterate: I'm sorry! Ha, seriously, I can't believe I broke 
practically the same thing I was fixing. You have to be _super_ careful about 
what gets included in public headers.


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16179921#comment-16179921
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

GitHub user andschwa opened a pull request:

https://github.com/apache/zookeeper/pull/383

ZOOKEEPER-2905: Don't include `config.h` in `zookeeper.h`

In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting code
that were included in the public headers, which then broke upstream
projects (in my case, Mesos).

Unfortunately, I inadvertently created a very similar problem, and it
wasn't evident until the build was coupled with another project with the
same bug. More specifically, when including ZooKeeper in Mesos, and
including Google's Glog in Mesos, both projects define the macros
`VERSION`, `PACKAGE_VERSION`, and `PACKAGE_TARNAME`, and do so publicly.
This is commonly defined in `config.h` by Autotools (and by CMake for
ZooKeeper for compatibility), and is not a problem unless included
publicly, such as in `zookeeper.h`, and by more than one project.

When refactoring, I saw two includes in `zookeeper.h` that instead of
being guarded by e.g. `#ifdef HAVE_SYS_SOCKET_H` were guarded by
`#ifndef WIN32`. I erroneously added `#include "config.h"` and guarded
the includes "properly" with a feature guard. However, configuration
files such as `config.h` and `winconfig.h` etc. must never be included
in publicly in `zookeeper.h`, for the reasons given above.

This patch reverts the bug, and instead includes `config.h` in
`zookeeper.c`, where it is not exposed to other projects.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/andschwa/zookeeper ZOOKEEPER-2905-master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/zookeeper/pull/383.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 #383


commit b825ecd08724107f873c726692ea8af02173bb5d
Author: Andrew Schwartzmeyer 
Date:   2017-08-30T23:15:28Z

ZOOKEEPER-2905: Don't include `config.h` in `zookeeper.h`

In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting code
that were included in the public headers, which then broke upstream
projects (in my case, Mesos).

Unfortunately, I inadvertently created a very similar problem, and it
wasn't evident until the build was coupled with another project with the
same bug. More specifically, when including ZooKeeper in Mesos, and
including Google's Glog in Mesos, both projects define the macros
`VERSION`, `PACKAGE_VERSION`, and `PACKAGE_TARNAME`, and do so publicly.
This is commonly defined in `config.h` by Autotools (and by CMake for
ZooKeeper for compatibility), and is not a problem unless included
publicly, such as in `zookeeper.h`, and by more than one project.

When refactoring, I saw two includes in `zookeeper.h` that instead of
being guarded by e.g. `#ifdef HAVE_SYS_SOCKET_H` were guarded by
`#ifndef WIN32`. I erroneously added `#include "config.h"` and guarded
the includes "properly" with a feature guard. However, configuration
files such as `config.h` and `winconfig.h` etc. must never be included
in publicly in `zookeeper.h`, for the reasons given above.

This patch reverts the bug, and instead includes `config.h` in
`zookeeper.c`, where it is not exposed to other projects.




> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef 

[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16179919#comment-16179919
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user andschwa commented on the issue:

https://github.com/apache/zookeeper/pull/382
  
@hanm and this is is for `branch-3.5`.


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16179918#comment-16179918
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

GitHub user andschwa opened a pull request:

https://github.com/apache/zookeeper/pull/382

ZOOKEEPER-2905: Don't include `config.h` in `zookeeper.h`

In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting code
that were included in the public headers, which then broke upstream
projects (in my case, Mesos).

Unfortunately, I inadvertently created a very similar problem, and it
wasn't evident until the build was coupled with another project with the
same bug. More specifically, when including ZooKeeper in Mesos, and
including Google's Glog in Mesos, both projects define the macros
`VERSION`, `PACKAGE_VERSION`, and `PACKAGE_TARNAME`, and do so publicly.
This is commonly defined in `config.h` by Autotools (and by CMake for
ZooKeeper for compatibility), and is not a problem unless included
publicly, such as in `zookeeper.h`, and by more than one project.

When refactoring, I saw two includes in `zookeeper.h` that instead of
being guarded by e.g. `#ifdef HAVE_SYS_SOCKET_H` were guarded by
`#ifndef WIN32`. I erroneously added `#include "config.h"` and guarded
the includes "properly" with a feature guard. However, configuration
files such as `config.h` and `winconfig.h` etc. must never be included
in publicly in `zookeeper.h`, for the reasons given above.

This patch reverts the bug, and instead includes `config.h` in
`zookeeper.c`, where it is not exposed to other projects.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/andschwa/zookeeper ZOOKEEPER-2905-3.5

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/zookeeper/pull/382.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 #382


commit daac5254a1a7472089f6950f60e4a4a1a3fa1f0e
Author: Andrew Schwartzmeyer 
Date:   2017-08-30T23:15:28Z

ZOOKEEPER-2905: Don't include `config.h` in `zookeeper.h`

In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting code
that were included in the public headers, which then broke upstream
projects (in my case, Mesos).

Unfortunately, I inadvertently created a very similar problem, and it
wasn't evident until the build was coupled with another project with the
same bug. More specifically, when including ZooKeeper in Mesos, and
including Google's Glog in Mesos, both projects define the macros
`VERSION`, `PACKAGE_VERSION`, and `PACKAGE_TARNAME`, and do so publicly.
This is commonly defined in `config.h` by Autotools (and by CMake for
ZooKeeper for compatibility), and is not a problem unless included
publicly, such as in `zookeeper.h`, and by more than one project.

When refactoring, I saw two includes in `zookeeper.h` that instead of
being guarded by e.g. `#ifdef HAVE_SYS_SOCKET_H` were guarded by
`#ifndef WIN32`. I erroneously added `#include "config.h"` and guarded
the includes "properly" with a feature guard. However, configuration
files such as `config.h` and `winconfig.h` etc. must never be included
in publicly in `zookeeper.h`, for the reasons given above.

This patch reverts the bug, and instead includes `config.h` in
`zookeeper.c`, where it is not exposed to other projects.




> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef 

[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-25 Thread Andrew Schwartzmeyer (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16179917#comment-16179917
 ] 

Andrew Schwartzmeyer commented on ZOOKEEPER-2905:
-

I didn't catch this sooner as the CMake build on Windows and Linux for Mesos 
uses a newer version of Glog than our Autotools build, which doesn't have this 
bug. So it was when my ZooKeeper patch with the bug was combined with an old 
version of Glog (0.3.3) which also had the bug, that I finally found it.

> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16179916#comment-16179916
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

Github user andschwa commented on the issue:

https://github.com/apache/zookeeper/pull/381
  
Hey @hanm, I found and fixed a bug I made. This patches `branch-3.4`. It 
should be very straightforward.

This is for 
[ZOOKEEPER-2905](https://issues.apache.org/jira/browse/ZOOKEEPER-2905).


> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef HAVE_SYS_SOCKET_H}} were guarded by {{#ifndef 
> WIN32}}. Without realizing that I would create the exact same problem I was 
> elsewhere fixing, I erroneously added {{#include "config.h"}} and guarded the 
> includes "properly." But there is _very good reasons_ not to do this 
> (explained above).
> The patch to fix this is simple:
> {noformat}
> diff --git a/src/c/include/zookeeper.h b/src/c/include/zookeeper.h
> index d20e70af4..b0bb09e3f 100644
> --- a/src/c/include/zookeeper.h
> +++ b/src/c/include/zookeeper.h
> @@ -21,13 +21,9 @@
>  #include 
> -#include "config.h"
> -
> -#ifdef HAVE_SYS_SOCKET_H
> +/* we must not include config.h as a public header */
> +#ifndef WIN32
>  #include 
> -#endif
> -
> -#ifdef HAVE_SYS_TIME_H
>  #include 
>  #endif
> diff --git a/src/c/src/zookeeper.c b/src/c/src/zookeeper.c
> index 220c57dc4..9b837f227 100644
> --- a/src/c/src/zookeeper.c
> +++ b/src/c/src/zookeeper.c
> @@ -24,6 +24,7 @@
>  #define USE_IPV6
>  #endif
> +#include "config.h"
>  #include 
>  #include 
>  #include 
> {noformat}
> I am opening pull requests in a few minutes to have this applied to branch 
> 3.4 and 3.5.
> I'm sorry!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (ZOOKEEPER-2905) Don't include `config.h` in `zookeeper.h`

2017-09-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-2905?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16179912#comment-16179912
 ] 

ASF GitHub Bot commented on ZOOKEEPER-2905:
---

GitHub user andschwa opened a pull request:

https://github.com/apache/zookeeper/pull/381

ZOOKEEPER-2905: Don't include `config.h` in `zookeeper.h`

In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting code
that were included in the public headers, which then broke upstream
projects (in my case, Mesos).

Unfortunately, I inadvertently created a very similar problem, and it
wasn't evident until the build was coupled with another project with the
same bug. More specifically, when including ZooKeeper in Mesos, and
including Google's Glog in Mesos, both projects define the macros
`VERSION`, `PACKAGE_VERSION`, and `PACKAGE_TARNAME`, and do so publicly.
This is commonly defined in `config.h` by Autotools (and by CMake for
ZooKeeper for compatibility), and is not a problem unless included
publicly, such as in `zookeeper.h`, and by more than one project.

When refactoring, I saw two includes in `zookeeper.h` that instead of
being guarded by e.g. `#ifdef HAVE_SYS_SOCKET_H` were guarded by
`#ifndef WIN32`. I erroneously added `#include "config.h"` and guarded
the includes "properly" with a feature guard. However, configuration
files such as `config.h` and `winconfig.h` etc. must never be included
in publicly in `zookeeper.h`, for the reasons given above.

This patch reverts the bug, and instead includes `config.h` in
`zookeeper.c`, where it is not exposed to other projects.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/andschwa/zookeeper ZOOKEEPER-2905

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/zookeeper/pull/381.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 #381


commit 2ec2bc6680d49f3b6917db3f58257a80b4b4144f
Author: Andrew Schwartzmeyer 
Date:   2017-08-30T23:15:28Z

ZOOKEEPER-2905: Don't include `config.h` in `zookeeper.h`

In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting code
that were included in the public headers, which then broke upstream
projects (in my case, Mesos).

Unfortunately, I inadvertently created a very similar problem, and it
wasn't evident until the build was coupled with another project with the
same bug. More specifically, when including ZooKeeper in Mesos, and
including Google's Glog in Mesos, both projects define the macros
`VERSION`, `PACKAGE_VERSION`, and `PACKAGE_TARNAME`, and do so publicly.
This is commonly defined in `config.h` by Autotools (and by CMake for
ZooKeeper for compatibility), and is not a problem unless included
publicly, such as in `zookeeper.h`, and by more than one project.

When refactoring, I saw two includes in `zookeeper.h` that instead of
being guarded by e.g. `#ifdef HAVE_SYS_SOCKET_H` were guarded by
`#ifndef WIN32`. I erroneously added `#include "config.h"` and guarded
the includes "properly" with a feature guard. However, configuration
files such as `config.h` and `winconfig.h` etc. must never be included
in publicly in `zookeeper.h`, for the reasons given above.

This patch reverts the bug, and instead includes `config.h` in
`zookeeper.c`, where it is not exposed to other projects.




> Don't include `config.h` in `zookeeper.h`
> -
>
> Key: ZOOKEEPER-2905
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2905
> Project: ZooKeeper
>  Issue Type: Bug
> Environment: Linux-ish environments.
>Reporter: Andrew Schwartzmeyer
>Assignee: Andrew Schwartzmeyer
>
> In ZOOKEEPER-2841 I fixed the inclusion of project-specific porting changes 
> that were included in the public headers, which then broke upstream projects 
> (in my case, Mesos).
> Unfortunately, I inadvertently created the exact same problem for Linux (or 
> really any system that uses Autotools), and it wasn't evident until the build 
> was coupled with another project with the same problem. More specifically, 
> when including ZooKeeper (with my changes) in Mesos, and including Google's 
> Glog in Mesos, and building both with Autotools (which we also support), both 
> packages define the pre-processor macro {{PACKAGE_VERSION}}, and so so 
> publicly. This is defined in {{config.h}} by Autotools, and is not a problem 
> _unless included publicly_.
> When refactoring, I saw two includes in {{zookeeper.h}} that instead of being 
> guarded by e.g. {{#ifdef