autoconf-patches
[Top][All Lists]
Advanced

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

AS_SET_UNEXPANDED_ARGS proposal


From: Paul Eggert
Subject: AS_SET_UNEXPANDED_ARGS proposal
Date: Wed, 24 Aug 2005 12:26:54 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Stepan Kasal <address@hidden> writes:

> 2005-08-24  Stepan Kasal  <address@hidden>
>
>       * lib/autoconf/general.m4 (_AC_CANONICAL_SPLIT): Simplify; rejecting
>       some evil values and relying on the fact that $* concatenates the
>       parameters by the first character from IFS.

That looks good; please install.

One other issue comes to mind, though, and this is one that occurs
elsewhere in Autoconf-generated shell scripts.  A command like this:

  set x $something; shift

normally has undesirable behavior if "$something" is subjected to
file name expansion.  For example:

  touch a b c
  something='*-*'
  ac_save_IFS=$IFS;
  IFS='-'
  set x $something; shift
  IFS=$ac_save_IFS
  echo $@

outputs "a b c a b c", which is not what is usually wanted.

POSIX says that you're supposed to work around it using 'set -f'.
Perhaps we should do something like the following, suitably
packaged up for Autoconf?

  if (set -f) 2>/dev/null; then
    ac_do_noglob='set -f'
    ac_do_glob='set +f'
  else
    ac_do_noglob=
    ac_do_glob=
  fi
     
  ac_save_IFS=$IFS
  IFS='-'
  $ac_do_noglob
  set x $something; shift
  $ac_do_glob
  IFS=$ac_save_IFS

This should be done almost everywhere that there is a 'set' command
with args.  Perhaps m4sh needs an AS_SET_UNEXPANDED_ARGS macro, or
something like that, to do the above.




reply via email to

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