From: Michael Tremer Date: Mon, 9 May 2022 22:22:44 +0000 (+0000) Subject: package: Fix storing strings in repository X-Git-Tag: 0.9.28~802 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51c47a9ac6f3ee02d1ba320ae7a87aed1206b427;p=pakfire.git package: Fix storing strings in repository We tried to store all strings directly in the pool (I think) which is not what libsolv liked. Any SOLV files written could not be re-read which is fixed by this change which gives libsolv the chance to store its strings wherever it wants. Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/package.c b/src/libpakfire/package.c index 04986af6e..cac9d95de 100644 --- a/src/libpakfire/package.c +++ b/src/libpakfire/package.c @@ -337,10 +337,12 @@ static const char* pakfire_package_get_string(struct pakfire_package* pkg, int k static void pakfire_package_set_string(struct pakfire_package* pkg, int key, const char* value) { Solvable* s = get_solvable(pkg); - if (!value) - value = ""; + // Unset on empty string + if (!value || !*value) + solvable_unset(s, key); - solvable_set_poolstr(s, key, value); + // Store string + solvable_set_str(s, key, value); } static char** pakfire_package_get_string_array(struct pakfire_package* pkg, Id key) {