bug-autoconf
[Top][All Lists]
Advanced

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

Literals check in _AS_PATH_WALK is bogus.


From: Daniel Kobras
Subject: Literals check in _AS_PATH_WALK is bogus.
Date: Thu, 30 May 2002 00:35:24 +0200
User-agent: Mutt/1.3.28i

Moi!

The AS_LITERAL_IF check in autoconf 2.53's definition of _AS_PATH_WALK
appears bogus to me.  The following simple configure.ac (second line
taken verbatim from the autoconf docs)

  AC_INIT(configure.ac)
  AC_PATH_PROG([INETD], [inetd], 
[/usr/libexec/inetd],[$PATH:/usr/libexec:/usr/sbin:/usr/etc:etc])

expands to

  [...]
  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
  for as_dir in $PATH:/usr/libexec:/usr/sbin:/usr/etc:etc
  do
    IFS=$as_save_IFS
    test -z "$as_dir" && as_dir=.
    for ac_exec_ext in '' $ac_executable_extensions; do
    if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
  [...]

which is clearly wrong because the explicit colons are not recognised as
field separators.  That's because AS_LITERAL_IF in _AS_PATH_WALK spots
the dollar sign in $PATH, and chooses not to use a temporary dummy
variable to store the full path.  If I understand the comment in
_AS_PATH_WALK correctly, this is merely meant to be an optimisation that
we can easily drop in favour of correctness.  The following patch
against version 2.53 produces the expected results.

Regards,

Daniel.

--[snip]--

--- lib/m4sugar/m4sh.m4.orig    Thu Feb  7 16:37:55 2002
+++ lib/m4sugar/m4sh.m4 Thu May 30 00:08:44 2002
@@ -600,14 +600,12 @@
 # `$as_dummy' forces splitting on constant user-supplied paths.
 # POSIX.2 word splitting is done only on the output of word
 # expansions, not every word.  This closes a longstanding sh security
-# hole.  Optimize it away when not needed.
+# hole.
 m4_define([_AS_PATH_WALK],
 [AS_REQUIRE([_AS_PATH_SEPARATOR_PREPARE])dnl
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-AS_LITERAL_IF(m4_default([$1], [$PATH]),
-[as_dummy="$1"
-for as_dir in $as_dummy],
-[for as_dir in m4_default([$1], [$PATH])])
+as_dummy="m4_default([$1], [$PATH])"
+for as_dir in $as_dummy
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.



reply via email to

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