The following Makefile causes make 3.79.1 to segfault on Linux: -----cut here----- foo: @echo $(if $(findstring foo,bar),,foo) foo -----cut here-----
The problem here is that func_if in function.c assumes that there will be an empty string marking the end of the arguments, when in fact there might not be. If I understand the code correctly, what marks the empty arguments is a pointer to any string, empty or not, followed by a null pointer; in this case, the string pointer immediately preceding the null pointer is considered the end pointer for the final argument, i.e., it points to one past the final argument. If my understanding is correct, then the patch below fixes this bug (and it does seem to work for me). Please remember to respond to me in addition to [EMAIL PROTECTED]; I don't read bug-make. Thanks, Jonathan Kamens Index: function.c =================================================================== RCS file: /projects/systems/cvs-root/gnu/make/function.c,v retrieving revision 1.1.1.2 diff -u -r1.1.1.2 function.c --- function.c 1999/10/20 21:57:50 1.1.1.2 +++ function.c 2001/12/05 23:08:28 @@ -1122,7 +1122,7 @@ /* If we're doing the else-clause, make sure we concatenate any potential extra arguments into the last argument. */ if (!result) - while (*endp && **endp != '\0') + while (*endp && **endp != '\0' && endp[1]) ++endp; expansion = expand_argument (*argv, *endp-1); _______________________________________________ Bug-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-make