[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
syscmd broken on FreeBSD and AIX
From: |
Bruno Haible |
Subject: |
syscmd broken on FreeBSD and AIX |
Date: |
Fri, 23 Sep 2022 02:38:03 +0200 |
Hi,
With the current m4 from git (branch-1.4), several tests fail on FreeBSD 13
and AIX 7.1 and 7.2, indicating that the syscmd built-in is completely
dysfunctional there:
$ gmake check
Checking ../../checks/001.preprocess
Checking ../../checks/002.debugging_
Checking ../../checks/003.command_li
Checking ../../checks/004.command_li
Checking ../../checks/005.command_li
@ ../doc/m4.texi:991: Origin of test
../../checks/005.command_li: stdout mismatch
--- m4-tmp.12976316/m4-xout 2022-09-22 11:14:37.000000000 -0700
+++ m4-tmp.12976316/m4-out 2022-09-22 11:14:37.000000000 -0700
@@ -1 +1 @@
- 1
+ 127
...
Failed checks were:
../../checks/005.command_li:out ../../checks/006.command_li:out
../../checks/006.command_li:err ../../checks/007.command_li:out
../../checks/007.command_li:err ../../checks/145.diversions:out
../../checks/145.diversions:err ../../checks/194.syscmd:out
../../checks/194.syscmd:err ../../checks/195.syscmd:err
../../checks/196.esyscmd:out ../../checks/196.esyscmd:err
../../checks/197.sysval:out ../../checks/197.sysval:err
../../checks/199.mkstemp:out ../../checks/199.mkstemp:err
../../checks/200.mkstemp:out ../../checks/200.mkstemp:err
../../checks/201.mkstemp:out ../../checks/201.mkstemp:err
../../checks/209.using_froz:out ../../checks/209.using_froz:err
The problem can be reproduced interactively:
$ src/m4
syscmd(`echo')
echo: --: not found.
m4: syscmd subprocess failed
What happens, is that this invokes "sh -c -- echo". Which does not work. See:
$ sh -c -- echo
echo: --: not found
$ sh -c -- pwd
pwd: --: not found
$ sh -c -- foobar
foobar: --: not found
On Solaris 10, /bin/sh has the same problem, but the configuration of m4 sets
SYSCMD_SHELL = "/usr/xpg4/bin/sh", thus working around the problem in an elegant
way.
On FreeBSD, bash may or may not be installed as /usr/local/bin/bash (part of
the ports collection).
On AIX, bash may or may not be installed as /usr/bin/bash (part of the Bull
Freeware ports).
This is a regression, caused by the commit from 2021-11-19 with title
"syscmd: Allow commands with leading - or +".
Find attached a patch that limits the new behaviour to the commands that
actually start with - or +. With this, the set of failed tests shrinks to
Failed checks were:
../../checks/006.command_li:err ../../checks/196.esyscmd:out
../../checks/196.esyscmd:err ../../checks/197.sysval:out
../../checks/197.sysval:err ../../checks/198.sysval:out
../../checks/198.sysval:err ../../checks/199.mkstemp:err
The added line
prog_args[slot + 1] = NULL;
is currently technically a nop, but makes the code more future-proof
(in case more variation is needed in the prog_args array in the future).
Bruno
0001-syscmd-Make-it-work-again-for-most-commands-on-FreeB.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- syscmd broken on FreeBSD and AIX,
Bruno Haible <=