| Summary: | packagekitd deadlocks if database does not exist | ||
|---|---|---|---|
| Product: | PackageKit | Reporter: | Klaus Kämpf <kkaempf> |
| Component: | core | Assignee: | Richard Hughes <richard> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | medium | ||
| Version: | unspecified | ||
| Hardware: | x86-64 (AMD64) | ||
| OS: | All | ||
| Whiteboard: | |||
| i915 platform: | i915 features: | ||
|
Description
Klaus Kämpf
2008-03-28 09:10:57 UTC
We have already:
static void
pk_transaction_db_init (PkTransactionDb *tdb)
{
gboolean create_file;
const gchar *statement;
gint rc;
g_return_if_fail (tdb != NULL);
g_return_if_fail (PK_IS_TRANSACTION_DB (tdb));
tdb->priv = PK_TRANSACTION_DB_GET_PRIVATE (tdb);
/* if the database file was not installed (or was nuked) recreate it */
create_file = g_file_test (PK_TRANSACTION_DB_FILE, G_FILE_TEST_EXISTS);
pk_debug ("trying to open database '%s'", PK_TRANSACTION_DB_FILE);
rc = sqlite3_open (PK_TRANSACTION_DB_FILE, &tdb->priv->db);
if (rc) {
pk_warning ("Can't open database: %s\n", sqlite3_errmsg (tdb->priv->db));
sqlite3_close (tdb->priv->db);
return;
} else {
if (create_file == FALSE) {
statement = "CREATE TABLE transactions ("
"transaction_id TEXT primary key,"
"timespec TEXT,"
"duration INTEGER,"
"succeeded INTEGER DEFAULT 0,"
"role TEXT,"
"data TEXT,"
"description TEXT);";
sqlite3_exec (tdb->priv->db, statement, NULL, NULL, NULL);
}
}
/* we might be running an old database, recreate */
pk_transaction_db_create_table_last_action (tdb);
}
So I think all we need to do is error out on the pk_warning ("Can't open database... string? What do you think?
Erroring out is probably the best solution. It seems as if the rest of the code cannot handle a non-existing database. I get random crashes when ending packagekitd with Ctrl-C. Yup, I've added a load of checks in 02c8fd68a96cf5f5aece013afee94ecbb1e5752c Does the daemon now do what you expect? Looks good now. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.