helpAutoconf - Support: sr #110518, Document that code snippets...

 
 

sr #110518: Document that code snippets undergo shell variable expansion

Submitted by:  Bruno Haible <haible>
Submitted on:  Sun 18 Jul 2021 08:51:05 AM UTC  
 
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Done
Privacy:  Public Assigned to:  None
Open/Closed:  Closed Operating System:  None

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 19 Jul 2021 04:24:02 PM UTC, comment #2: 

Very nice! Thank you.
(And I had not thought about the backquote character.)

Bruno Haible <haible>
Mon 19 Jul 2021 05:05:47 AM UTC, comment #1: 

Thanks, fixed.

Paul Eggert <eggert>
Project Administrator
Sun 18 Jul 2021 08:51:05 AM UTC, original submission:  

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.

Bruno Haible <haible>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by eggert (Posted a comment)
  • -email is unavailable- added by haible (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-07-19 eggert StatusNone => Done
        Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.7