bug-autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sr #110518] Document that code snippets undergo shell variable expansio


From: Bruno Haible
Subject: [sr #110518] Document that code snippets undergo shell variable expansion
Date: Sun, 18 Jul 2021 04:51:07 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0

URL:
  <https://savannah.gnu.org/support/?110518>

                 Summary: Document that code snippets undergo shell variable
expansion
                 Project: Autoconf
            Submitted by: haible
            Submitted on: Sun 18 Jul 2021 10:51:05 AM CEST
                Category: None
                Priority: 5 - Normal
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: None

    _______________________________________________________

Details:

Code snippets passed to AC_RUN_IFELSE, AC_LANG_IFELSE, and more generally
AC_LANG_CONFTEST, undergo the expansions inside unquoted here documents. This
comes from


cat > conftest.$ac_ext <<_ACEOF
AC_LANG_DEFINES_PROVIDED[]$1
_ACEOF


There is already user code that relies on this (in Gnulib, for example:
btowc.m4, fchownat.m4, gettext.m4, gnulib-common.m4, iswdigit.m4,
iswxdigit.m4, mbrlen.m4, mbrtoc32.m4, mbrtowc.m4, mbsnrtowcs.m4, mbsrtowcs.m4,
socklen.m4, stdint.m4, strfmon_l.m4, warn-on-use.m4, wcrtomb.m4,
wcsnrtombs.m4, wcsrtombs.m4, wctob.m4). Therefore it's unlikely that this can
ever be changed.

But people who write invocations AC_RUN_IFELSE, AC_LANG_IFELSE, etc. need to
be aware of it, otherwise it's easy to introduce bugs. See the first patch
from https://lists.gnu.org/archive/html/bug-gnulib/2021-07/msg00025.html

The Autoconf documentation should mention that in such code snippets, $
expansion references environment variables, and $ and \ meant as literal
values need to be backslash-escaped.





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/support/?110518>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]