User error triggers Virtualmin bug

I had a proftpd configuration file /etc/proftpd.conf in which I absent-mindedly deleted a line at the end. So it ended up like this at the end:

other lines SFTPEngine on other lines

As you can see, the closing



is missing. This is syntactically invalid, but Proftpd did not report any error. Perhaps it assumed that end-of-file closes the IfModule section.

Virtualmin GPL did not report any error either. It added a virtual server, and it also added an IP-based virtualhost into /etc/proftpd.conf. So now the file looked like this:

other lines SFTPEngine on other lines other lines

But when I deleted the virtual server, Virtualmin deleted all traces of it except for the virtualhost entry in proftp.conf, which it left untouched. As I created and deleted virtual servers while testing Virtualmin GPL, it kept adding virtualhost entries into proftp.conf but never deleting any. Finally I ended up with a dozen virtualhost entries in proftp.conf even though I had deleted all the virtual servers.

I think this is a bug. Virtualmin should either refuse to add a virtualhost entry into a syntactically-invalid file or, having added one, should be able to remove it too.