Ensure DESC infolevel is loaded before checking pkg->filename
This is the first step of fixing FS#9547. This should not break any existing code that may rely on this function behaving the way it did, and should be good for inclusion in a maint release. In addition, update pactest so it fills the FILENAME field in the DB entries it creates so we can move forward with a real fix to this issue. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
f4ac63ab43
commit
b206aaee88
3 changed files with 5 additions and 7 deletions
|
@ -297,10 +297,6 @@ int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
|
||||||
}
|
}
|
||||||
_alpm_strtrim(line);
|
_alpm_strtrim(line);
|
||||||
if(!strcmp(line, "%FILENAME%")) {
|
if(!strcmp(line, "%FILENAME%")) {
|
||||||
/* filename is _new_ - it provides the real name of the package, on the
|
|
||||||
* server, to allow for us to not tie the name of the actual file to the
|
|
||||||
* data of the package
|
|
||||||
*/
|
|
||||||
if(fgets(info->filename, sizeof(info->filename), fp) == NULL) {
|
if(fgets(info->filename, sizeof(info->filename), fp) == NULL) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,11 +162,12 @@ const char SYMEXPORT *alpm_pkg_get_filename(pmpkg_t *pkg)
|
||||||
ASSERT(handle != NULL, return(NULL));
|
ASSERT(handle != NULL, return(NULL));
|
||||||
ASSERT(pkg != NULL, return(NULL));
|
ASSERT(pkg != NULL, return(NULL));
|
||||||
|
|
||||||
if(!strlen(pkg->filename)) {
|
|
||||||
/* construct the file name, it's not in the desc file */
|
|
||||||
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
|
if(pkg->origin == PKG_FROM_CACHE && !(pkg->infolevel & INFRQ_DESC)) {
|
||||||
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
|
_alpm_db_read(pkg->origin_data.db, pkg, INFRQ_DESC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!strlen(pkg->filename)) {
|
||||||
|
/* construct the file name, it's not in the desc file */
|
||||||
if(pkg->arch && strlen(pkg->arch) > 0) {
|
if(pkg->arch && strlen(pkg->arch) > 0) {
|
||||||
snprintf(pkg->filename, PKG_FILENAME_LEN, "%s-%s-%s" PKGEXT,
|
snprintf(pkg->filename, PKG_FILENAME_LEN, "%s-%s-%s" PKGEXT,
|
||||||
pkg->name, pkg->version, pkg->arch);
|
pkg->name, pkg->version, pkg->arch);
|
||||||
|
|
|
@ -261,6 +261,7 @@ class pmdb:
|
||||||
if pkg.reason:
|
if pkg.reason:
|
||||||
data.append(_mksection("REASON", pkg.reason))
|
data.append(_mksection("REASON", pkg.reason))
|
||||||
else:
|
else:
|
||||||
|
data.append(_mksection("FILENAME", pkg.filename()))
|
||||||
if pkg.replaces:
|
if pkg.replaces:
|
||||||
data.append(_mksection("REPLACES", pkg.replaces))
|
data.append(_mksection("REPLACES", pkg.replaces))
|
||||||
if pkg.force:
|
if pkg.force:
|
||||||
|
|
Loading…
Add table
Reference in a new issue