Bugfix: The bootstrap script improperly loads settings resulting in incorrectly failed builds.
I suspect this situation happened due to various changes over time without a thorough review of everything that needs to be changed.
Reserve the variable index position of 0 to designate not found.
Update all checks to then check for `key` to not be 0 after calling `bootstrap_id()`.
This fixes problems where the position after the last valid index might get set and used as a value.
When the position after the last valid index is read, it could read these values even if it should report not found.
The index position checks are updated to more properly check and assign the index using the appropraite `has-*` and `has-*-mode` vs the normal value `*` and `*-mode`, respectively.
Update all index position checks to check the `has-*` and `has-*-mode` accordingly.
This change fixes the primary problem that is causing the build to fail due to incorrect variable loading.
The `has-*` and `has-*-mode` checks checks for existence.
Then and only then should the actual respective values be used.
In particular, the `*-mode` settings should only be assigned if the respective `has-*-mode` is set to `yes`.
This bug is observed in my **TKIS** script development where the `path_headers` is being treated as an empty string despite being designated as `fll`.
The **Featureless Make** program compiles properly but not this `bootstrap.sh` script.
The **TKIS** scripts are expected to be run on a system without the **FLL** project at all.
I have not observed this problem because I have been using the **Featureless Make** directly for years now.
The packaging and unit tests scripts provided by this project are coincidentally not triggering any obvious errors with the improper behavior.
If the existing scripts were working before then these changes might cause problems with those scripts.
I will follow this up and investigate and fix these issues.
Running the **Featureless Make** on these works and so these changes likely expose existing problems rather than causes regressions.
I would love to find a way to reduce the repetitive assignments to variables in a safe/sane manner.
This would require more research on my part, if it is even possible.
I don't plan on doing such research any time soon and so I am continuing to consider the bootstrap script design as tolerable.
Additional Changes:
- Simplify logic in for loops for `bootstrap_id()` by combining all of the passes into a single pass (The actual index values are irrelevant and so restructuring/reordering caused by this is not a problem).
- Ensure the key is an integer in all cases.
- Remove unnecessary `key` variable assignments.
- Remove some redundant assignments.