Hello,
This is a known bug. It can be fixed easily :
And that is a very good question!
@Jamie, I have taken a very deep look to this problem. I think it needs your close attention. I think the code in either read_file_lines or flush_file_lines has a bug.
This is what I found out. The Virtualmin function try_function runs $rv = &$func(@args) in eval block. As this block called (i.e. failing dns_setup in this case), and when a config file is missing that is being read in read_file_lines sub, it still makes its way to %main::file_cache, and later when flush_file_lines is called without an argument, that un-existent file first gets to @files and then to open_tempfile and eventually fails.
While running tests I made it work locally by changing flush_file_lines and making sure that files taken from %main:file_cache can be read by adding one extra line to the line 3607:
@files = grep { -r "$_" } @files;
That local fix made the code execute as expected. Although, I suspect that you may want to solve it some other way, for example not adding file to the cache at the first place, if it cannot be read.
This issue can be reproduced in a very simple steps:
- Go to BIND module config and set
chrootto something un-existent, i.e./var/named/chroot/etc - Go to Virtualmin and create a new domain with and without DNS feature enabled:
- In case DNS feature is enabled all irrelevant to DNS features that call
flush_file_lines()without an argument will fail false-positively as OP described - In case DNS feature is not selected upon domain creation all works as expected