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

 
 

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

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

Add a New Comment Rich Markup
   

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>
Group 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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    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.13-f8d8.
    Corresponding source code