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

Bruno Haible <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.bugs
Message-ID <[email protected]>
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.