From d3f7efb7f8d2c31f366f2dca0365f1f0e8728e06 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 9 Jul 2023 11:23:58 -0700 Subject: [PATCH] c32width: protect against bad configure args MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Avoid ‘test’ misuse with ‘./configure gt_cv_locale_fr=""’. Possible problem of this sort reported by Angelo Graziosi in: https://lists.gnu.org/r/emacs-devel/2023-07/msg00329.html * m4/locale-fr.m4 (gt_LOCALE_FR_UTF8, gt_LOCALE_FR_UTF8): * m4/locale-ja.m4 (gt_LOCALE_JA): * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): Reject locale names that might cause trouble with sh or make. --- ChangeLog | 11 +++++++++++ m4/locale-fr.m4 | 14 +++++++++++++- m4/locale-ja.m4 | 8 +++++++- m4/locale-zh.m4 | 8 +++++++- 4 files changed, 38 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 476a88c3b5..e53c034e63 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2023-07-09 Paul Eggert + + c32width: protect against bad configure args + Avoid ‘test’ misuse with ‘./configure gt_cv_locale_fr=""’. + Possible problem of this sort reported by Angelo Graziosi in: + https://lists.gnu.org/r/emacs-devel/2023-07/msg00329.html + * m4/locale-fr.m4 (gt_LOCALE_FR_UTF8, gt_LOCALE_FR_UTF8): + * m4/locale-ja.m4 (gt_LOCALE_JA): + * m4/locale-zh.m4 (gt_LOCALE_ZH_CN): + Reject locale names that might cause trouble with sh or make. + 2023-07-06 Bruno Haible wcscmp: Work around a glibc bug. diff --git a/m4/locale-fr.m4 b/m4/locale-fr.m4 index 107ab931e8..40b13aeaa7 100644 --- a/m4/locale-fr.m4 +++ b/m4/locale-fr.m4 @@ -1,4 +1,4 @@ -# locale-fr.m4 serial 21 +# locale-fr.m4 serial 22 dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -133,6 +133,12 @@ int main () { rm -fr conftest* ]) LOCALE_FR=$gt_cv_locale_fr + case $LOCALE_FR in #( + '' | *[[[:space:]\"\$\'*@<:@]]*) + dnl This locale name might cause trouble with sh or make. + AC_MSG_WARN([invalid locale "$LOCALE_FR"; assuming "none"]) + LOCALE_FR=none;; + esac AC_SUBST([LOCALE_FR]) ]) @@ -261,6 +267,12 @@ int main () { esac ]) LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 + case $LOCALE_FR_UTF8 in #( + '' | *[[[:space:]\"\$\'*@<:@]]*) + dnl This locale name might cause trouble with sh or make. + AC_MSG_WARN([invalid locale "$LOCALE_FR_UTF8"; assuming "none"]) + LOCALE_FR_UTF8=none;; + esac AC_SUBST([LOCALE_FR_UTF8]) dnl Users of $LOCALE_FR_UTF8 need to know which of the locale categories they diff --git a/m4/locale-ja.m4 b/m4/locale-ja.m4 index f6ca327b94..a400b75763 100644 --- a/m4/locale-ja.m4 +++ b/m4/locale-ja.m4 @@ -1,4 +1,4 @@ -# locale-ja.m4 serial 16 +# locale-ja.m4 serial 17 dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -139,5 +139,11 @@ int main () rm -fr conftest* ]) LOCALE_JA=$gt_cv_locale_ja + case $LOCALE_JA in #( + '' | *[[[:space:]\"\$\'*@<:@]]*) + dnl This locale name might cause trouble with sh or make. + AC_MSG_WARN([invalid locale "$LOCALE_JA"; assuming "none"]) + LOCALE_JA=none;; + esac AC_SUBST([LOCALE_JA]) ]) diff --git a/m4/locale-zh.m4 b/m4/locale-zh.m4 index 94c545906f..8cb7b5e519 100644 --- a/m4/locale-zh.m4 +++ b/m4/locale-zh.m4 @@ -1,4 +1,4 @@ -# locale-zh.m4 serial 16 +# locale-zh.m4 serial 17 dnl Copyright (C) 2003, 2005-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -133,5 +133,11 @@ int main () rm -fr conftest* ]) LOCALE_ZH_CN=$gt_cv_locale_zh_CN + case $LOCALE_ZH_CN in #( + '' | *[[[:space:]\"\$\'*@<:@]]*) + dnl This locale name might cause trouble with sh or make. + AC_MSG_WARN([invalid locale "$LOCALE_ZH_CN"; assuming "none"]) + LOCALE_ZH_CN=none;; + esac AC_SUBST([LOCALE_ZH_CN]) ]) -- 2.39.5