]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Avoid infinite substitution loop in subst caused by autoconf pre-v2.60
authorTheodore Ts'o <tytso@mit.edu>
Sun, 12 Nov 2006 22:43:50 +0000 (17:43 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 12 Nov 2006 22:43:50 +0000 (17:43 -0500)
Autoconf versions before 2.60 don't have datarootdir defined, and so this
resulted in a @datarootdir@ --> @datarootdir@ infinite expansion.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
util/ChangeLog
util/subst.c

index b9ca5c5fca56596ab4c7d7c8be3feda1b49f916f..5f8f89a4145a90889965f519f9cc15860fff3bb1 100644 (file)
@@ -1,3 +1,10 @@
+2006-11-12  Theodore Tso  <tytso@mit.edu>
+
+       * subst.c (substitute_line): Avoid infinite loop caused by a
+               substition such as @datarootdir@ --> @datarootdir@.  (This
+               was caused by autoconf versions before 2.60, which didn't
+               define the @datarootdir@ expansion.
+
 2006-10-22  Theodore Tso  <tytso@mit.edu>
 
        * subst.conf.in: Add datarootdir definition for compatibility with
index 9244e62036925fabd26a4113b8a280398f9dd08a..445d3186a8657054888e9c03a419d1bb089eb526 100644 (file)
@@ -165,6 +165,12 @@ static void substitute_line(char *line)
 #endif
                ptr = name_ptr-1;
                replace_string(ptr, end_ptr, ent->value);
+               if ((ent->value[0] == '@') &&
+                   (strlen(replace_name) == strlen(ent->value)-2) &&
+                   !strncmp(replace_name, ent->value+1, 
+                            strlen(ent->value)-2))
+                       /* avoid an infinite loop */
+                       ptr += strlen(ent->value);
        }
        /*
         * Now do a second pass to expand ${FOO}