]> wolfpit.net Git - tool/Arch-pacman/.git/commitdiff
Report missing directory if we can not initialise alpm library
authorAllan McRae <allan@archlinux.org>
Sun, 21 Jul 2013 06:48:31 +0000 (16:48 +1000)
committerAllan McRae <allan@archlinux.org>
Tue, 30 Jul 2013 03:02:06 +0000 (13:02 +1000)
When pacman failed to initialise the alpm library due to the database
directory being missing (either via the root not existing or the database
directory itself not existing), it just printed the non-informative
message "could not find or read directory".  Add the directory
information the the error output.  E.g.:

error: failed to initialize alpm library
(could not find or read directory: /this/does/not/exist/var/lib/pacman/)

Signed-off-by: Allan McRae <allan@archlinux.org>
src/pacman/conf.c

index 2985aba1c10fd60793d23e49e6c3f215c79da6ed..ab6dae080af68d4e6bb204971b8526ee8b666694 100644 (file)
@@ -668,8 +668,8 @@ static int setup_libalpm(void)
        /* initialize library */
        handle = alpm_initialize(config->rootdir, config->dbpath, &err);
        if(!handle) {
        /* initialize library */
        handle = alpm_initialize(config->rootdir, config->dbpath, &err);
        if(!handle) {
-               pm_printf(ALPM_LOG_ERROR, _("failed to initialize alpm library (%s)\n"),
-                       alpm_strerror(err));
+               pm_printf(ALPM_LOG_ERROR, _("failed to initialize alpm library\n(%s: %s)\n"),
+                       alpm_strerror(err), config->dbpath);
                if(err == ALPM_ERR_DB_VERSION) {
                        pm_printf(ALPM_LOG_ERROR, _("  try running pacman-db-upgrade\n"));
                }
                if(err == ALPM_ERR_DB_VERSION) {
                        pm_printf(ALPM_LOG_ERROR, _("  try running pacman-db-upgrade\n"));
                }