Re: m4 failure on OS X High Sierra, with patch

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.bugs
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 06/23/2018 01:48 PM, George Hartzell wrote:
> 
> Hi All,
> 
> I'm ensuring that the Spack packager can build m4 on OS X High Sierra.
> 
> Here's my PR for them:
> 
>      https://github.com/spack/spack/pull/8559

Making someone chase a URL is not friendly for long-term archives. 
Here's a summary:

+With format string strictness, High Sierra also enforces that %n isn't used
+in dynamic format strings, but we should just disable its use on darwin in
+general.
+
+--- a/lib/vasnprintf.c.orig	2017-06-22 15:19:15.000000000 -0700
++++ b/lib/vasnprintf.c	2017-06-22 15:20:20.000000000 -0700
+@@ -4869,7 +4869,7 @@ VASNPRINTF (DCHAR_T *resultbuf, size_t *
+ #endif
+                   *fbp = dp->conversion;
+ #if USE_SNPRINTF
+-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && 
!defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! 
defined __CYGWIN__))
++# if !defined(__APPLE__) && !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && 
__GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || 
defined __WIN32__) && ! defined __CYGWIN__))
+                 fbp[1] = '%';
+                 fbp[2] = 'n';
+                 fbp[3] = '\0';

In other words, you are patching gnulib to work around MacOS's new 
strictness that prevents the POSIX-compliant use of %n within 
snprintf().  As similar patches have already been made in upstream 
gnulib, the next release of m4 should automatically work with newer 
MacOS by virtue of updating to a newer gnulib.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.