Fix m4 build with the newest gnulib

Bruno Haible <[email protected]>
Newsgroups gmane.comp.gnu.m4.bugs
Message-ID <1717828.AAANMVIouN@omega>
With the newest gnulib, a build of m4 from git fails:

make[2]: Entering directory '/tmp/m4/src'
  CC       m4.o
  CC       builtin.o
builtin.c: In function 'm4_syscmd':
builtin.c:968:44: warning: passing argument 3 of 'execute' from incompatible pointer type [-Wincompatible-pointer-types]
   status = execute (ARG (0), SYSCMD_SHELL, (char **) prog_args, false,
                                            ^
In file included from builtin.c:27:0:
../lib/execute.h:48:12: note: expected 'const char * const*' but argument is of type 'char **'
 extern int execute (const char *progname,
            ^
builtin.c:968:12: error: too few arguments to function 'execute'
   status = execute (ARG (0), SYSCMD_SHELL, (char **) prog_args, false,
            ^
In file included from builtin.c:27:0:
../lib/execute.h:48:12: note: declared here
 extern int execute (const char *progname,
            ^
builtin.c: In function 'm4_esyscmd':
builtin.c:1011:50: warning: passing argument 3 of 'create_pipe_in' from incompatible pointer type [-Wincompatible-pointer-types]
   child = create_pipe_in (ARG (0), SYSCMD_SHELL, (char **) prog_args,
                                                  ^
In file included from builtin.c:31:0:
../lib/spawn-pipe.h:113:14: note: expected 'const char * const*' but argument is of type 'char **'
 extern pid_t create_pipe_in (const char *progname,
              ^
builtin.c:1011:11: error: too few arguments to function 'create_pipe_in'
   child = create_pipe_in (ARG (0), SYSCMD_SHELL, (char **) prog_args,
           ^
In file included from builtin.c:31:0:
../lib/spawn-pipe.h:113:14: note: declared here
 extern pid_t create_pipe_in (const char *progname,
              ^
make[2]: *** [Makefile:1949: builtin.o] Error 1


This is due to the recent changes in the gnulib modules 'execute' and
'spawn-pipe' (see gnulib/NEWS). This patch fixes it. Can you please
apply it? Thanks.
0001-Update-after-gnulib-changed.patch (text/x-patch, 1.7 KB)
From c6f796b82d5ef7fdd30d3a3aa17cf4dbc06d32ad Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sun, 13 Dec 2020 01:46:46 +0100
Subject: [PATCH] Update after gnulib changed.

* src/builtin.c (m4_syscmd): Update 'execute' invocation.
(m4_esyscmd): Update 'create_pipe_in' invocation.
* po/POTFILES.in: Remove lib/w32spawn.h. Add lib/openat-die.c, lib/os2-spawn.c.
---
 po/POTFILES.in | 3 ++-
 src/builtin.c  | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7685034..5a5004d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -25,13 +25,14 @@ lib/error.c
 lib/execute.c
 lib/getopt.c
 lib/obstack.c
+lib/openat-die.c
+lib/os2-spawn.c
 lib/quotearg.c
 lib/siglist.h
 lib/spawn-pipe.c
 lib/strsignal.c
 lib/verror.c
 lib/version-etc.c
-lib/w32spawn.h
 lib/wait-process.c
 lib/xalloc-die.c
 src/builtin.c
diff --git a/src/builtin.c b/src/builtin.c
index 9c43b72..d118b21 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -965,7 +965,7 @@ m4_syscmd (struct obstack *obs MAYBE_UNUSED, int argc, token_data **argv)
 #endif
   prog_args[2] = cmd;
   errno = 0;
-  status = execute (ARG (0), SYSCMD_SHELL, (char **) prog_args, false,
+  status = execute (ARG (0), SYSCMD_SHELL, prog_args, NULL, false,
                     false, false, false, true, false, &sig_status);
   if (sig_status)
     {
@@ -1008,7 +1008,7 @@ m4_esyscmd (struct obstack *obs, int argc, token_data **argv)
 #endif
   prog_args[2] = cmd;
   errno = 0;
-  child = create_pipe_in (ARG (0), SYSCMD_SHELL, (char **) prog_args,
+  child = create_pipe_in (ARG (0), SYSCMD_SHELL, prog_args, NULL,
                           NULL, false, true, false, &fd);
   if (child == -1)
     {
-- 
2.7.4
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.