From 514fd101742dee557e5eb43d0023a221ae8a7172 Mon Sep 17 00:00:00 2001 From: "Field G. Van Zee" Date: Thu, 14 Oct 2021 13:50:28 -0500 Subject: [PATCH] Fixed substitution bug in configure. Details: - Fixed a bug in configure related to the building of the so-called config list. When processing the contents of config_registry, configure creates a series of structures and list that allow for various mappings related to configuration families, subconfigs, and kernel sets. Two of those lists are built via subsitituion of umbrella families with their subconfig members, and one of those lists was improperly performing the subtitution in a way that would erroneously match on partial umbrella family names. That code was changed to match the code that was already doing the subtitution properly, via substitute_words(). - Added comments noting the importance of using substitute_words() in both instances. --- configure | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/configure b/configure index d0ac29ae1..3c865dad9 100755 --- a/configure +++ b/configure @@ -692,13 +692,21 @@ read_registry_file() if [ "${mem}" != "${mems_mem}" ]; then #clist="${config_registry[$config]}" - clist=$(query_array "config_registry" ${config}) + clisttmp=$(query_array "config_registry" ${config}) # Replace the current config with its constituent config set, # canonicalize whitespace, and then remove duplicate config # set names, if they exist. Finally, update the config registry # with the new config list. - newclist=$(echo -e "${clist}" | sed -e "s/${mem}/${mems_mem}/g") + # NOTE: WE must use substitute_words() rather than a simple sed + # expression because we need to avoid matching partial strings. + # For example, if clist above contains "foo bar barsk" and we use + # sed to substitute "bee boo" as the members of "bar", the + # result would (incorrectly) be "foo bee boo bee boosk", + # which would then get reduced, via rm_duplicate_words(), to + # "foo bee boo boosk". + #newclist=$(echo -e "${clist}" | sed -e "s/${mem}/${mems_mem}/g") + newclist=$(substitute_words "${mem}" "${mems_mem}" "${clisttmp}") newclist=$(canonicalize_ws "${newclist}") newclist=$(rm_duplicate_words "${newclist}") @@ -781,6 +789,13 @@ read_registry_file() # canonicalize whitespace, and then remove duplicate kernel # set names, if they exist. Finally, update the kernel registry # with the new kernel list. + # NOTE: WE must use substitute_words() rather than a simple sed + # expression because we need to avoid matching partial strings. + # For example, if klist above contains "foo bar barsk" and we use + # sed to substitute "bee boo" as the members of "bar", the + # result would (incorrectly) be "foo bee boo bee boosk", + # which would then get reduced, via rm_duplicate_words(), to + # "foo bee boo boosk". #newklist=$(echo -e "${klisttmp}" | sed -e "s/${ker}/${kers_ker}/g") newklist=$(substitute_words "${ker}" "${kers_ker}" "${klisttmp}") newklist=$(canonicalize_ws "${newklist}")