> in this case, delete previous odb contents using the "rm" command (then say "y"
> to delete all keys, this is the equivalent of unix "rm -rf /").
>
> this will delete all odb contents except some for some entries in /system,
> /experiment, /alarms, /logger and /runinfo. some of these entries are delete-
> protected, some are watched and some are auto-re-created by al_check() and
> others.
checking that this works uncovered an old bug/problem in the odb delete function:
"rm /experiment/security/rpc hosts" corrupted the free list because of incorrect
delete of "rpc hosts/allowed hosts" which cannot be deleted because it is watched.
fixing this uncovered a second problem: odb "rm -rf /" cannot remove entries in
/system because they are delete-protected (db_delete() should return DB_NO_ACCESS)
and it cannot remove watched items (i.e. "allowed hosts", db_delete() should return
DB_OPEN_RECORD).
but db_delete() cannot return both error codes at the same time! a problem.
previous code returned:
DB_OPEN_RECORD for db_delete("/expt/.../allowed hosts"),
DB_SUCCESS (and corrupted the free list) for db_delete("/expt/...")
DB_NO_ACCESS for db_delete() of delete-protected items
DB_SUCCESS for db_delete() of subdirectory that contains delete-protected items (no
free list corruption, no delete of protected items, no delete of the subdirectory)
updated code returns:
DB_SUCCESS if everything requested was deleted
DB_NO_ACCESS or DB_OPEN_RECORD if some items were not deleted
names of items that could not be deleted are reported via cm_msg().
hopefully, these are improvements.
suggestion on how to make it even better are very welcome.
K.O. |