Here's a work around I'd like to include in the upcoming 1.6.1 (which will be based on the stable branch).
The conflicts currently only affect getdomain.c, but it's a problem waiting to happen in the other three files, so I think it's better to just wrap the include. Please comment if you think there is a better way to do this. I'm reluctant to rename the macros since Vincent pointed out this would break patches. -- Kevin J. McCarthy GPG Fingerprint: 8975 A9B3 3AA3 7910 385C 5308 ADEF 7684 8031 6BDA http://www.8t8.us/configs/gpg-key-transition-statement.txt
# HG changeset patch # User Kevin McCarthy <ke...@8t8.us> # Date 1461623503 25200 # Mon Apr 25 15:31:43 2016 -0700 # Branch stable # Node ID 2ed3cc4aa7628cc26a4cb9cab972365647aebf0e # Parent a6a4d6ed0f19149e1ae54a479bdafaa925ddf078 Create a wrapper sys_socket.h to work around Solaris namespace issues. (closes #3833) Solaris includes "sys/stream.h" inside their "sys/socket.h". This include file adds many non-reserved macros to Mutt's namespace, two of which conflict with existing Mutt macros. The simplest fix would be to rename those macros in Mutt, however this will cause difficulty with out-of-tree patches. This fix creates a wrapper include file that preserves those existing macros and prevents the Solaris values from entering Mutt's namespace. diff --git a/Makefile.am b/Makefile.am --- a/Makefile.am +++ b/Makefile.am @@ -67,17 +67,17 @@ mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \ mx.h pager.h pgp.h pop.h protos.h rfc1524.h rfc2047.h \ rfc2231.h rfc822.h rfc3676.h sha1.h sort.h mime.types VERSION prepare \ _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \ mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h \ README.SSL smime.h group.h \ muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \ ChangeLog mkchangelog.sh mutt_idna.h \ - snprintf.c regex.c crypt-gpgme.h hcachever.sh.in \ + snprintf.c regex.c crypt-gpgme.h hcachever.sh.in sys_socket.h \ txt2c.c txt2c.sh version.sh check_sec.sh EXTRA_SCRIPTS = smime_keys mutt_dotlock_SOURCES = mutt_dotlock.c mutt_dotlock_LDADD = $(LIBOBJS) mutt_dotlock_DEPENDENCIES = $(LIBOBJS) diff --git a/getdomain.c b/getdomain.c --- a/getdomain.c +++ b/getdomain.c @@ -19,17 +19,17 @@ #if HAVE_CONFIG_H # include "config.h" #endif #include <string.h> #include <unistd.h> #include <netdb.h> #include <sys/types.h> -#include <sys/socket.h> +#include "sys_socket.h" #include "mutt.h" int getdnsdomainname (char *d, size_t len) { /* A DNS name can actually be only 253 octets, string is 256 */ char *node; diff --git a/mutt_sasl.c b/mutt_sasl.c --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -25,17 +25,17 @@ #include "mutt.h" #include "account.h" #include "mutt_sasl.h" #include "mutt_socket.h" #include <errno.h> #include <netdb.h> #include <sasl/sasl.h> -#include <sys/socket.h> +#include "sys_socket.h" #include <netinet/in.h> static int getnameinfo_err(int ret) { int err; dprint (1, (debugfile, "getnameinfo: ")); switch(ret) { diff --git a/mutt_socket.c b/mutt_socket.c --- a/mutt_socket.c +++ b/mutt_socket.c @@ -35,17 +35,17 @@ #include <netinet/in.h> #include <netdb.h> #include <stdlib.h> #include <fcntl.h> #include <sys/types.h> #ifdef HAVE_SYS_TIME_H #include <sys/time.h> #endif -#include <sys/socket.h> +#include "sys_socket.h" #ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif #include <string.h> #include <errno.h> /* support for multiple socket connections */ static CONNECTION *Connections = NULL; diff --git a/mutt_tunnel.c b/mutt_tunnel.c --- a/mutt_tunnel.c +++ b/mutt_tunnel.c @@ -22,17 +22,17 @@ #endif #include "mutt.h" #include "mutt_socket.h" #include "mutt_tunnel.h" #include <netinet/in.h> #include <sys/types.h> -#include <sys/socket.h> +#include "sys_socket.h" #include <sys/wait.h> #include <fcntl.h> #include <errno.h> /* -- data types -- */ typedef struct { pid_t pid; diff --git a/sys_socket.h b/sys_socket.h new file mode 100644 --- /dev/null +++ b/sys_socket.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2016 Kevin J. McCarthy <ke...@8t8.us> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/* Solaris 11+, OpenIndiana, and probably other derivatives + * are including sys/stream.h inside their sys/socket.h. + * + * This include file is defining macros M_CMD and M_READ which + * are conflicting with the same macros Mutt defines in mutt.h + * + * To minimize breakage with out-of-tree patches, this is a workaround. + */ + +#ifdef M_CMD +# define MUTT_ORIG_CMD M_CMD +# undef M_CMD +#endif + +#ifdef M_READ +# define MUTT_ORIG_READ M_READ +# undef M_READ +#endif + +#include <sys/socket.h> + +#undef M_CMD +#undef M_READ + +#ifdef MUTT_ORIG_CMD +# define M_CMD MUTT_ORIG_CMD +# undef MUTT_ORIG_CMD +#endif + +#ifdef MUTT_ORIG_READ +# define M_READ MUTT_ORIG_READ +# undef MUTT_ORIG_READ +#endif
signature.asc
Description: PGP signature