#48327: malformed registry --------------------------+-------------------------------- Reporter: rjvbertin@… | Owner: macports-tickets@… Type: defect | Status: closed Priority: Normal | Milestone: Component: base | Version: Resolution: invalid | Keywords: Port: | --------------------------+-------------------------------- Comment (by cal@…): Replying to [comment:4 rjvbertin@…]:
Yes, though I've come to expect issues with sqlite.
SQLite is actually a very-well tested piece of software.
IIRC, the phpbb forum software is based on it too, and I've witnessed enough board crashes because of db corruption...
Really? IIRC phpbb uses MySQL.
we should probably make a copy, yes. Patches are very welcome on this one. Note that we cannot copy the database reliably after we've opened the database, so the copy must be done before opening.
I'm guessing this should best be done in src/cregistry/registry.c, but should it be in reg_attach()/reg_detach() or rather in reg_open()/reg_close()? If I'm interpreting the function names correctly, the latter would provide the finer-grained safety (at the expense of adding a member to reg_registry). I'm not sure if there's a point to that though, nor how to handle cases like an existing backup file when a new backup is to be made. Should that be handled through reg_throw()?
I'd do it in reg_attach/reg_detach; reg_open/reg_close don't deal with the actual registry database file, but just setup the connection to SQLite and initialize a few things we need in SQLite. I don't think this backup mechanism should be a way to provide the feature set that should be provided by transactions, though. I'd rather have a couple of backup copies that a user can manually revert to if things stopped working correctly. Maybe use a timestamp in the target filename? Of course, we'd need some kind of cleanup, because copying on each open of the registry can generate a lot of data very quickly. -- Ticket URL: <https://trac.macports.org/ticket/48327#comment:5> MacPorts <https://www.macports.org/> Ports system for OS X