On 7/16/20 11:40 AM, Zack Weinberg wrote:
I believe that what's in trunk now should work fine for
cross-compilation of programs that don't require yywrap
I thought so too, but after eyeballing the trunk a bit I noticed a shell
portability bug in the recently-added AC_PROG_LEX code. I then found a couple
more instances of the same bug elsewhere in Autoconf (in rarely-executed code, I
think).
The problem is that constructs like ${ac_lib:-none needed} don't conform to
POSIX, as POSIX requires that the stuff after the :- be a single shell word.
(The next time I meet Steve Bourne I want to give him an earfull....)
I installed a doc patch describing the portability pitfall into Savannah master:
https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=2ff883c27e55b0c0d4a448614c1dee0492c9a7da
and would like to also install the attached patch to fix the code bugs. I have
held off installing this latter patch, though, as I don't want to get in the way
of whatever testing you're doing.
>From 870c40f9df86dcf0d80a4ab6aca2aaa9dffae38e Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Thu, 16 Jul 2020 17:35:36 -0700
Subject: [PATCH] Fix ${VAR-NONWORD} bugs
* lib/autoconf/functions.m4 (AC_FUNC_SELECT_ARGTYPES):
* lib/autoconf/programs.m4 (AC_FUNC_SELECT_ARGTYPES):
* lib/autotest/general.m4 (AT_INIT):
Rewrite to avoid ${VAR-VALUE} where VALUE is not a shell word.
---
lib/autoconf/functions.m4 | 5 ++---
lib/autoconf/programs.m4 | 11 +++++++----
lib/autotest/general.m4 | 7 +++++--
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
index 645a7c60..718503f5 100644
--- a/lib/autoconf/functions.m4
+++ b/lib/autoconf/functions.m4
@@ -1526,7 +1526,8 @@ AC_DEFUN([AC_FUNC_SELECT_ARGTYPES],
[AC_CHECK_HEADERS_ONCE([sys/select.h sys/socket.h])
AC_CACHE_CHECK([types of arguments for select],
[ac_cv_func_select_args],
-[for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
+[ac_cv_func_select_args='int,int *,struct timeval *'
+for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do
for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
AC_COMPILE_IFELSE(
@@ -1546,8 +1547,6 @@ AC_CACHE_CHECK([types of arguments for select],
done
done
done
-# Provide a safe default value.
-: "${ac_cv_func_select_args=int,int *,struct timeval *}"
])
ac_save_IFS=$IFS; IFS=','
set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'`
diff --git a/lib/autoconf/programs.m4 b/lib/autoconf/programs.m4
index 087c913a..7f2d07f8 100644
--- a/lib/autoconf/programs.m4
+++ b/lib/autoconf/programs.m4
@@ -762,11 +762,14 @@ AS_VAR_SET_IF([LEXLIB], [], [
AC_CACHE_CHECK([for lex library], [ac_cv_lib_lex], [
ac_cv_lib_lex='not found'
ac_save_LIBS=$LIBS
- for ac_lib in '' -lfl -ll; do
- LIBS="$ac_lib $ac_save_LIBS"
+ for ac_cv_lib_lex in 'none needed' -lfl -ll 'not found'; do
+ case $ac_cv_lib_lex in
+ 'none needed') ;;
+ 'not found') break;;
+ *) LIBS="$ac_lib $ac_save_LIBS";;
+ esac
AC_LINK_IFELSE([AC_LANG_DEFINES_PROVIDED[`cat $LEX_OUTPUT_ROOT.c`]],
- [ac_cv_lib_lex="${ac_lib:-none needed}"
- break])
+ [break])
done
LIBS=$ac_save_LIBS
])
diff --git a/lib/autotest/general.m4 b/lib/autotest/general.m4
index 5d89d0c0..6a6d1a47 100644
--- a/lib/autotest/general.m4
+++ b/lib/autotest/general.m4
@@ -1642,12 +1642,15 @@ else
else
at_msg="\`${at_testdir+${at_testdir}/}$as_me.log'"
fi
+ at_msg1a=${at_xpass_list:+', '}
+ at_msg1=$at_fail_list${at_fail_list:+" failed$at_msg1a"}
+ at_msg2=$at_xpass_list${at_xpass_list:+" passed unexpectedly"}
+
AS_ECHO(["Please send $at_msg and all information you think might help:
To: <AT_PACKAGE_BUGREPORT>
Subject: @<:@AT_PACKAGE_STRING@:>@ $as_me: dnl
-$at_fail_list${at_fail_list:+ failed${at_xpass_list:+, }}dnl
-$at_xpass_list${at_xpass_list:+ passed unexpectedly}
+$at_msg1$at_msg2
You may investigate any problem if you feel able to do so, in which
case the test suite provides a good starting point. Its output may
--
2.17.1