libalpm: print warnings for unknown keys in databases/packages

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
morganamilo 2024-02-03 17:11:23 +00:00 committed by Allan McRae
parent 0649a66ee5
commit e1dc609939
3 changed files with 13 additions and 1 deletions

View file

@ -837,6 +837,11 @@ static int local_db_read(alpm_pkg_t *info, int inforeq)
} }
} }
FREELIST(lines); FREELIST(lines);
} else {
_alpm_log(db->handle, ALPM_LOG_WARNING, _("%s: unknown key '%s' in sync database\n"), info->name, line);
alpm_list_t *lines = NULL;
READ_AND_STORE_ALL(lines);
FREELIST(lines);
} }
} }
fclose(fp); fclose(fp);

View file

@ -251,8 +251,10 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
return -1; return -1;
} }
} else { } else {
const char *pkgname = newpkg->name ? newpkg->name : "error";
_alpm_log(handle, ALPM_LOG_WARNING, _("%s: unknown key '%s' in package description\n"), pkgname, key);
_alpm_log(handle, ALPM_LOG_DEBUG, "%s: unknown key '%s' in description file line %d\n", _alpm_log(handle, ALPM_LOG_DEBUG, "%s: unknown key '%s' in description file line %d\n",
newpkg->name ? newpkg->name : "error", key, linenum); pkgname, key, linenum);
} }
} }
} }

View file

@ -691,6 +691,11 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
} }
} }
FREELIST(lines); FREELIST(lines);
} else {
_alpm_log(db->handle, ALPM_LOG_WARNING, _("%s: unknown key '%s' in local database\n"), pkg->name, line);
alpm_list_t *lines = NULL;
READ_AND_STORE_ALL(lines);
FREELIST(lines);
} }
} }
if(ret != ARCHIVE_EOF) { if(ret != ARCHIVE_EOF) {