[pacman-dev] [PATCH] be_sync: avoid crashing on files in the root of a DB
Allan McRae
allan at archlinux.org
Sun Jul 7 21:22:15 EDT 2013
On 08/07/13 09:53, Dave Reisner wrote:
> As seen: https://bbs.archlinux.org/viewtopic.php?pid=1297766
I know it takes some time, but actually explaining what was seen in that
thread rather than just linking it will save everyone who looks at this
commit some time.
> Signed-off-by: Dave Reisner <dreisner at archlinux.org>
> ---
> lib/libalpm/be_sync.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
> index feda6f5..f3e0a33 100644
> --- a/lib/libalpm/be_sync.c
> +++ b/lib/libalpm/be_sync.c
> @@ -561,6 +561,13 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
> return -1;
> }
>
> + if(filename == NULL) {
> + /* A file exists outside of a subdirectory. This isn't a read error, so return
> + * success and try to continue on. */
> + _alpm_log(db->handle, ALPM_LOG_DEBUG, "unknown database file: %s\n", filename);
Only a debug level statement? I think a warning would be appropriate:
warning: database "foo" contains unknown file: ...
But need to check where that would actually print.
> + return 0;
> + }
> +
> if(strcmp(filename, "desc") == 0 || strcmp(filename, "depends") == 0
> || (strcmp(filename, "deltas") == 0 && db->handle->deltaratio > 0.0) ) {
> int ret;
>
More information about the pacman-dev
mailing list