test failure on AIX

Bruno Haible <[email protected]>
Newsgroups gmane.comp.gnu.m4.bugs
Message-ID <1739094.snjaRVjesR@omega>
On AIX 7.2, the m4-1.4.18 build fails in "make check":

Checking ../../checks/006.command_li
@ ../doc/m4.texi:1000: Origin of test
../../checks/006.command_li: stderr mismatch
--- m4-tmp.23068986/m4-xerr     2020-05-03 06:30:35.000000000 -0500
+++ m4-tmp.23068986/m4-err      2020-05-03 06:30:35.000000000 -0500
@@ -1,2 +1,3 @@
+ sh: Broken pipe
  hi
  bye

...
Failed checks were:
  ../../checks/006.command_li:err

I reproduce with a probability of ca. 30% like this:

$ cat > in <<EOF
ifdef(`__unix__', ,
      `errprint(` skipping: syscmd does not have unix semantics
')m4exit(`77')')dnl
syscmd(`echo | cat >&- 2>/dev/null')ifelse(sysval, `0',
       `errprint(` skipping: system does not allow closing stdout
')m4exit(`77')')dnl
changequote(`[', `]')dnl
syscmd([echo 'esyscmd(echo hi >&2 && echo err"print(bye
)d"nl)dnl' > tmp.m4 \
  && ']__program__[' tmp.m4 <&- >&- \
  && rm tmp.m4])sysval
EOF

$ src/m4 < in
sh: There is no process to read data written to a pipe.
hi
bye
0

The attached patch fixes it.
0003-Fix-failure-of-test-006.command_li-on-AIX-7.2.patch (text/x-patch, 1.5 KB)
From 922bd937edae734435a449ef90647939be775bc7 Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sun, 3 May 2020 13:49:26 +0200
Subject: [PATCH 3/3] Fix failure of test 006.command_li on AIX 7.2.

* doc/m4.texi (Command line files): Discard the shell's "Broken pipe"
diagnostic.
---
 doc/m4.texi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/doc/m4.texi b/doc/m4.texi
index 59f0212..a85ca46 100644
--- a/doc/m4.texi
+++ b/doc/m4.texi
@@ -40,7 +40,7 @@ This manual (@value{UPDATED}) is for GNU M4 (version
 @value{VERSION}), a package containing an implementation of the m4 macro
 language.
 
-Copyright @copyright{} 1989-1994, 2004-2014, 2016-2017 Free Software
+Copyright @copyright{} 1989-1994, 2004-2014, 2016-2017, 2020 Free Software
 Foundation, Inc.
 
 @quotation
@@ -987,7 +987,7 @@ options.
 ifdef(`__unix__', ,
       `errprint(` skipping: syscmd does not have unix semantics
 ')m4exit(`77')')dnl
-syscmd(`echo | cat >&- 2>/dev/null')ifelse(sysval, `0',
+syscmd(`(echo | cat >&-) 2>/dev/null')ifelse(sysval, `0',
        `errprint(` skipping: system does not allow closing stdout
 ')m4exit(`77')')dnl
 changequote(`[', `]')dnl
@@ -1001,7 +1001,7 @@ sysval
 ifdef(`__unix__', ,
       `errprint(` skipping: syscmd does not have unix semantics
 ')m4exit(`77')')dnl
-syscmd(`echo | cat >&- 2>/dev/null')ifelse(sysval, `0',
+syscmd(`(echo | cat >&-) 2>/dev/null')ifelse(sysval, `0',
        `errprint(` skipping: system does not allow closing stdout
 ')m4exit(`77')')dnl
 changequote(`[', `]')dnl
-- 
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.