seg fault with EXTRA_PREREQS

Shim Manning <[email protected]>
Newsgroups gmane.comp.gnu.make.bugs
Message-ID <CAPN3a9667H5N0O92jPyheqqkObhdBd3ADNSbH+s-OVfTzcEZ-g@mail.gmail.com>
Seems that using .EXTRA_PREREQS can cause a segfault under the right
conditions.

 in file.c, when"snap_deps" is called to process the EXTRA_PREREQS..

    struct dep *prereqs = expand_extra_prereqs (lookup_variable
(STRING_SIZE_TUPLE(".EXTRA_PREREQS")));

    /* Perform per-file snap operations.  */
    hash_map_arg(&files, snap_file, prereqs);

The "expand_extra_prereqs" function is allowed to insert values in the hash
table, and this can invalidate the loop in hash_map_arg

stack trace of the call:

snap_deps
hash_map_arg   (loop happens here)
snap_file
expand_extra_prereqs
enter_file
hash_insert_at
hash_rehash  (loop no longer valid)

causes a fairly consistent crash.  I'm working on a minimal reproduction if
it's necessary, but allowing the table to be rehashed while iterating seems
like a problem.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.