summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-07-05 13:24:10 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-07-05 13:24:10 -0700
commiteb53f97ab64cf3f51fde80ff9ca67a5b290c20a4 (patch)
tree0120a0ab60e40524f11343ce572559e7e7c8b63e
parentb66147bef15f6cb7fcb9d15f121d1e345a7af970 (diff)
til: more strictly filter til_module_setup()
It was too coarse a condition filtering the list on !name. This change actually looks up non-NULL names to verify it's a resolvable module name before producing the unfiltered list. Mostly just to prevent fat-fingered manual module inputs from resulting in unexpectedly larger and potentially dangerous module lists in interactive "invalid input" retries. Observed in the WIP rkt_scener stuff...
-rw-r--r--src/til.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/til.c b/src/til.c
index 66b2b5c..7ee4744 100644
--- a/src/til.c
+++ b/src/til.c
@@ -472,7 +472,13 @@ int til_module_setup(const til_settings_t *settings, til_setting_t **res_setting
const char *values[nelems(modules) + 1] = {};
const char *annotations[nelems(modules) + 1] = {};
const til_settings_t *parent;
- int r;
+ int r, filtered = 1;
+
+ /* Only disable filtering if a *valid* name is providead.
+ * This is so fat-fingered names don't suddenly include a bunch of broken options.
+ */
+ if (name && til_lookup_module(name))
+ filtered = 0;
parent = til_settings_get_parent(settings);
@@ -487,7 +493,7 @@ int til_module_setup(const til_settings_t *settings, til_setting_t **res_setting
* shouldn't be listed, it now skips hermetic if settings->parent is set. That's
* used to imply this isn't the "root" module setup, hence hermetic is inappropriate.
*/
- if (!name) {
+ if (filtered) {
if (modules[i]->flags & TIL_MODULE_EXPERIMENTAL)
continue;
© All Rights Reserved