home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: gnu.utils.bug
- Path: sparky!uunet!cis.ohio-state.edu!banzai.pcc.COM!jay
- From: jay@banzai.pcc.COM (Jay Schuster)
- Subject: Make-3.62 (and earlier) vpath bug (with fix)
- Message-ID: <C0GJx7.6JF@banzai.PCC.COM>
- Summary: Incorrect deletion out of a list
- Keywords: GNU make-3.62
- Sender: gnulists@ai.mit.edu
- Organization: The People's Computer Company, Williston, VT
- Distribution: gnu
- Date: Thu, 7 Jan 1993 00:31:01 GMT
- Approved: bug-gnu-utils@prep.ai.mit.edu
- Lines: 49
-
- Running GNU Make-3.62 on an IBM RS/6000 running AIX 3.2, using the
- builtin alloca() through the -ma compiler flag.
-
- The code in construct_vpath_list in vpath.c that deletes items out of
- the vpaths list does not work correctly. When given a `vpath'
- directive with no pattern or search path, it should delete everything
- out of the list. It does do that, but leaves the vpaths variable
- pointing to freed space, thus messing up any future vpath
- additions. In our case, it was creating a circular list (which
- iterated forever, or, when I had linked with the C-alloca, ate up
- all the swapspace while doing so).
-
- This patch fixes the problem:
-
- --- ./vpath.c~ Wed Jan 6 18:11:39 1993
- +++ ./vpath.c Wed Jan 6 19:20:34 1993
- @@ -124,8 +124,8 @@
- /* Remove matching listings. */
- register struct vpath *path, *lastpath;
-
- - lastpath = vpaths;
- - for (path = vpaths; path != 0; lastpath = path, path = path->next)
- + lastpath = NULL;
- + for (path = vpaths; path != 0; path = path->next)
- if (pattern == 0
- || (((percent == 0 && path->percent == 0)
- || (percent - pattern == path->percent - path->pattern))
- @@ -132,7 +132,7 @@
- && streq (pattern, path->pattern)))
- {
- /* Remove it from the linked list. */
- - if (lastpath == vpaths)
- + if (lastpath == NULL)
- vpaths = path->next;
- else
- lastpath->next = path->next;
- @@ -142,6 +142,8 @@
- free ((char *) path->searchpath);
- free ((char *) path);
- }
- + else
- + lastpath = path;
- if (pattern != 0)
- free (pattern);
- return;
- --
- Jay Schuster <jay@pcc.COM> uunet!uvm-gen!banzai!jay, attmail!banzai!jay
- The People's Computer Company `Revolutionary Programming'
-
-