Store a package info level flag if we fail to load data
If we are missing a local database file, we get repeated messages over and over telling us the same thing, rather than being sane and erroring only once. This package adds an INFRQ_ERROR level that is added to the mask if we encounter any errors on a local_db_read() operation, and short circuits future calls if found in the value. This fixes FS#25313. Note that this does not make any behavior changes other than suppressing error messages and repeated code calls to failure cases; we still have more to do in the "local database is hosed" department. Also make a small update to the wrong but unused flags set in be_package; using INFRQ_ALL there was not totally correct. Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
d9f9b87d3f
commit
ef4757afa5
3 changed files with 15 additions and 6 deletions
|
@ -533,6 +533,13 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
||||||
/* already loaded all of this info, do nothing */
|
/* already loaded all of this info, do nothing */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(info->infolevel & INFRQ_ERROR) {
|
||||||
|
/* We've encountered an error loading this package before. Don't attempt
|
||||||
|
* repeated reloads, just give up. */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
_alpm_log(db->handle, ALPM_LOG_FUNCTION, "loading package data for %s : level=0x%x\n",
|
_alpm_log(db->handle, ALPM_LOG_FUNCTION, "loading package data for %s : level=0x%x\n",
|
||||||
info->name, inforeq);
|
info->name, inforeq);
|
||||||
|
|
||||||
|
@ -619,6 +626,7 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
info->infolevel |= INFRQ_DESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FILES */
|
/* FILES */
|
||||||
|
@ -673,6 +681,7 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
fp = NULL;
|
fp = NULL;
|
||||||
|
info->infolevel |= INFRQ_FILES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* INSTALL */
|
/* INSTALL */
|
||||||
|
@ -681,15 +690,14 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
|
||||||
if(access(path, F_OK) == 0) {
|
if(access(path, F_OK) == 0) {
|
||||||
info->scriptlet = 1;
|
info->scriptlet = 1;
|
||||||
}
|
}
|
||||||
|
info->infolevel |= INFRQ_SCRIPTLET;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* internal */
|
|
||||||
info->infolevel |= inforeq;
|
|
||||||
|
|
||||||
free(pkgpath);
|
free(pkgpath);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
info->infolevel |= INFRQ_ERROR;
|
||||||
free(pkgpath);
|
free(pkgpath);
|
||||||
if(fp) {
|
if(fp) {
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
|
@ -436,9 +436,9 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "sorting package filelist for %s\n", pkgfile);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "sorting package filelist for %s\n", pkgfile);
|
||||||
newpkg->files.files = files_msort(files, files_count);
|
newpkg->files.files = files_msort(files, files_count);
|
||||||
newpkg->files.count = files_count;
|
newpkg->files.count = files_count;
|
||||||
newpkg->infolevel = INFRQ_ALL;
|
newpkg->infolevel = INFRQ_BASE | INFRQ_DESC | INFRQ_FILES | INFRQ_SCRIPTLET;
|
||||||
} else {
|
} else {
|
||||||
newpkg->infolevel = INFRQ_BASE | INFRQ_DESC;
|
newpkg->infolevel = INFRQ_BASE | INFRQ_DESC | INFRQ_SCRIPTLET;
|
||||||
}
|
}
|
||||||
|
|
||||||
return newpkg;
|
return newpkg;
|
||||||
|
|
|
@ -40,7 +40,8 @@ typedef enum _alpm_dbinfrq_t {
|
||||||
INFRQ_SCRIPTLET = (1 << 3),
|
INFRQ_SCRIPTLET = (1 << 3),
|
||||||
INFRQ_DSIZE = (1 << 4),
|
INFRQ_DSIZE = (1 << 4),
|
||||||
/* ALL should be info stored in the package or database */
|
/* ALL should be info stored in the package or database */
|
||||||
INFRQ_ALL = 0x1F
|
INFRQ_ALL = 0x1F,
|
||||||
|
INFRQ_ERROR = (1 << 31)
|
||||||
} alpm_dbinfrq_t;
|
} alpm_dbinfrq_t;
|
||||||
|
|
||||||
/** Database status. Bitflags. */
|
/** Database status. Bitflags. */
|
||||||
|
|
Loading…
Add table
Reference in a new issue