[pacman-dev] [PATCH] Report missing directory if we can not initialise alpm library

Allan McRae allan at archlinux.org
Sun Jul 21 02:51:08 EDT 2013


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 at archlinux.org>
---
 src/pacman/conf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 2985aba..ab6dae0 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -668,8 +668,8 @@ static int setup_libalpm(void)
 	/* 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"));
 		}
-- 
1.8.3.3



More information about the pacman-dev mailing list