1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

avoid blowing out the filecache list when using tmpdir

_alpm_filecache_setup() destroys the list of cachedirs when it finds no
writeable directories in the config. This put us in an awkward situation
where _alpm_filecache_find() would locate a downloaded file in a r/o
cachedir, but then fail to install it after _alpm_filecache_setup() is
called (with a NULL argument). Change this behavior to merely prepend
the temporary directory to the list of available cachedirs.

Dan exposed it in e07547ee4e, as now a package can be found in a
directory we may not be able to actually store packages in.

Reported-by: Rémy Oudompheng <remy@archlinux.org>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dave Reisner 2011-09-04 14:59:17 -04:00 committed by Dan McGee
parent 7ea1ea88bb
commit 400942fedf

View File

@ -699,10 +699,8 @@ const char *_alpm_filecache_setup(alpm_handle_t *handle)
} else {
tmpdir = "/tmp";
}
i = alpm_list_add(NULL, tmpdir);
alpm_option_set_cachedirs(handle, i);
alpm_list_free(i);
cachedir = handle->cachedirs->data;
alpm_option_add_cachedir(handle, tmpdir);
cachedir = handle->cachedirs->prev->data;
_alpm_log(handle, ALPM_LOG_DEBUG, "using cachedir: %s\n", cachedir);
_alpm_log(handle, ALPM_LOG_WARNING,
_("couldn't find or create package cache, using %s instead\n"), cachedir);