[Bug 244640] [Patch][Lua loader] Implement missing "read-conf" 4th command
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Wed Apr 29 12:28:21 UTC 2020
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244640
--- Comment #6 from Olivier Certner <olivier.freebsd at free.fr> ---
Created attachment 213909
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=213909&action=edit
Replace "readConfFiles" by "readConf", simplifications, fix corner case
The corner case I spotted is that some "read-conf" issued after
"loader_conf_files" has been set fails to reload these files if the initial
file to read contains "loader_conf_files" with the same list.
I first tried to solve it by temporarily removing "loader_conf_files" from the
environment before loading any file and then checking if it was set in the
meantime. This approach works but has two (arguably minor) problems: each
processed file cannot itself on the previous value of "loader_conf_files", and
this causes lots of calls to setenv/unsetenv/getenv (don't know if this is
really a problem, but some comments made me think it could).
So I settled for another approach, which doesn't have any of these drawbacks.
Instead, it depends on the use of "env_changed" (and the fact that parsing a
configuration file sets environment variables through "setEnv").
I've replaced readConfFiles by a simple readConf (which still can be passed the
"loaded_files" map, but this is not used internally; the argument could be
removed), which is used by "config.load" as well as "read-conf" straight.
What do you think?
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the freebsd-bugs
mailing list