On Wed, Jun 18, 2014 at 01:40:43AM +0100, Stuart Henderson wrote: > On 2014/06/18 00:17, Ingo Schwarze wrote: > > So the question is how to ignore the error in this case, without > > ignoring other potential errors as well. I see the following options: > > > > a) When pkg_add(1) wants a new database and no warning, > > let it call makewhatis(8) without -d. > > > > b) Add an option "pkg_add(1) mode" to makewhatis(8), > > let pkg_add(1) always use that, and let makewhatis(8) > > ignore this particular error in this case. > > I suspect there will be a few more cases where pkg_add(1) > > wants makewhatis(8) behaviour that is slightly different > > from sane default behaviour in the non-pkg_add case. > > > > I could live with both approaches; the second one seems slightly > > more flexible and requires less code in pkg_add(1), at the > > expense of one more option for makewhatis(8). > > > > Which one do you prefer? > > I think you have sold B to me. :) Something like this?
No, this is backwards. my makewhatis was perfectly fine creating the database from scratch. It did not throw any fit. If you're worried somebody may manually use makewhatis to create databases in wrong locations, well, that makes *no sense*. The add/remove pages to the database are there explicitly for programs like pkg_add/pkg_delete. They are *not* going to be used by normal users. It makes no sense to have to add *more code*, *more logic* to pkg_add (that may fail) and *more test cases* to prevent an error that should not be there in the first place. if you really want to worry about this, add a flag to makewhatis that says "shut the fuck up, I might be creating a database, it's none of your business". But think about it: does it make sense to create *more complicated logic* in pkg_add because of this ?
