[pacman-dev] [PATCH] pacman: clarify error when alpm fails to init
Currently pacman is hard coded to print the dbpath, then the error alpm returned. Even though the error could really be caused by anything. So instead just print the arugemnts given to alpm and not assume the resulting error message is releated to either path. Fixes FS#59595 Signed-off-by: morganamilo <morganamilo@gmail.com> diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 468a3e02..42946189 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -766,8 +766,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\n(%s: %s)\n"), - alpm_strerror(err), config->dbpath); + pm_printf(ALPM_LOG_ERROR, _("failed to initialize alpm library (root: %s, dbpath: %s):\n%s\n"), + config->rootdir, config->dbpath, alpm_strerror(err)); if(err == ALPM_ERR_DB_VERSION) { fprintf(stderr, _("try running pacman-db-upgrade\n")); } -- 2.23.0
On 6/11/19 9:08 am, morganamilo wrote:
Currently pacman is hard coded to print the dbpath, then the error alpm returned. Even though the error could really be caused by anything.
So instead just print the arugemnts given to alpm and not assume the resulting error message is releated to either path.
Fixes FS#59595
Signed-off-by: morganamilo <morganamilo@gmail.com>
diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 468a3e02..42946189 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -766,8 +766,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\n(%s: %s)\n"), - alpm_strerror(err), config->dbpath); + pm_printf(ALPM_LOG_ERROR, _("failed to initialize alpm library (root: %s, dbpath: %s):\n%s\n"),
Added a newline before the two directories and applied. A
+ config->rootdir, config->dbpath, alpm_strerror(err)); if(err == ALPM_ERR_DB_VERSION) { fprintf(stderr, _("try running pacman-db-upgrade\n")); }
participants (2)
-
Allan McRae
-
morganamilo