Paul Eggert did:
> 2023-07-09  Paul Eggert  <egg...@cs.ucla.edu>
>
>       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.

Thanks. Protecting against bad locale names in sh syntax is easy (just
double-quote every reference), but in make syntax it is hard. I like
your patch and have propagated it to the other two files:


2023-07-10  Bruno Haible  <br...@clisp.org>

        Apply the last change to all locale-*.m4 files.
        * m4/locale-ar.m4 (gt_LOCALE_AR): Reject locale name that might cause
        trouble with sh or make.
        * m4/locale-tr.m4 (gt_LOCALE_TR_UTF8): Likewise.

diff --git a/m4/locale-ar.m4 b/m4/locale-ar.m4
index 3c3342db08..2a7f4918d5 100644
--- a/m4/locale-ar.m4
+++ b/m4/locale-ar.m4
@@ -100,5 +100,11 @@ AC_DEFUN_ONCE([gt_LOCALE_AR]
     rm -fr conftest*
   ])
   LOCALE_AR=$gt_cv_locale_ar
+  case $LOCALE_AR in #(
+    '' | *[[[:space:]\"\$\'*@<:@]]*)
+      dnl This locale name might cause trouble with sh or make.
+      AC_MSG_WARN([invalid locale "$LOCALE_AR"; assuming "none"])
+      LOCALE_AR=none;;
+  esac
   AC_SUBST([LOCALE_AR])
 ])
diff --git a/m4/locale-tr.m4 b/m4/locale-tr.m4
index d34df057d1..eb51484ec6 100644
--- a/m4/locale-tr.m4
+++ b/m4/locale-tr.m4
@@ -122,5 +122,11 @@ AC_DEFUN_ONCE([gt_LOCALE_TR_UTF8]
     rm -fr conftest*
   ])
   LOCALE_TR_UTF8=$gt_cv_locale_tr_utf8
+  case $LOCALE_TR_UTF8 in #(
+    '' | *[[[:space:]\"\$\'*@<:@]]*)
+      dnl This locale name might cause trouble with sh or make.
+      AC_MSG_WARN([invalid locale "$LOCALE_TR_UTF8"; assuming "none"])
+      LOCALE_TR_UTF8=none;;
+  esac
   AC_SUBST([LOCALE_TR_UTF8])
 ])




Reply via email to